You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:35:16 UTC
[01/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Repository: incubator-taverna-plugin-component
Updated Branches:
refs/heads/master [created] 64985f73d
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
new file mode 100644
index 0000000..c27185b
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
new file mode 100644
index 0000000..08639eb
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.api.Version;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
new file mode 100644
index 0000000..4d3e8e3
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.api.Version;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
new file mode 100644
index 0000000..40a94de
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
@@ -0,0 +1,11 @@
+package net.sf.taverna.t2.component.registry;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.Registry;
+
+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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
new file mode 100644
index 0000000..a6ed62e
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry.local;
+
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
new file mode 100644
index 0000000..3dcefda
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry.local;
+
+import static org.junit.Assert.assertSame;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
new file mode 100644
index 0000000..a65a416
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry.local;
+
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
new file mode 100644
index 0000000..8262ebc
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry.local;
+
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
new file mode 100644
index 0000000..c015a96
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
@@ -0,0 +1,24 @@
+package net.sf.taverna.t2.component.registry.local;
+
+import static java.lang.System.getProperty;
+import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
+import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+
+import java.io.File;
+
+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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
new file mode 100644
index 0000000..7874fa4
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
@@ -0,0 +1,25 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
new file mode 100644
index 0000000..54aab8a
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry.standard;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
new file mode 100644
index 0000000..6ea1cc0
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
@@ -0,0 +1,25 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
new file mode 100644
index 0000000..4e428c7
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
@@ -0,0 +1,25 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
new file mode 100644
index 0000000..e5ff86a
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
@@ -0,0 +1,33 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
+import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.profile.Profile;
+
+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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
new file mode 100644
index 0000000..930bc0c
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
@@ -0,0 +1,31 @@
+package net.sf.taverna.t2.util;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import net.sf.taverna.t2.component.utils.AnnotationUtils;
+
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.ReaderException;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class AnnotationTest {
+ //uk.org.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/e15f9c85/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
new file mode 100644
index 0000000..d15cdb0
--- /dev/null
+++ b/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
@@ -0,0 +1 @@
+net.sf.taverna.t2.component.registry.myexperiment.TestPasswordProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/test/resources/ValidationComponent.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/resources/ValidationComponent.xml b/taverna-component-activity/src/test/resources/ValidationComponent.xml
new file mode 100644
index 0000000..62e094a
--- /dev/null
+++ b/taverna-component-activity/src/test/resources/ValidationComponent.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://ns.taverna.org.uk/2012/component/profile"
+ xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile http://ns.taverna.org.uk/2012/component/profile/ComponentProfile.xsd">
+
+ <id>eu.scape-project.taverna.component.profile.validation</id>
+ <name>Validation Component</name>
+ <description>A SCAPE component for validation</description>
+ <ontology id="scape">http://www.myexperiment.org/files/864/versions/1/download/SCAPEcomponents.owl</ontology>
+ <component>
+ <inputPort maxDepth='1'>
+ <annotation>Example</annotation>
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#hasPortType"
+ class="http://scape-project.eu/pc/vocab/profiles#PortType">
+ http://scape-project.eu/pc/vocab/profiles#ObjectURIPort
+ </semanticAnnotation>
+ </inputPort>
+ <inputPort maxDepth='0' minOccurs="2" maxOccurs="unbounded">
+ <annotation>Example</annotation>
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#hasPortType"
+ class="http://scape-project.eu/pc/vocab/profiles#MeasurePortType" />
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#hasMeasure"
+ class="http://scape-project.eu/pc/vocab/profiles#Measure" />
+ </inputPort>
+ <inputPort maxDepth='0' minOccurs="0" maxOccurs="unbounded">
+ <annotation>Example</annotation>
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#hasPortType"
+ class="http://scape-project.eu/pc/vocab/profiles#PortType">
+ http://scape-project.eu/pc/vocab/profiles#ParameterPort
+ </semanticAnnotation>
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#hasParameter"
+ class="http://scape-project.eu/pc/vocab/profiles#DefaultParameter"
+ maxOccurs="unbounded" />
+ </inputPort>
+ <outputPort maxDepth='0' minOccurs="1" maxOccurs="unbounded">
+ <annotation>Example</annotation>
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#acceptsMeasure"
+ class="http://scape-project.eu/pc/vocab/profiles#Measure" />
+ </outputPort>
+ <activity type="Tool" minOccurs="0" maxOccurs="unbounded">
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#hasDependency"
+ class="http://scape-project.eu/pc/vocab/profiles#Dependency"
+ maxOccurs="unbounded" />
+ </activity>
+ <activity minOccurs="0" maxOccurs="unbounded" />
+ <annotation>Title</annotation>
+ <annotation minOccurs="0">Description</annotation>
+ <annotation minOccurs="0">Author</annotation>
+ <semanticAnnotation ontology="scape"
+ predicate="http://scape-project.eu/pc/vocab/profiles#acceptsMimetype"
+ class="http://scape-project.eu/pc/vocab/profiles#AcceptedMimetype"
+ maxOccurs="unbounded" />
+ </component>
+</profile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/test/resources/beanshell_test.t2flow
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/resources/beanshell_test.t2flow b/taverna-component-activity/src/test/resources/beanshell_test.t2flow
new file mode 100644
index 0000000..decf4f0
--- /dev/null
+++ b/taverna-component-activity/src/test/resources/beanshell_test.t2flow
@@ -0,0 +1,113 @@
+<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow"><dataflow id="70327265-5a03-4c8d-8ed6-bc3e6a65c626" role="top"><name>beanshell_test</name><inputPorts /><outputPorts><port><name>out</name></port></outputPorts><processors><processor><name>test</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>stringconstant-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+ <value>test</value>
+</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>0</initialDelay>
+ <maxDelay>0</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor><processor><name>append_string</name><inputPorts><port><name>in1</name><depth>0</depth></port><port><name>in2</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</cla
ss><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
+ <script>if (in2.equals("4")) throw new Exception("I don't like number 4");
+out = in1 + ":" + in2;
+Thread.sleep(500);</script>
+ <dependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>in1</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>in2</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>0</granularDepth>
+ <name>out</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>0</initialDelay>
+ <maxDelay>0</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>echo</name><inputPorts><port><name>in</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActi
vity</class><inputMap><map from="in" to="in" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
+ <script>Thread.sleep(1000);
+out = in;</script>
+ <dependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>in</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>0</granularDepth>
+ <name>out</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>0</initialDelay>
+ <maxDelay>0</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><port name="in" depth="0" /></strategy></iteration></iterationStrategyStack></processor><processor><name>generate_list</name><inputPorts /><outputPorts><port><name>list</name><depth>1</depth><granularDepth>1</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</class><inputMap /><outputMap><map from="list" to="list" /></outputMap><configBean en
coding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
+ <script>list = new ArrayList();
+
+for (int i = 0; i < 10; i++) {
+ list.add(String.valueOf(i));
+}
+Thread.sleep(1000);</script>
+ <dependencies />
+ <inputs />
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>1</granularDepth>
+ <name>list</name>
+ <depth>1</depth>
+ <mimeTypes>
+ <string>l('text/plain')</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>0</initialDelay>
+ <maxDelay>0</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>append_string</processor><port>in1</port></sink><source type="processor"><processor>test</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>append_string</processor><port>in2</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="processor"><processor>echo</processor><port>in
</port></sink><source type="processor"><processor>append_string</processor><port>out</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><processor>echo</processor><port>out</port></source></datalink></datalinks></dataflow></workflow>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/test/resources/hello_anyone.wfbundle
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/resources/hello_anyone.wfbundle b/taverna-component-activity/src/test/resources/hello_anyone.wfbundle
new file mode 100644
index 0000000..f825f04
Binary files /dev/null and b/taverna-component-activity/src/test/resources/hello_anyone.wfbundle differ
[22/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository -> taverna-component-repository-api
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/catalog/XMLSchema.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/catalog/XMLSchema.xsd b/taverna-component-repository/src/main/catalog/XMLSchema.xsd
deleted file mode 100644
index 575975b..0000000
--- a/taverna-component-repository/src/main/catalog/XMLSchema.xsd
+++ /dev/null
@@ -1,2473 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
-<!-- Note this schema is NOT the normative structures schema. -->
-<!-- The prose copy in the structures REC is the normative -->
-<!-- version (which shouldn't differ from this one except for -->
-<!-- this comment and entity expansions, but just in case -->
-<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
- <xs:annotation>
- <xs:documentation>
- Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
- Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
- The schema corresponding to this document is normative,
- with respect to the syntactic constraints it expresses in the
- XML Schema language. The documentation (within <documentation> elements)
- below, is not normative, but rather highlights important aspects of
- the W3C Recommendation of which this is a part</xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- The simpleType element and all of its members are defined
- towards the end of this schema document</xs:documentation>
- </xs:annotation>
-
- <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
- <xs:annotation>
- <xs:documentation>
- Get access to the xml: attribute groups for xml:lang
- as declared on 'schema' and 'documentation' below
- </xs:documentation>
- </xs:annotation>
- </xs:import>
-
- <xs:complexType name="openAttrs">
- <xs:annotation>
- <xs:documentation>
- This type is extended by almost all schema types
- to allow attributes from other namespaces to be
- added to user schemas.
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:anyType">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="annotated">
- <xs:annotation>
- <xs:documentation>
- This type is extended by all types which allow annotation
- other than <schema> itself
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="schemaTop">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which occur freely at the top level of schemas.
- All of their types are based on the "annotated" type by extension.</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:group ref="xs:redefinable"/>
- <xs:element ref="xs:element"/>
- <xs:element ref="xs:attribute"/>
- <xs:element ref="xs:notation"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="redefinable">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which can self-redefine (see <redefine> below).</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:simpleType"/>
- <xs:element ref="xs:complexType"/>
- <xs:element ref="xs:group"/>
- <xs:element ref="xs:attributeGroup"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="formChoice">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="qualified"/>
- <xs:enumeration value="unqualified"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="reducedDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="derivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:reducedDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:simpleType name="typeDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="fullDerivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:typeDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:element name="schema" id="schema">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:include"/>
- <xs:element ref="xs:import"/>
- <xs:element ref="xs:redefine"/>
- <xs:element ref="xs:annotation"/>
- </xs:choice>
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="xs:schemaTop"/>
- <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:sequence>
- <xs:attribute name="targetNamespace" type="xs:anyURI"/>
- <xs:attribute name="version" type="xs:token"/>
- <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
- <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
- <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="id" type="xs:ID"/>
- <xs:attribute ref="xml:lang"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:key name="element">
- <xs:selector xpath="xs:element"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="attribute">
- <xs:selector xpath="xs:attribute"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="type">
- <xs:selector xpath="xs:complexType|xs:simpleType"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="group">
- <xs:selector xpath="xs:group"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="attributeGroup">
- <xs:selector xpath="xs:attributeGroup"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="notation">
- <xs:selector xpath="xs:notation"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="identityConstraint">
- <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- </xs:element>
-
- <xs:simpleType name="allNNI">
- <xs:annotation><xs:documentation>
- for maxOccurs</xs:documentation></xs:annotation>
- <xs:union memberTypes="xs:nonNegativeInteger">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="unbounded"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:attributeGroup name="occurs">
- <xs:annotation><xs:documentation>
- for all particles</xs:documentation></xs:annotation>
- <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
- <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
- </xs:attributeGroup>
-
- <xs:attributeGroup name="defRef">
- <xs:annotation><xs:documentation>
- for element, group and attributeGroup,
- which both define and reference</xs:documentation></xs:annotation>
- <xs:attribute name="name" type="xs:NCName"/>
- <xs:attribute name="ref" type="xs:QName"/>
- </xs:attributeGroup>
-
- <xs:group name="typeDefParticle">
- <xs:annotation>
- <xs:documentation>
- 'complexType' uses this</xs:documentation></xs:annotation>
- <xs:choice>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:group>
-
-
-
- <xs:group name="nestedParticle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="particle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
-
- <xs:complexType name="attribute">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="use" use="optional" default="optional">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="prohibited"/>
- <xs:enumeration value="optional"/>
- <xs:enumeration value="required"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelAttribute">
- <xs:complexContent>
- <xs:restriction base="xs:attribute">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="use" use="prohibited"/>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="attrDecls">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="attribute" type="xs:attribute"/>
- <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
- </xs:choice>
- <xs:element ref="xs:anyAttribute" minOccurs="0"/>
- </xs:sequence>
- </xs:group>
-
- <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
- </xs:annotation>
- </xs:element>
-
- <xs:group name="complexTypeModel">
- <xs:choice>
- <xs:element ref="xs:simpleContent"/>
- <xs:element ref="xs:complexContent"/>
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- This branch is short for
- <complexContent>
- <restriction base="xs:anyType">
- ...
- </restriction>
- </complexContent></xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- </xs:choice>
- </xs:group>
-
- <xs:complexType name="complexType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:complexTypeModel"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Will be restricted to required or forbidden</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
- <xs:annotation>
- <xs:documentation>
- Not allowed if simpleContent child is chosen.
- May be overriden by setting on complexContent child.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:derivationSet"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="block" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="restrictionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:group ref="xs:typeDefParticle"/>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="complexRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:typeDefParticle"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="extensionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="complexContent" id="complexContent">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:complexRestrictionType"/>
- <xs:element name="extension" type="xs:extensionType"/>
- </xs:choice>
- <xs:attribute name="mixed" type="xs:boolean">
- <xs:annotation>
- <xs:documentation>
- Overrides any setting on complexType parent.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="simpleRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="simpleExtensionType">
- <xs:complexContent>
- <xs:restriction base="xs:extensionType">
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- No typeDefParticle group reference</xs:documentation>
- </xs:annotation>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="simpleContent" id="simpleContent">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:simpleRestrictionType"/>
- <xs:element name="extension" type="xs:simpleExtensionType"/>
- </xs:choice>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
- </xs:annotation>
- </xs:element>
-
-
- <xs:simpleType name="blockSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {substitution, extension,
- restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="substitution"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:complexType name="element" abstract="true">
- <xs:annotation>
- <xs:documentation>
- The element element can be used either
- at the top level to define an element-type binding globally,
- or within a content model to either reference a globally-defined
- element or type or declare an element-type binding locally.
- The ref form is not allowed at the top level.</xs:documentation>
- </xs:annotation>
-
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="substitutionGroup" type="xs:QName"/>
- <xs:attributeGroup ref="xs:occurs"/>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:blockSet"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="substitutionGroup" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="element" type="xs:topLevelElement" id="element">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="group" abstract="true">
- <xs:annotation>
- <xs:documentation>
- group type for explicit groups, named top-level groups and
- group references</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="realGroup">
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="namedGroup">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element name="all">
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:all">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="choice" type="xs:simpleExplicitGroup"/>
- <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="groupRef">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="required" type="xs:QName"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="explicitGroup">
- <xs:annotation>
- <xs:documentation>
- group type for the three kinds of group</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
- <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="simpleExplicitGroup">
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="allModel">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:annotation>
- <xs:documentation>This choice with min/max is here to
- avoid a pblm with the Elt:All/Choice/Seq
- Particle derivation constraint</xs:documentation>
- </xs:annotation>
- <xs:element name="element" type="xs:narrowMaxMin"/>
- </xs:choice>
- </xs:sequence>
- </xs:group>
-
-
- <xs:complexType name="narrowMaxMin">
- <xs:annotation>
- <xs:documentation>restricted max/min</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:localElement">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="all">
- <xs:annotation>
- <xs:documentation>
- Only elements allowed inside</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="all" id="all" type="xs:all">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="choice" type="xs:explicitGroup" id="choice">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="group" type="xs:namedGroup" id="group">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="wildcard">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
- <xs:attribute name="processContents" use="optional" default="strict">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="skip"/>
- <xs:enumeration value="lax"/>
- <xs:enumeration value="strict"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="any" id="any">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:wildcard">
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:annotation>
- <xs:documentation>
- simple type for the value of the 'namespace' attr of
- 'any' and 'anyAttribute'</xs:documentation>
- </xs:annotation>
- <xs:annotation>
- <xs:documentation>
- Value is
- ##any - - any non-conflicting WFXML/attribute at all
-
- ##other - - any non-conflicting WFXML/attribute from
- namespace other than targetNS
-
- ##local - - any unqualified non-conflicting WFXML/attribute
-
- one or - - any non-conflicting WFXML/attribute from
- more URI the listed namespaces
- references
- (space separated)
-
- ##targetNamespace or ##local may appear in the above list, to
- refer to the targetNamespace of the enclosing
- schema or an absent targetNamespace respectively</xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="namespaceList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##any"/>
- <xs:enumeration value="##other"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:union memberTypes="xs:anyURI">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##targetNamespace"/>
- <xs:enumeration value="##local"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="attributeGroup" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:attrDecls"/>
- <xs:attributeGroup ref="xs:defRef"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="namedAttributeGroup">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="attributeGroupRef">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="required" type="xs:QName"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="include" id="include">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="redefine" id="redefine">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:annotation"/>
- <xs:group ref="xs:redefinable"/>
- </xs:choice>
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="import" id="import">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:anyURI"/>
- <xs:attribute name="schemaLocation" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="selector" id="selector">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in selectors</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:annotation>
- <xs:documentation>The following pattern is intended to allow XPath
- expressions per the following EBNF:
- Selector ::= Path ( '|' Path )*
- Path ::= ('.//')? Step ( '/' Step )*
- Step ::= '.' | NameTest
- NameTest ::= QName | '*' | NCName ':' '*'
- child:: is also allowed
- </xs:documentation>
- </xs:annotation>
- <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="field" id="field">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in fields</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:annotation>
- <xs:documentation>The following pattern is intended to allow XPath
- expressions per the same EBNF as for selector,
- with the following change:
- Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
- </xs:documentation>
- </xs:annotation>
- <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="keybase">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element ref="xs:selector"/>
- <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="identityConstraint">
- <xs:annotation>
- <xs:documentation>The three kinds of identity constraints, all with
- type of or derived from 'keybase'.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:unique"/>
- <xs:element ref="xs:key"/>
- <xs:element ref="xs:keyref"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="unique" type="xs:keybase" id="unique">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="key" type="xs:keybase" id="key">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="keyref" id="keyref">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:keybase">
- <xs:attribute name="refer" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="notation" id="notation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="public" type="xs:public"/>
- <xs:attribute name="system" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:simpleType name="public">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- A public identifier, per ISO 8879</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token"/>
- </xs:simpleType>
-
- <xs:element name="appinfo" id="appinfo">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="documentation" id="documentation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:attribute ref="xml:lang"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="annotation" id="annotation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:appinfo"/>
- <xs:element ref="xs:documentation"/>
- </xs:choice>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:annotation>
- <xs:documentation>
- notations for use within XML Schema schemas</xs:documentation>
- </xs:annotation>
-
- <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
- <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
-
- <xs:complexType name="anyType" mixed="true">
- <xs:annotation>
- <xs:documentation>
- Not the real urType, but as close an approximation as we can
- get in the XML representation</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
- </xs:sequence>
- <xs:anyAttribute processContents="lax"/>
- </xs:complexType>
-
- <xs:annotation>
- <xs:documentation>
- First the built-in primitive datatypes. These definitions are for
- information only, the real built-in definitions are magic.
- </xs:documentation>
-
- <xs:documentation>
- For each built-in datatype in this schema (both primitive and
- derived) can be uniquely addressed via a URI constructed
- as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the datatype
-
- For example, to address the int datatype, the URI is:
-
- http://www.w3.org/2001/XMLSchema#int
-
- Additionally, each facet definition element can be uniquely
- addressed via a URI constructed as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the facet
-
- For example, to address the maxInclusive facet, the URI is:
-
- http://www.w3.org/2001/XMLSchema#maxInclusive
-
- Additionally, each facet usage in a built-in datatype definition
- can be uniquely addressed via a URI constructed as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the datatype, followed
- by a period (".") followed by the name of the facet
-
- For example, to address the usage of the maxInclusive facet in
- the definition of int, the URI is:
-
- http://www.w3.org/2001/XMLSchema#int.maxInclusive
-
- </xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="string" id="string">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality" value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#string"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="preserve" id="string.preserve"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="boolean" id="boolean">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="boolean.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="float" id="float">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#float"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="float.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="double" id="double">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#double"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="double.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="decimal" id="decimal">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="totalDigits"/>
- <hfp:hasFacet name="fractionDigits"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="decimal.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="duration" id="duration">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#duration"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="duration.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="dateTime" id="dateTime">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="dateTime.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="time" id="time">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#time"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="time.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="date" id="date">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#date"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="date.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gYearMonth" id="gYearMonth">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gYearMonth.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gYear" id="gYear">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gYear.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gMonthDay" id="gMonthDay">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gMonthDay.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gDay" id="gDay">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gDay.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gMonth" id="gMonth">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gMonth.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="hexBinary" id="hexBinary">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#binary"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="hexBinary.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="base64Binary" id="base64Binary">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="base64Binary.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="anyURI" id="anyURI">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="anyURI.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="QName" id="QName">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#QName"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="QName.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NOTATION" id="NOTATION">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
- <xs:documentation>
- NOTATION cannot be used directly in a schema; rather a type
- must be derived from it by specifying at least one enumeration
- facet whose value is the name of a NOTATION declared in the
- schema.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="NOTATION.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:annotation>
- <xs:documentation>
- Now the derived primitive types
- </xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="normalizedString" id="normalizedString">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:whiteSpace value="replace"
- id="normalizedString.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="token" id="token">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#token"/>
- </xs:annotation>
- <xs:restriction base="xs:normalizedString">
- <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="language" id="language">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#language"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern
- value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
- id="language.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.ietf.org/rfc/rfc3066.txt">
- pattern specifies the content of section 2.12 of XML 1.0e2
- and RFC 3066 (Revised version of RFC 1766).
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="IDREFS" id="IDREFS">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:IDREF"/>
- </xs:simpleType>
- <xs:minLength value="1" id="IDREFS.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ENTITIES" id="ENTITIES">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:ENTITY"/>
- </xs:simpleType>
- <xs:minLength value="1" id="ENTITIES.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NMTOKEN" id="NMTOKEN">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern value="\c+" id="NMTOKEN.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
- pattern matches production 7 from the XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NMTOKENS" id="NMTOKENS">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:NMTOKEN"/>
- </xs:simpleType>
- <xs:minLength value="1" id="NMTOKENS.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="Name" id="Name">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#Name"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern value="\i\c*" id="Name.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml#NT-Name">
- pattern matches production 5 from the XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NCName" id="NCName">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
- </xs:annotation>
- <xs:restriction base="xs:Name">
- <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
- pattern matches production 4 from the Namespaces in XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ID" id="ID">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ID"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="IDREF" id="IDREF">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="ENTITY" id="ENTITY">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="integer" id="integer">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#integer"/>
- </xs:annotation>
- <xs:restriction base="xs:decimal">
- <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
- <xs:pattern value="[\-+]?[0-9]+"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="negativeInteger" id="negativeInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:nonPositiveInteger">
- <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="long" id="long">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#long"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
- <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="int" id="int">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#int"/>
- </xs:annotation>
- <xs:restriction base="xs:long">
- <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
- <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="short" id="short">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#short"/>
- </xs:annotation>
- <xs:restriction base="xs:int">
- <xs:minInclusive value="-32768" id="short.minInclusive"/>
- <xs:maxInclusive value="32767" id="short.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="byte" id="byte">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#byte"/>
- </xs:annotation>
- <xs:restriction base="xs:short">
- <xs:minInclusive value="-128" id="byte.minInclusive"/>
- <xs:maxInclusive value="127" id="byte.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedLong" id="unsignedLong">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
- </xs:annotation>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:maxInclusive value="18446744073709551615"
- id="unsignedLong.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedInt" id="unsignedInt">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedLong">
- <xs:maxInclusive value="4294967295"
- id="unsignedInt.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedShort" id="unsignedShort">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedInt">
- <xs:maxInclusive value="65535"
- id="unsignedShort.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedByte" id="unsignedByte">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedShort">
- <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="positiveInteger" id="positiveInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="derivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="substitution"/>
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:group name="simpleDerivation">
- <xs:choice>
- <xs:element ref="xs:restriction"/>
- <xs:element ref="xs:list"/>
- <xs:element ref="xs:union"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="simpleDerivationSet">
- <xs:annotation>
- <xs:documentation>
- #all or (possibly empty) subset of {restriction, union, list}
- </xs:documentation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:complexType name="simpleType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleDerivation"/>
- <xs:attribute name="final" type="xs:simpleDerivationSet"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Can be restricted to required or forbidden
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="required"
- type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Required at the top level
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited">
- <xs:annotation>
- <xs:documentation>
- Forbidden when nested
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="final" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
- </xs:annotation>
- </xs:element>
-
- <xs:group name="facets">
- <xs:annotation>
- <xs:documentation>
- We should use a substitution group for facets, but
- that's ruled out because it would allow users to
- add their own, which we're not ready for yet.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:minExclusive"/>
- <xs:element ref="xs:minInclusive"/>
- <xs:element ref="xs:maxExclusive"/>
- <xs:element ref="xs:maxInclusive"/>
- <xs:element ref="xs:totalDigits"/>
- <xs:element ref="xs:fractionDigits"/>
- <xs:element ref="xs:length"/>
- <xs:element ref="xs:minLength"/>
- <xs:element ref="xs:maxLength"/>
- <xs:element ref="xs:enumeration"/>
- <xs:element ref="xs:whiteSpace"/>
- <xs:element ref="xs:pattern"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="simpleRestrictionModel">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:group>
-
- <xs:element name="restriction" id="restriction">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
- base attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleRestrictionModel"/>
- <xs:attribute name="base" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="list" id="list">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-list">
- itemType attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType"
- minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="itemType" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="union" id="union">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-union">
- memberTypes attribute must be non-empty or there must be
- at least one simpleType child
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType"
- minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="memberTypes" use="optional">
- <xs:simpleType>
- <xs:list itemType="xs:QName"/>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="facet">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="value" use="required"/>
- <xs:attribute name="fixed" type="xs:boolean" use="optional"
- default="false"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="noFixedFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="fixed" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="numFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="totalDigits" id="totalDigits">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:numFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="length" id="length" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minLength" id="minLength" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="whiteSpace" id="whiteSpace">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="preserve"/>
- <xs:enumeration value="replace"/>
- <xs:enumeration value="collapse"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="pattern" id="pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:noFixedFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:string" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/catalog/catalog.xml b/taverna-component-repository/src/main/catalog/catalog.xml
deleted file mode 100644
index e61eda5..0000000
--- a/taverna-component-repository/src/main/catalog/catalog.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
- <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="XMLSchema.xsd" />
- <public publicId="http://www.w3.org/2001/XMLSchema" uri="XMLSchema.xsd" />
- <system systemId="http://www.w3.org/2001/xml.xsd" uri="xml.xsd" />
- <public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd" />
-</catalog>
\ No newline at end of file
[03/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
new file mode 100644
index 0000000..4e8ac52
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Version;
+import uk.org.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
+ net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
new file mode 100644
index 0000000..7339b10
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import uk.org.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
+ net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
new file mode 100644
index 0000000..2283295
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
@@ -0,0 +1,65 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry;
+
+import static java.lang.System.currentTimeMillis;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Version;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
new file mode 100644
index 0000000..40d1346
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.License;
+import net.sf.taverna.t2.component.api.SharingPolicy;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.profile.Profile;
+
+/**
+ * A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
+ *
+ * @author David Withers
+ */
+public abstract class ComponentRegistry implements
+ net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
new file mode 100644
index 0000000..4380d22
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
@@ -0,0 +1,113 @@
+package net.sf.taverna.t2.component.registry;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.ComponentFactory;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.profile.BaseProfileLocator;
+import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
+import net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
new file mode 100644
index 0000000..8d6c443
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
@@ -0,0 +1,65 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.ComponentException;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+public abstract class ComponentVersion implements
+ net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
new file mode 100644
index 0000000..9115a32
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
@@ -0,0 +1,196 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.Version.ID;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ComponentVersionIdentification implements
+ net.sf.taverna.t2.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,
+ net.sf.taverna.t2.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(net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
new file mode 100644
index 0000000..bfb1007
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
@@ -0,0 +1,134 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry.local;
+
+import static net.sf.taverna.t2.component.registry.local.LocalComponentRegistry.ENC;
+import static org.apache.commons.io.FileUtils.readFileToString;
+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.util.NoSuchElementException;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.registry.Component;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+
+import org.apache.log4j.Logger;
+
+import uk.org.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
new file mode 100644
index 0000000..96a32ab
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
@@ -0,0 +1,141 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry.local;
+
+import static net.sf.taverna.t2.component.registry.local.LocalComponentRegistry.ENC;
+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 java.io.File;
+import java.io.IOException;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.registry.ComponentFamily;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+
+import org.apache.log4j.Logger;
+
+import uk.org.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);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
new file mode 100644
index 0000000..9fcc19a
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
@@ -0,0 +1,205 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry.local;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.License;
+import net.sf.taverna.t2.component.api.SharingPolicy;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
+import net.sf.taverna.t2.component.registry.ComponentRegistry;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+
+import org.apache.log4j.Logger;
+
+/**
+ * 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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
new file mode 100644
index 0000000..c56fe52
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
@@ -0,0 +1,45 @@
+package net.sf.taverna.t2.component.registry.local;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
new file mode 100644
index 0000000..74a7389
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
@@ -0,0 +1,94 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.registry.local;
+
+import static java.lang.Integer.parseInt;
+import static net.sf.taverna.t2.component.registry.local.LocalComponent.COMPONENT_FILENAME;
+import static org.apache.commons.io.FileUtils.readFileToString;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.registry.ComponentVersion;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+
+import org.apache.log4j.Logger;
+
+import uk.org.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
new file mode 100644
index 0000000..61f9997
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
@@ -0,0 +1,637 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+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 net.sf.taverna.t2.component.registry.ClientVersion.VERSION;
+import static org.apache.commons.io.IOUtils.copy;
+import static org.apache.log4j.Logger.getLogger;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
+import net.sf.taverna.t2.component.registry.standard.annotations.Unused;
+import net.sf.taverna.t2.security.credentialmanager.CMException;
+import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+import net.sf.taverna.t2.security.credentialmanager.UsernamePassword;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
new file mode 100644
index 0000000..a3f9536
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
@@ -0,0 +1,220 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static java.lang.String.format;
+import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.logger;
+import static net.sf.taverna.t2.component.registry.standard.Policy.getPolicy;
+import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
+import static net.sf.taverna.t2.component.utils.SystemUtils.getValue;
+
+import java.lang.ref.SoftReference;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.IllegalFormatException;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.License;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.SharingPolicy;
+import net.sf.taverna.t2.component.registry.Component;
+import net.sf.taverna.t2.component.registry.ComponentVersion;
+import net.sf.taverna.t2.component.registry.api.ComponentType;
+import net.sf.taverna.t2.component.registry.api.Description;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+import uk.org.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;
+ }
+}
[53/58] [abbrv] incubator-taverna-plugin-component git commit: fixed
imports to org.apache.taverna.* (where available)
Posted by st...@apache.org.
fixed imports to org.apache.taverna.* (where available)
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/b870cad5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/b870cad5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/b870cad5
Branch: refs/heads/master
Commit: b870cad5c57c74aab83f86f774e9f4ee705ad496
Parents: e2f0dc0
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 23:05:55 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 23:05:55 2015 +0000
----------------------------------------------------------------------
.../main/java/org/apache/taverna/component/api/Component.java | 2 +-
.../src/main/java/org/apache/taverna/component/api/Family.java | 3 +--
.../src/main/java/org/apache/taverna/component/api/Version.java | 2 +-
.../apache/taverna/component/api/profile/ExceptionHandling.java | 4 ++--
.../taverna/component/api/profile/ExceptionReplacement.java | 2 +-
.../apache/taverna/component/api/profile/HandleException.java | 2 +-
.../java/org/apache/taverna/component/api/profile/Profile.java | 2 +-
7 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b870cad5/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 4b88d0a..00ba05c 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
@@ -3,7 +3,7 @@ package org.apache.taverna.component.api;
import java.net.URL;
import java.util.SortedMap;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* The abstract interface supported by a component.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b870cad5/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 d27260f..f4c4a35 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
@@ -3,8 +3,7 @@ package org.apache.taverna.component.api;
import java.util.List;
import org.apache.taverna.component.api.profile.Profile;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+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/b870cad5/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 4c7f16b..f766794 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
@@ -3,7 +3,7 @@ package org.apache.taverna.component.api;
import java.io.Serializable;
import java.net.URL;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
public interface Version {
/** @return The version number of this version */
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b870cad5/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 1b07c53..8abf00b 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
@@ -15,8 +15,8 @@ public class ExceptionHandling {
private final List<HandleException> remapped = new ArrayList<HandleException>();
public ExceptionHandling(
- net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
- for (net.sf.taverna.t2.component.api.profile.doc.HandleException he : proxied
+ org.apache.taverna.component.api.profile.doc.ExceptionHandling proxied) {
+ for (org.apache.taverna.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/b870cad5/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 2f4e6c4..d394795 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
@@ -3,7 +3,7 @@
*/
package org.apache.taverna.component.api.profile;
-import net.sf.taverna.t2.component.api.profile.doc.Replacement;
+import org.apache.taverna.component.api.profile.doc.Replacement;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b870cad5/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 3795ec9..b97ddd5 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
@@ -18,7 +18,7 @@ public class HandleException {
private final boolean pruneStack;
public HandleException(
- net.sf.taverna.t2.component.api.profile.doc.HandleException proxied) {
+ org.apache.taverna.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/b870cad5/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 eb8fc16..6609a15 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
@@ -15,7 +15,7 @@ public interface Profile extends NamedItem, AnnotatedElement {
String getXML() throws ComponentException;
- net.sf.taverna.t2.component.api.profile.doc.Profile getProfileDocument()
+ org.apache.taverna.component.api.profile.doc.Profile getProfileDocument()
throws ComponentException;
String getId();
[44/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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
new file mode 100644
index 0000000..b59ffcc
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.ui.annotation;
+
+import static com.hp.hpl.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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.profile.Profile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import uk.org.taverna.scufl2.api.annotation.Annotation;
+import uk.org.taverna.scufl2.api.common.AbstractNamed;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.ontology.OntResource;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..586c557
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+
+import org.slf4j.Logger;
+
+import uk.org.taverna.scufl2.api.annotation.Annotation;
+import uk.org.taverna.scufl2.api.common.AbstractNamed;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..30a4c9b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
@@ -0,0 +1,90 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.annotation;
+
+import static com.hp.hpl.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 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 net.sf.taverna.t2.lang.ui.DeselectingButton;
+import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..e16c30d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.annotation;
+
+import static java.lang.String.format;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..454986b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.annotation;
+
+import static java.lang.String.format;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..293a8bc
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
@@ -0,0 +1,153 @@
+package org.apache.taverna.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 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 net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+
+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 uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
+
+@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/43334c1d/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
new file mode 100644
index 0000000..f7252cc
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
@@ -0,0 +1,50 @@
+package org.apache.taverna.component.ui.config;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.component.api.ComponentFactory;
+
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
+
+@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/43334c1d/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
new file mode 100644
index 0000000..cbc046d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
@@ -0,0 +1,75 @@
+/**
+ *
+ */
+package org.apache.taverna.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 java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+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 net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..b9076d5
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.file;
+
+import static net.sf.taverna.t2.visit.VisitReport.Status.SEVERE;
+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 java.util.List;
+import java.util.Set;
+
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
+
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+/**
+ * @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;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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
new file mode 100644
index 0000000..4e07171
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.file;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
+import net.sf.taverna.t2.workbench.file.DataflowInfo;
+import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..424961a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
@@ -0,0 +1,170 @@
+/**
+ *
+ */
+package org.apache.taverna.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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
+import net.sf.taverna.t2.workbench.file.DataflowInfo;
+import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
+
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.validation.ValidationReport;
+import uk.org.taverna.scufl2.validation.structural.StructuralValidator;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..0490874
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
@@ -0,0 +1,128 @@
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+import net.sf.taverna.t2.workbench.StartupSPI;
+import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
+import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphController;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+
+import org.apache.batik.swing.JSVGCanvas;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.component.ui.util.Utils;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+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(
+ "org.apache.taverna.component.registry.Component", COLOR);
+ colours.setPreferredColour(
+ "org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..42bd492
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
@@ -0,0 +1,92 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.localworld;
+
+import static com.hp.hpl.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 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 uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.rdf.model.Resource;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..8a90895
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
@@ -0,0 +1,39 @@
+package org.apache.taverna.component.ui.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.component.api.config.ComponentConfig;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.core.Processor;
+
+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/43334c1d/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
new file mode 100644
index 0000000..effba35
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
@@ -0,0 +1,63 @@
+package org.apache.taverna.component.ui.menu;
+
+import static javax.swing.Action.NAME;
+import static org.apache.taverna.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 uk.org.taverna.commons.services.ServiceRegistry;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+
+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/43334c1d/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
new file mode 100644
index 0000000..f9fa643
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu;
+
+import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenu;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..efeadb0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..0aecacf
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
@@ -0,0 +1,628 @@
+/**
+ *
+ */
+package org.apache.taverna.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 org.apache.taverna.component.ui.util.Utils.uniqueName;
+import static uk.org.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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.annotation.Annotation;
+import uk.org.taverna.scufl2.api.common.Named;
+import uk.org.taverna.scufl2.api.common.NamedSet;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.BlockingControlLink;
+import uk.org.taverna.scufl2.api.core.ControlLink;
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputActivityPort;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.ProcessorPort;
+import uk.org.taverna.scufl2.api.port.ReceiverPort;
+import uk.org.taverna.scufl2.api.port.SenderPort;
+import uk.org.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..79f290d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowActivityIcon;
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..2803f04
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+import java.net.MalformedURLException;
+
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+
+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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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;
+ }
+}
[25/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository -> taverna-component-repository-api
Posted by st...@apache.org.
taverna-component-repository -> taverna-component-repository-api
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/c70b61ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/c70b61ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/c70b61ee
Branch: refs/heads/master
Commit: c70b61eeb53c6c43546c0dbafa405f96b2e315e6
Parents: a0acabc
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:25:46 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:25:56 2015 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
taverna-component-repository-api/pom.xml | 56 +
.../src/main/catalog/XMLSchema.xsd | 2473 ++++++++++++++++++
.../src/main/catalog/catalog.xml | 7 +
.../src/main/catalog/xml.xsd | 287 ++
.../sf/taverna/t2/component/api/Component.java | 71 +
.../t2/component/api/ComponentException.java | 50 +
.../t2/component/api/ComponentFactory.java | 27 +
.../net/sf/taverna/t2/component/api/Family.java | 99 +
.../sf/taverna/t2/component/api/License.java | 12 +
.../sf/taverna/t2/component/api/NamedItem.java | 8 +
.../sf/taverna/t2/component/api/Registry.java | 139 +
.../taverna/t2/component/api/SharingPolicy.java | 17 +
.../sf/taverna/t2/component/api/Version.java | 206 ++
.../component/api/config/ComponentConfig.java | 5 +
.../api/config/ComponentPropertyNames.java | 14 +
.../taverna/t2/component/api/package-info.java | 6 +
.../component/api/profile/ActivityProfile.java | 5 +
.../component/api/profile/AnnotatedElement.java | 10 +
.../api/profile/ExceptionHandling.java | 32 +
.../api/profile/ExceptionReplacement.java | 27 +
.../component/api/profile/HandleException.java | 39 +
.../t2/component/api/profile/PortProfile.java | 5 +
.../t2/component/api/profile/Profile.java | 47 +
.../api/profile/SemanticAnnotationProfile.java | 54 +
.../src/main/resources/ComponentProfile.xsd | 261 ++
taverna-component-repository/pom.xml | 56 -
.../src/main/catalog/XMLSchema.xsd | 2473 ------------------
.../src/main/catalog/catalog.xml | 7 -
.../src/main/catalog/xml.xsd | 287 --
.../sf/taverna/t2/component/api/Component.java | 71 -
.../t2/component/api/ComponentException.java | 50 -
.../t2/component/api/ComponentFactory.java | 27 -
.../net/sf/taverna/t2/component/api/Family.java | 99 -
.../sf/taverna/t2/component/api/License.java | 12 -
.../sf/taverna/t2/component/api/NamedItem.java | 8 -
.../sf/taverna/t2/component/api/Registry.java | 139 -
.../taverna/t2/component/api/SharingPolicy.java | 17 -
.../sf/taverna/t2/component/api/Version.java | 206 --
.../component/api/config/ComponentConfig.java | 5 -
.../api/config/ComponentPropertyNames.java | 14 -
.../taverna/t2/component/api/package-info.java | 6 -
.../component/api/profile/ActivityProfile.java | 5 -
.../component/api/profile/AnnotatedElement.java | 10 -
.../api/profile/ExceptionHandling.java | 32 -
.../api/profile/ExceptionReplacement.java | 27 -
.../component/api/profile/HandleException.java | 39 -
.../t2/component/api/profile/PortProfile.java | 5 -
.../t2/component/api/profile/Profile.java | 47 -
.../api/profile/SemanticAnnotationProfile.java | 54 -
.../src/main/resources/ComponentProfile.xsd | 261 --
51 files changed, 3958 insertions(+), 3958 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3c253fa..3877261 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
<modules>
<module>taverna-component-activity</module>
<module>taverna-component-activity-ui</module>
- <module>taverna-component-repository</module>
+ <module>taverna-component-repository-api</module>
</modules>
<repositories>
<repository>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/pom.xml b/taverna-component-repository-api/pom.xml
new file mode 100644
index 0000000..72c9560
--- /dev/null
+++ b/taverna-component-repository-api/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-engine</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ </parent>
+ <artifactId>taverna-component-repository-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Taverna Component Repository API</name>
+ <inceptionYear>2014</inceptionYear>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-api</artifactId>
+ <version>${taverna.language.version}</version>
+ </dependency>
+ <dependency>
+ <!-- FIXME: Use jena-osgi bundle -->
+ <groupId>org.apache.clerezza.ext</groupId>
+ <artifactId>com.hp.hpl.jena</artifactId>
+ <version>0.6-incubating</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <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>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.8.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <catalog>${basedir}/src/main/catalog/catalog.xml</catalog>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
[50/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
org.apache.taverna.component.ui
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/43334c1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/43334c1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/43334c1d
Branch: refs/heads/master
Commit: 43334c1d0298bb6e8b30f9a7558ebfc85afb5ca2
Parents: 40c404c
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 21:23:22 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 21:23:22 2015 +0000
----------------------------------------------------------------------
...bstractSemanticAnnotationContextualView.java | 281 ---------
.../annotation/AnnotateSemanticsMenuAction.java | 101 ---
.../AnnotationPropertyPanelFactory.java | 74 ---
.../DatatypePropertyPanelFactory.java | 77 ---
.../DateTimePropertyPanelFactory.java | 137 ----
.../FallbackPropertyPanelFactory.java | 44 --
.../t2/component/annotation/GreyBorder.java | 17 -
...jectPropertyWithIndividualsPanelFactory.java | 198 ------
.../annotation/PropertyPanelFactorySPI.java | 83 ---
.../SemanticAnnotationContextualView.java | 146 -----
...SemanticAnnotationContextualViewFactory.java | 68 --
.../annotation/SemanticAnnotationPanel.java | 253 --------
.../annotation/SemanticAnnotationUtils.java | 191 ------
.../annotation/TurtleContextualView.java | 78 ---
.../component/annotation/TurtleInputPanel.java | 90 ---
.../annotation/UnrecognizedStatementPanel.java | 27 -
.../annotation/UnresolveablePredicatePanel.java | 27 -
.../t2/component/localworld/LocalWorld.java | 92 ---
.../component/preference/ComponentDefaults.java | 39 --
.../preference/ComponentPreference.java | 128 ----
.../t2/component/ui/ComponentAction.java | 48 --
.../ui/ComponentActivityConfigurationBean.java | 165 -----
.../t2/component/ui/ComponentConstants.java | 9 -
.../ui/config/ComponentConfigurationPanel.java | 153 -----
.../ui/config/ComponentConfigureAction.java | 50 --
.../ComponentDataflowHealthCheckExplainer.java | 75 ---
.../ui/file/ComponentDataflowHealthChecker.java | 89 ---
.../t2/component/ui/file/ComponentOpener.java | 73 ---
.../t2/component/ui/file/ComponentSaver.java | 170 -----
.../component/ui/file/FileManagerObserver.java | 128 ----
.../AbstractContextComponentMenuAction.java | 39 --
.../ui/menu/ComponentConfigureMenuAction.java | 63 --
.../t2/component/ui/menu/ComponentMenu.java | 27 -
.../t2/component/ui/menu/ComponentSection.java | 29 -
.../ui/menu/NestedWorkflowCreationDialog.java | 628 -------------------
.../menu/NestedWorkflowCreatorMenuAction.java | 78 ---
...penComponentFromComponentActivityAction.java | 66 --
...omponentFromComponentActivityMenuAction.java | 88 ---
.../ui/menu/ReplaceByComponentAction.java | 261 --------
.../ui/menu/ReplaceByComponentMenuAction.java | 71 ---
.../component/AbstractComponentMenuAction.java | 13 -
.../ui/menu/component/ComponentCloseAction.java | 58 --
.../component/ComponentCloseMenuAction.java | 50 --
.../ui/menu/component/ComponentCopyAction.java | 149 -----
.../menu/component/ComponentCopyMenuAction.java | 45 --
.../menu/component/ComponentCreatorSupport.java | 241 -------
.../menu/component/ComponentDeleteAction.java | 128 ----
.../component/ComponentDeleteMenuAction.java | 51 --
.../ui/menu/component/ComponentMenuAction.java | 38 --
.../ui/menu/component/ComponentMenuSection.java | 22 -
.../ui/menu/component/ComponentMergeAction.java | 120 ----
.../component/ComponentMergeMenuAction.java | 39 --
.../ui/menu/component/ComponentSaveAction.java | 54 --
.../menu/component/ComponentSaveMenuAction.java | 51 --
.../menu/component/ComponentSearchAction.java | 155 -----
.../component/ComponentSearchMenuAction.java | 70 ---
.../ComponentServiceCreatorAction.java | 97 ---
.../ComponentServiceCreatorMenuAction.java | 60 --
.../ComponentWorkflowCreatorAction.java | 69 --
.../ComponentWorkflowCreatorMenuAction.java | 56 --
.../FileOpenFromComponentMenuAction.java | 58 --
.../OpenWorkflowFromComponentAction.java | 122 ----
.../family/ComponentFamilyCreateAction.java | 161 -----
.../family/ComponentFamilyCreateMenuAction.java | 42 --
.../family/ComponentFamilyDeleteAction.java | 186 ------
.../family/ComponentFamilyDeleteMenuAction.java | 53 --
.../menu/family/ComponentFamilyMenuSection.java | 21 -
.../profile/ComponentProfileCopyAction.java | 162 -----
.../profile/ComponentProfileCopyMenuAction.java | 42 --
.../profile/ComponentProfileDeleteAction.java | 98 ---
.../ComponentProfileDeleteMenuAction.java | 42 --
.../profile/ComponentProfileImportAction.java | 166 -----
.../ComponentProfileImportMenuAction.java | 49 --
.../profile/ComponentProfileMenuSection.java | 25 -
.../registry/ComponentRegistryManageAction.java | 34 -
.../ComponentRegistryManageMenuAction.java | 47 --
.../registry/ComponentRegistryMenuSection.java | 22 -
.../ui/panel/ComponentChoiceMessage.java | 34 -
.../ui/panel/ComponentChooserPanel.java | 218 -------
.../ui/panel/ComponentListCellRenderer.java | 46 --
.../ui/panel/ComponentVersionChooserPanel.java | 171 -----
.../component/ui/panel/FamilyChoiceMessage.java | 24 -
.../component/ui/panel/FamilyChooserPanel.java | 220 -------
.../component/ui/panel/LicenseChooserPanel.java | 189 ------
.../t2/component/ui/panel/PrefixPanel.java | 81 ---
.../ui/panel/ProfileChoiceMessage.java | 24 -
.../component/ui/panel/ProfileChooserPanel.java | 204 ------
...stryAndFamilyChooserComponentEntryPanel.java | 83 ---
.../ui/panel/RegistryAndFamilyChooserPanel.java | 87 ---
.../ui/panel/RegistryChoiceMessage.java | 24 -
.../ui/panel/RegistryChooserPanel.java | 123 ----
.../component/ui/panel/SearchChoicePanel.java | 244 -------
.../ui/panel/SharingPolicyChooserPanel.java | 159 -----
.../ui/preference/ComponentPreferencePanel.java | 283 ---------
.../ComponentPreferenceUIFactory.java | 47 --
.../ui/preference/LocalRegistryPanel.java | 117 ----
.../ui/preference/RegistryTableModel.java | 70 ---
.../ui/preference/RemoteRegistryPanel.java | 78 ---
.../serviceprovider/ComponentServiceDesc.java | 156 -----
.../serviceprovider/ComponentServiceIcon.java | 33 -
.../ComponentServiceProvider.java | 218 -------
.../ComponentServiceProviderConfig.java | 69 --
.../component/ui/serviceprovider/Service.java | 8 -
.../t2/component/ui/util/ComponentFileType.java | 32 -
.../component/ui/util/ComponentHealthCheck.java | 66 --
.../sf/taverna/t2/component/ui/util/Utils.java | 126 ----
.../ComponentActivityContextViewFactory.java | 121 ----
...itySemanticAnnotationContextViewFactory.java | 135 ----
...omponentActivitySemanticAnnotationPanel.java | 93 ---
.../ui/view/ComponentContextViewFactory.java | 42 --
.../ui/view/ComponentContextualView.java | 75 ---
.../taverna/t2/component/ui/view/ViewUtil.java | 163 -----
.../taverna/component/ui/ComponentAction.java | 48 ++
.../ui/ComponentActivityConfigurationBean.java | 165 +++++
.../component/ui/ComponentConstants.java | 9 +
...bstractSemanticAnnotationContextualView.java | 281 +++++++++
.../annotation/AnnotateSemanticsMenuAction.java | 101 +++
.../AnnotationPropertyPanelFactory.java | 74 +++
.../DatatypePropertyPanelFactory.java | 77 +++
.../DateTimePropertyPanelFactory.java | 137 ++++
.../FallbackPropertyPanelFactory.java | 44 ++
.../component/ui/annotation/GreyBorder.java | 17 +
...jectPropertyWithIndividualsPanelFactory.java | 198 ++++++
.../ui/annotation/PropertyPanelFactorySPI.java | 83 +++
.../SemanticAnnotationContextualView.java | 146 +++++
...SemanticAnnotationContextualViewFactory.java | 68 ++
.../ui/annotation/SemanticAnnotationPanel.java | 253 ++++++++
.../ui/annotation/SemanticAnnotationUtils.java | 191 ++++++
.../ui/annotation/TurtleContextualView.java | 78 +++
.../ui/annotation/TurtleInputPanel.java | 90 +++
.../annotation/UnrecognizedStatementPanel.java | 27 +
.../annotation/UnresolveablePredicatePanel.java | 27 +
.../ui/config/ComponentConfigurationPanel.java | 153 +++++
.../ui/config/ComponentConfigureAction.java | 50 ++
.../ComponentDataflowHealthCheckExplainer.java | 75 +++
.../ui/file/ComponentDataflowHealthChecker.java | 89 +++
.../component/ui/file/ComponentOpener.java | 73 +++
.../component/ui/file/ComponentSaver.java | 170 +++++
.../component/ui/file/FileManagerObserver.java | 128 ++++
.../component/ui/localworld/LocalWorld.java | 92 +++
.../AbstractContextComponentMenuAction.java | 39 ++
.../ui/menu/ComponentConfigureMenuAction.java | 63 ++
.../component/ui/menu/ComponentMenu.java | 27 +
.../component/ui/menu/ComponentSection.java | 29 +
.../ui/menu/NestedWorkflowCreationDialog.java | 628 +++++++++++++++++++
.../menu/NestedWorkflowCreatorMenuAction.java | 78 +++
...penComponentFromComponentActivityAction.java | 66 ++
...omponentFromComponentActivityMenuAction.java | 88 +++
.../ui/menu/ReplaceByComponentAction.java | 261 ++++++++
.../ui/menu/ReplaceByComponentMenuAction.java | 71 +++
.../component/AbstractComponentMenuAction.java | 13 +
.../ui/menu/component/ComponentCloseAction.java | 58 ++
.../component/ComponentCloseMenuAction.java | 51 ++
.../ui/menu/component/ComponentCopyAction.java | 149 +++++
.../menu/component/ComponentCopyMenuAction.java | 45 ++
.../menu/component/ComponentCreatorSupport.java | 241 +++++++
.../menu/component/ComponentDeleteAction.java | 128 ++++
.../component/ComponentDeleteMenuAction.java | 52 ++
.../ui/menu/component/ComponentMenuAction.java | 38 ++
.../ui/menu/component/ComponentMenuSection.java | 22 +
.../ui/menu/component/ComponentMergeAction.java | 120 ++++
.../component/ComponentMergeMenuAction.java | 39 ++
.../ui/menu/component/ComponentSaveAction.java | 54 ++
.../menu/component/ComponentSaveMenuAction.java | 52 ++
.../menu/component/ComponentSearchAction.java | 155 +++++
.../component/ComponentSearchMenuAction.java | 70 +++
.../ComponentServiceCreatorAction.java | 97 +++
.../ComponentServiceCreatorMenuAction.java | 61 ++
.../ComponentWorkflowCreatorAction.java | 69 ++
.../ComponentWorkflowCreatorMenuAction.java | 57 ++
.../FileOpenFromComponentMenuAction.java | 59 ++
.../OpenWorkflowFromComponentAction.java | 122 ++++
.../family/ComponentFamilyCreateAction.java | 160 +++++
.../family/ComponentFamilyCreateMenuAction.java | 43 ++
.../family/ComponentFamilyDeleteAction.java | 186 ++++++
.../family/ComponentFamilyDeleteMenuAction.java | 54 ++
.../menu/family/ComponentFamilyMenuSection.java | 22 +
.../profile/ComponentProfileCopyAction.java | 161 +++++
.../profile/ComponentProfileCopyMenuAction.java | 43 ++
.../profile/ComponentProfileDeleteAction.java | 97 +++
.../ComponentProfileDeleteMenuAction.java | 43 ++
.../profile/ComponentProfileImportAction.java | 166 +++++
.../ComponentProfileImportMenuAction.java | 49 ++
.../profile/ComponentProfileMenuSection.java | 25 +
.../registry/ComponentRegistryManageAction.java | 35 ++
.../ComponentRegistryManageMenuAction.java | 48 ++
.../registry/ComponentRegistryMenuSection.java | 22 +
.../ui/panel/ComponentChoiceMessage.java | 34 +
.../ui/panel/ComponentChooserPanel.java | 218 +++++++
.../ui/panel/ComponentListCellRenderer.java | 46 ++
.../ui/panel/ComponentVersionChooserPanel.java | 171 +++++
.../component/ui/panel/FamilyChoiceMessage.java | 24 +
.../component/ui/panel/FamilyChooserPanel.java | 220 +++++++
.../component/ui/panel/LicenseChooserPanel.java | 189 ++++++
.../taverna/component/ui/panel/PrefixPanel.java | 81 +++
.../ui/panel/ProfileChoiceMessage.java | 24 +
.../component/ui/panel/ProfileChooserPanel.java | 204 ++++++
...stryAndFamilyChooserComponentEntryPanel.java | 82 +++
.../ui/panel/RegistryAndFamilyChooserPanel.java | 87 +++
.../ui/panel/RegistryChoiceMessage.java | 24 +
.../ui/panel/RegistryChooserPanel.java | 123 ++++
.../component/ui/panel/SearchChoicePanel.java | 243 +++++++
.../ui/panel/SharingPolicyChooserPanel.java | 159 +++++
.../ui/preference/ComponentDefaults.java | 39 ++
.../ui/preference/ComponentPreference.java | 128 ++++
.../ui/preference/ComponentPreferencePanel.java | 282 +++++++++
.../ComponentPreferenceUIFactory.java | 46 ++
.../ui/preference/LocalRegistryPanel.java | 117 ++++
.../ui/preference/RegistryTableModel.java | 70 +++
.../ui/preference/RemoteRegistryPanel.java | 78 +++
.../serviceprovider/ComponentServiceDesc.java | 156 +++++
.../serviceprovider/ComponentServiceIcon.java | 33 +
.../ComponentServiceProvider.java | 218 +++++++
.../ComponentServiceProviderConfig.java | 69 ++
.../component/ui/serviceprovider/Service.java | 8 +
.../component/ui/util/ComponentFileType.java | 32 +
.../component/ui/util/ComponentHealthCheck.java | 65 ++
.../apache/taverna/component/ui/util/Utils.java | 126 ++++
.../ComponentActivityContextViewFactory.java | 121 ++++
...itySemanticAnnotationContextViewFactory.java | 135 ++++
...omponentActivitySemanticAnnotationPanel.java | 93 +++
.../ui/view/ComponentContextViewFactory.java | 42 ++
.../ui/view/ComponentContextualView.java | 75 +++
.../taverna/component/ui/view/ViewUtil.java | 162 +++++
...component.annotation.PropertyPanelFactorySPI | 10 +-
...t2.workbench.report.explainer.VisitExplainer | 2 +-
.../spring/component-activity-context.xml | 102 +--
227 files changed, 11281 insertions(+), 11277 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
deleted file mode 100644
index 93b07a2..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.annotation;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NORTHWEST;
-import static java.lang.String.CASE_INSENSITIVE_ORDER;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.createSemanticAnnotation;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.getDisplayName;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.common.Named;
-
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.rdf.model.Statement;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
deleted file mode 100644
index 92d2935..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.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 org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.port.ActivityPort;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
deleted file mode 100644
index 5f1ff0e..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import static com.hp.hpl.jena.rdf.model.ResourceFactory.createTypedLiteral;
-import static java.lang.Integer.MIN_VALUE;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.getObjectName;
-
-import javax.swing.JComponent;
-import javax.swing.JTextArea;
-
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
deleted file mode 100644
index a8d6344..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import static com.hp.hpl.jena.rdf.model.ResourceFactory.createTypedLiteral;
-import static java.lang.Integer.MIN_VALUE;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.getObjectName;
-
-import javax.swing.JComponent;
-import javax.swing.JTextArea;
-
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
deleted file mode 100644
index 566f49d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import static com.hp.hpl.jena.datatypes.xsd.XSDDatatype.XSDdateTime;
-import static com.hp.hpl.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import com.hp.hpl.jena.datatypes.xsd.XSDDateTime;
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
deleted file mode 100644
index 5b32370..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.annotation;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/GreyBorder.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/GreyBorder.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/GreyBorder.java
deleted file mode 100644
index c171497..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/GreyBorder.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.sf.taverna.t2.component.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
deleted file mode 100644
index c6c27dd..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.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 net.sf.taverna.t2.component.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import net.sf.taverna.t2.component.localworld.LocalWorld;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.rdf.model.Statement;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
deleted file mode 100644
index e9a9981..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import static java.awt.Color.WHITE;
-import static net.sf.taverna.t2.component.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 com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
deleted file mode 100644
index b347252..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import static java.lang.String.format;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-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 uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
deleted file mode 100644
index 448bd14..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.ActivityPort;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
deleted file mode 100644
index 98266f5..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package net.sf.taverna.t2.component.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 net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.getDisplayName;
-import static net.sf.taverna.t2.component.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.rdf.model.Statement;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
deleted file mode 100644
index 0fd8c27..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.annotation;
-
-import static com.hp.hpl.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 org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.jena.ontology.OntResource;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleContextualView.java
deleted file mode 100644
index f993c48..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleContextualView.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.annotation;
-
-import static java.awt.BorderLayout.CENTER;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.findSemanticAnnotation;
-import static net.sf.taverna.t2.component.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 net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-import org.slf4j.Logger;
-
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleInputPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleInputPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleInputPanel.java
deleted file mode 100644
index 875ea82..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/TurtleInputPanel.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.annotation;
-
-import static com.hp.hpl.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 net.sf.taverna.t2.component.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 net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnrecognizedStatementPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnrecognizedStatementPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnrecognizedStatementPanel.java
deleted file mode 100644
index a226ef0..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnrecognizedStatementPanel.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.annotation;
-
-import static java.lang.String.format;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
deleted file mode 100644
index 8e369e1..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.annotation;
-
-import static java.lang.String.format;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.apache.taverna.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())));
- }
-}
[02/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
new file mode 100644
index 0000000..ce7107f
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
@@ -0,0 +1,132 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
+
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.registry.ComponentFamily;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
+import net.sf.taverna.t2.component.registry.api.Description;
+import uk.org.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
new file mode 100644
index 0000000..02d2b3a
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
@@ -0,0 +1,58 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import net.sf.taverna.t2.component.api.License;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
new file mode 100644
index 0000000..c442057
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
@@ -0,0 +1,103 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.profile.BaseProfileLocator;
+import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
+import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
new file mode 100644
index 0000000..31d3e40
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
@@ -0,0 +1,469 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static net.sf.taverna.t2.component.registry.standard.Policy.PRIVATE;
+import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
+import static org.apache.log4j.Logger.getLogger;
+
+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 net.sf.taverna.t2.component.api.Component;
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.License;
+import net.sf.taverna.t2.component.api.SharingPolicy;
+import net.sf.taverna.t2.component.api.Version;
+import net.sf.taverna.t2.component.api.Version.ID;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.registry.ComponentRegistry;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
+import net.sf.taverna.t2.component.registry.api.ComponentDescriptionList;
+import net.sf.taverna.t2.component.registry.api.ComponentFamilyList;
+import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
+import net.sf.taverna.t2.component.registry.api.ComponentProfileList;
+import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
+import net.sf.taverna.t2.component.registry.api.ComponentType;
+import net.sf.taverna.t2.component.registry.api.Content;
+import net.sf.taverna.t2.component.registry.api.Description;
+import net.sf.taverna.t2.component.registry.api.LicenseList;
+import net.sf.taverna.t2.component.registry.api.LicenseType;
+import net.sf.taverna.t2.component.registry.api.ObjectFactory;
+import net.sf.taverna.t2.component.registry.api.Permissions;
+import net.sf.taverna.t2.component.registry.api.PolicyList;
+import net.sf.taverna.t2.component.utils.AnnotationUtils;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
new file mode 100644
index 0000000..20a92f9
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
@@ -0,0 +1,66 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.jaxbContext;
+import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.logger;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.registry.ComponentRegistry;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.utils.AnnotationUtils;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
new file mode 100644
index 0000000..1f99bc0
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
@@ -0,0 +1,135 @@
+package net.sf.taverna.t2.component.registry.standard;
+
+import static java.lang.System.identityHashCode;
+import static net.sf.taverna.t2.component.registry.api.Privilege.DOWNLOAD;
+import static net.sf.taverna.t2.component.registry.api.Privilege.VIEW;
+import net.sf.taverna.t2.component.api.SharingPolicy;
+import net.sf.taverna.t2.component.registry.api.Permissions;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
new file mode 100644
index 0000000..7c6e061
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
@@ -0,0 +1,25 @@
+package net.sf.taverna.t2.component.registry.standard.annotations;
+
+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 {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
new file mode 100644
index 0000000..fd48b0b
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * Miscellaneous annotations on other parts of the component engine.
+ *
+ * @author Donal Fellows
+ */
+package net.sf.taverna.t2.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
new file mode 100644
index 0000000..1889391
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * This is the new interface to the myExperiment registry, a.k.a. μExperiment.
+ * @author Donal Fellows
+ */
+package net.sf.taverna.t2.component.registry.standard;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
new file mode 100644
index 0000000..51185d5
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
@@ -0,0 +1,91 @@
+package net.sf.taverna.t2.component.utils;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.WeakHashMap;
+
+import uk.org.taverna.scufl2.api.annotation.Annotation;
+import uk.org.taverna.scufl2.api.common.Child;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.common.URITools;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
new file mode 100644
index 0000000..4fec684
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
@@ -0,0 +1,117 @@
+package net.sf.taverna.t2.component.utils;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.registry.api.Description;
+import net.sf.taverna.t2.workflowmodel.Dataflow;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
+import uk.org.taverna.platform.execution.api.WorkflowCompiler;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+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();
+ }
+
+ 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/e15f9c85/taverna-component-activity/src/main/resources/BaseProfile.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/resources/BaseProfile.xml b/taverna-component-activity/src/main/resources/BaseProfile.xml
new file mode 100644
index 0000000..2697854
--- /dev/null
+++ b/taverna-component-activity/src/main/resources/BaseProfile.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+
+<profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://ns.taverna.org.uk/2012/component/profile"
+ xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile http://ns.taverna.org.uk/2012/component/profile/ComponentProfile.xsd">
+
+ <id>http://purl.org/wfever/workflow-base-profile</id>
+ <name>Workflow base annotation profile</name>
+ <description>A base profile for annotating (Taverna) workflows, processes and ports.
+ This profile is meant to be used as a common base for more specific profiles.
+ The common annotations here are mostly optional (minOccurs=0),
+ covering general annotations like title, contact person, example value.</description>
+
+ <!-- <ontology id="dcterms">http://purl.org/dc/terms/</ontology> The above
+ is flaky.. Instead we use the OWL2 DL object/datatype version from http://bloody-byte.net/rdf/dc_owl2dl/ -->
+ <ontology id="dcterms">http://bloody-byte.net/rdf/dc_owl2dl/dcterms_od.owl</ontology>
+ <ontology id="foaf">http://xmlns.com/foaf/spec/index.rdf</ontology>
+ <ontology id="prov">http://www.w3.org/ns/prov.rdf</ontology>
+ <ontology id="pav">http://pav-ontology.googlecode.com/svn/trunk/pav.owl</ontology>
+ <ontology id="ro">http://wf4ever.github.com/ro/ro.owl</ontology>
+ <ontology id="wfdesc">http://wf4ever.github.com/ro/wfdesc.owl</ontology>
+ <ontology id="cito">http://speronitomcat.web.cs.unibo.it:8080/LODE/source?url=http://purl.org/spar/cito</ontology>
+ <ontology id="dcat">http://www.w3.org/ns/dcat.rdf</ontology>
+ <ontology id="roterms">https://raw.github.com/wf4ever/ro/wfannotations/roterms.owl</ontology>
+ <ontology id="skos">http://www.w3.org/TR/skos-reference/skos.rdf</ontology>
+ <component>
+ <inputPort>
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#exampleValue"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://purl.org/wf4ever/roterms#WorkflowValue" />
+
+ <!-- TODO: property chains (?) to say hasArchetype for the typing -->
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#ofSemanticType"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://www.w3.org/2004/02/skos/core#Concept" />
+ <semanticAnnotation
+ predicate="http://purl.org/wf4ever/roterms#ofStructuralType"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/format"
+ ontology="dcterms" minOccurs="0" class="http://purl.org/dc/terms/IMT" />
+ <!-- -->
+
+
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#defaultValue"
+ ontology="roterms" minOccurs="0"
+ class="http://purl.org/wf4ever/roterms#WorkflowValue" />
+ </inputPort>
+
+ <outputPort>
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#exampleValue"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://purl.org/wf4ever/roterms#WorkflowValue" />
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#ofSemanticType"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://www.w3.org/2004/02/skos/core#Concept" />
+ <semanticAnnotation
+ predicate="http://purl.org/wf4ever/roterms#ofStructuralType"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
+
+ <semanticAnnotation predicate="http://purl.org/dc/terms/format"
+ ontology="dcterms" minOccurs="0" class="http://purl.org/dc/terms/IMT" />
+ </outputPort>
+
+ <activity minOccurs="1" maxOccurs="unbounded">
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#performsTask"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://www.w3.org/2004/02/skos/core#Concept" />
+ <semanticAnnotation
+ predicate="http://purl.org/wf4ever/roterms#requiresSoftware"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
+ <semanticAnnotation
+ predicate="http://purl.org/wf4ever/roterms#requiresHardware"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#requireDataset"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://www.w3.org/ns/dcat#Dataset" />
+ </activity>
+
+
+
+
+ <semanticAnnotation predicate="http://purl.org/dc/terms/title"
+ ontology="dcterms" minOccurs="0" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/description"
+ ontology="dcterms" minOccurs="0" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/created"
+ ontology="dcterms" minOccurs="0"
+ class="http://www.w3.org/2001/XMLSchema#dateTime" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/modified"
+ ontology="dcterms" minOccurs="0"
+ class="http://www.w3.org/2001/XMLSchema#dateTime" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/license"
+ ontology="dcterms" minOccurs="0"
+ class="http://purl.org/dc/terms/LicenseDocument" />
+ <semanticAnnotation predicate="http://purl.org/pav/authoredBy"
+ ontology="pav" minOccurs="0" maxOccurs="unbounded"
+ class="http://xmlns.com/foaf/0.1/Person" />
+ <semanticAnnotation predicate="http://purl.org/pav/contributedBy"
+ ontology="pav" minOccurs="0" maxOccurs="unbounded"
+ class="http://xmlns.com/foaf/0.1/Person" />
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#technicalContact"
+ ontology="roterms" minOccurs="0" class="http://xmlns.com/foaf/0.1/Agent" />
+ <semanticAnnotation predicate="http://purl.org/pav/previousVersion"
+ ontology="pav" minOccurs="0" class="http://purl.org/wf4ever/wfdesc#Workflow" />
+ <semanticAnnotation predicate="http://purl.org/spar/cito/isDocumentedBy"
+ ontology="cito" minOccurs="0" maxOccurs="unbounded" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/audience"
+ ontology="dcterms" minOccurs="0" maxOccurs="unbounded"
+ class="http://xmlns.com/foaf/0.1/Project" />
+ <semanticAnnotation predicate="http://purl.org/dc/terms/identifier"
+ ontology="dcterms" minOccurs="1" />
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#requiresSoftware"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
+ <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#requiresHardware"
+ ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
+ <semanticAnnotation predicate="http://xmlns.com/foaf/0.1/depiction"
+ ontology="foaf" minOccurs="0" class="http://xmlns.com/foaf/0.1/Image" />
+
+
+ </component>
+
+
+</profile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/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
new file mode 100644
index 0000000..2851b83
--- /dev/null
+++ b/taverna-component-activity/src/main/resources/EmptyProfile.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+
+<profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://ns.taverna.org.uk/2012/component/profile"
+ xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile ComponentProfile.xsd">
+
+ <id>net.sf.taverna.t2.component.profile.empty</id>
+ <name>Empty profile</name>
+ <description>A basic empty profile that does not allow additional semantic annotation</description>
+ <component>
+ </component>
+</profile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/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
new file mode 100644
index 0000000..a879865
--- /dev/null
+++ b/taverna-component-activity/src/main/resources/META-INF/spring/component-activity-context.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <bean id="ComponentLocalHealthChecker"
+ class="net.sf.taverna.t2.component.ComponentActivityLocalChecker" />
+ <bean id="ComponentUpgradeHealthChecker"
+ class="net.sf.taverna.t2.component.ComponentActivityUpgradeChecker">
+ <property name="componentUtil" ref="componentUtil" />
+ </bean>
+ <bean id="baseProfileLocator" class="net.sf.taverna.t2.component.profile.BaseProfileLocator">
+ <property name="appConfig" ref="app-config" />
+ </bean>
+
+ <bean id="componentActivityFactory" class="net.sf.taverna.t2.component.ComponentActivityFactory">
+ <property name="componentUtil" ref="componentUtil" />
+ <property name="dataflowCache" ref="cache" />
+ <property name="edits" ref="edits" />
+ <property name="annotationUtils" ref="annotationUtil" />
+ </bean>
+
+ <bean id="networkRegistry"
+ class="net.sf.taverna.t2.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="net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory">
+ <property name="componentUtil" ref="componentUtil" />
+ <property name="systemUtils" ref="systemUtil" />
+ </bean>
+ <bean id="componentUtil" class="net.sf.taverna.t2.component.registry.ComponentUtil">
+ <property name="networkLocator" ref="networkRegistry" />
+ <property name="fileLocator" ref="fileRegistry" />
+ <property name="baseLocator" ref="baseProfileLocator" />
+ </bean>
+
+ <bean id="cache" class="net.sf.taverna.t2.component.registry.ComponentImplementationCache">
+ <property name="componentUtil" ref="componentUtil" />
+ </bean>
+ <bean id="systemUtil" class="net.sf.taverna.t2.component.utils.SystemUtils">
+ <property name="appConfig" ref="app-config" />
+ <property name="workflowBundler" ref="workflowBundleIO" />
+ <property name="compilers" ref="compilers" />
+ </bean>
+ <bean id="annotationUtil" class="net.sf.taverna.t2.component.utils.AnnotationUtils" />
+
+ <osgi:service ref="ComponentLocalHealthChecker"
+ interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
+ <osgi:service ref="ComponentUpgradeHealthChecker"
+ interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
+ <osgi:service ref="componentActivityFactory"
+ interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
+ <osgi:service ref="componentUtil"
+ interface="net.sf.taverna.t2.component.api.ComponentFactory" />
+
+ <osgi:reference id="app-config"
+ interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
+ <osgi:reference id="credentialManager"
+ interface="net.sf.taverna.t2.security.credentialmanager.CredentialManager" />
+ <osgi:reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" />
+ <osgi:reference id="workflowBundleIO" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleIO" />
+ <osgi:list id="compilers" interface="uk.org.taverna.platform.execution.api.WorkflowCompiler" />
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/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
new file mode 100644
index 0000000..ba06860
--- /dev/null
+++ b/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
@@ -0,0 +1,454 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ elementFormDefault="unqualified" attributeFormDefault="unqualified"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
+ jxb:version="2.1">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:schemaBindings>
+ <jxb:package name="net.sf.taverna.t2.component.registry.api" />
+ </jxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:attributeGroup name="LocationAttributes">
+ <xs:attribute name="id" type="xs:string" />
+ <xs:attribute name="uri" type="xs:anyURI" />
+ <xs:attribute name="resource" type="xs:anyURI" />
+ <xs:attribute name="version" type="xs:int" />
+ </xs:attributeGroup>
+ <xs:complexType name="StatsInfo">
+ <xs:sequence>
+ <xs:element name="total" type="xs:int" />
+ <xs:element name="breakdown">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="site" type="xs:int" />
+ <xs:element name="other" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Statistics">
+ <xs:sequence>
+ <xs:element name="viewings" type="StatsInfo" />
+ <xs:element name="downloads" type="StatsInfo" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Description" mixed="true">
+ <xs:all>
+ <xs:element name="title" type="xs:string" minOccurs="0" />
+ <xs:element name="description" type="xs:string" minOccurs="0" />
+ <xs:element name="license-type" type="Description"
+ minOccurs="0" />
+ <xs:element name="permissions" type="Permissions"
+ minOccurs="0" />
+ <xs:element name="content-uri" type="xs:string" minOccurs="0" />
+ </xs:all>
+ <xs:attributeGroup ref="LocationAttributes" />
+ </xs:complexType>
+ <xs:complexType name="Privileges">
+ <xs:sequence>
+ <xs:element name="privilege" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="type" type="Privilege" use="required" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="Privilege">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="view" />
+ <xs:enumeration value="download" />
+ <xs:enumeration value="edit" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="Permissions">
+ <xs:choice>
+ <xs:element name="permission" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="category" type="xs:string" />
+ <xs:element name="id" type="xs:int" minOccurs="0" />
+ <xs:element name="privilege" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="type" type="Privilege" use="required" />
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="use-layout" type="xs:boolean" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="group-policy-id" type="xs:string" />
+ </xs:choice>
+ </xs:complexType>
+ <xs:complexType name="Content">
+ <xs:simpleContent>
+ <xs:extension base="xs:base64Binary">
+ <xs:attribute name="encoding" type="xs:string" />
+ <xs:attribute name="type" type="xs:string" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="Comments">
+ <xs:sequence>
+ <xs:element name="comment" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Tags">
+ <xs:sequence>
+ <xs:element name="tag" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Taggings">
+ <xs:sequence>
+ <xs:element name="tagging" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Credits">
+ <xs:sequence>
+ <xs:element name="credit" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Attributions">
+ <xs:sequence>
+ <xs:element name="attribution" type="Description"
+ minOccurs="1" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Versions">
+ <xs:sequence>
+ <xs:element name="workflow" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="ComponentType">
+ <xs:annotation>
+ <xs:documentation>
+ The type of components and workflows.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:property name="idElement" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="title" type="xs:string" minOccurs="0" />
+ <xs:element name="description" type="xs:string" minOccurs="0" />
+ <xs:element name="type" type="Description" minOccurs="0" />
+ <xs:element name="uploader" type="Description" minOccurs="0" />
+ <xs:element name="created-at" type="xs:string" minOccurs="0" />
+ <xs:element name="updated-at" type="xs:string" minOccurs="0" />
+ <xs:element name="license-type" type="Description"
+ minOccurs="0" />
+ <xs:element name="content-uri" type="xs:anyURI" minOccurs="0" />
+ <xs:element name="content-type" type="xs:string"
+ minOccurs="0" />
+ <xs:element name="content" type="Content" minOccurs="0" />
+ <xs:element name="tags" type="Tags" minOccurs="0" />
+ <xs:element name="taggings" type="Taggings" minOccurs="0" />
+ <xs:element name="versions" type="Versions" minOccurs="0" />
+ <xs:element name="comments" type="Comments" minOccurs="0" />
+ <xs:element name="credits" type="Credits" minOccurs="0" />
+ <xs:element name="attributions" type="Attributions"
+ minOccurs="0" />
+ <xs:element name="privileges" type="Privileges" minOccurs="0" />
+ <xs:element name="statistics" type="Statistics" minOccurs="0" />
+ <xs:element name="permissions" type="Permissions"
+ minOccurs="0" />
+ <!-- Unique bits below -->
+ <xs:element name="component-family" type="xs:anyURI"
+ minOccurs="0" />
+ <xs:element name="preview" type="xs:anyURI" minOccurs="0" />
+ <xs:element name="thumbnail" type="xs:anyURI" minOccurs="0" />
+ <xs:element name="thumbnail-big" type="xs:anyURI"
+ minOccurs="0" />
+ <xs:element name="svg" type="xs:anyURI" minOccurs="0" />
+ <xs:element name="reviews" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="review" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ratings" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="rating" type="Description" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="citations" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="citation" type="Description"
+ minOccurs="1" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="components" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="dataflows" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="dataflow" type="DataflowType"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <xs:attributeGroup ref="LocationAttributes" />
+ </xs:complexType>
+
+ <xs:complexType name="ComponentFamilyType">
+ <xs:annotation>
+ <xs:documentation>
+ The type of component families and packs.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:property name="idElement" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="title" type="xs:string" minOccurs="0" />
+ <xs:element name="description" type="xs:string" minOccurs="0" />
+ <xs:element name="owner" type="Description" minOccurs="0" />
+ <xs:element name="created-at" type="xs:string" minOccurs="0" />
+ <xs:element name="updated-at" type="xs:string" minOccurs="0" />
+ <xs:element name="tags" type="Tags" minOccurs="0" />
+ <xs:element name="taggings" type="Taggings" minOccurs="0" />
+ <xs:element name="license-type" type="Description"
+ minOccurs="0" />
+ <xs:element name="download-url" type="xs:anyURI"
+ minOccurs="0" />
+ <xs:element name="privileges" type="Privileges" minOccurs="0" />
+ <xs:element name="comments" type="Comments" minOccurs="0" />
+ <xs:element name="statistics" type="Statistics" minOccurs="0" />
+ <xs:element name="versions" type="Versions" minOccurs="0" />
+ <xs:element name="permissions" type="Permissions"
+ minOccurs="0" />
+ <!-- Unique bits below. -->
+ <xs:element name="component-profile" type="xs:anyURI"
+ minOccurs="0" />
+ <xs:element name="internal-pack-items" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="internal-pack-item" type="Description"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="external-pack-items" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="external-pack-item" type="Description"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="relationships">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded"
+ processContents="lax" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <xs:attributeGroup ref="LocationAttributes" />
+ </xs:complexType>
+
+ <xs:complexType name="ComponentProfileType">
+ <xs:annotation>
+ <xs:documentation>
+ The type of component profiles and files.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:property name="idElement" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="filename" type="xs:string" minOccurs="0" />
+ <xs:element name="title" type="xs:string" minOccurs="0" />
+ <xs:element name="description" type="xs:string" minOccurs="0" />
+ <xs:element name="type" type="Description" minOccurs="0" />
+ <xs:element name="uploader" type="Description" minOccurs="0" />
+ <xs:element name="content-type" type="xs:string"
+ minOccurs="0" />
+ <xs:element name="content" type="Content" minOccurs="0" />
+ <xs:element name="content-uri" type="xs:anyURI" minOccurs="0" />
+ <xs:element name="created-at" type="xs:string" minOccurs="0" />
+ <xs:element name="updated-at" type="xs:string" minOccurs="0" />
+ <xs:element name="license-type" type="Description"
+ minOccurs="0" />
+ <xs:element name="credits" type="Credits" minOccurs="0" />
+ <xs:element name="attributions" type="Attributions"
+ minOccurs="0" />
+ <xs:element name="tags" type="Tags" minOccurs="0" />
+ <xs:element name="taggings" type="Taggings" minOccurs="0" />
+ <xs:element name="privileges" type="Privileges" minOccurs="0" />
+ <xs:element name="comments" type="Comments" minOccurs="0" />
+ <xs:element name="statistics" type="Statistics" minOccurs="0" />
+ <xs:element name="permissions" minOccurs="0" type="Permissions" />
+ </xs:all>
+ <xs:attributeGroup ref="LocationAttributes" />
+ </xs:complexType>
+
+ <xs:complexType name="DataflowType">
+ <xs:all>
+ <xs:element name="sources" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="source" minOccurs="0" maxOccurs="unbounded"
+ type="WorkflowPort" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="sinks" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="sink" minOccurs="0" maxOccurs="unbounded"
+ type="WorkflowPort" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="processors" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="processor" minOccurs="0" maxOccurs="unbounded"
+ type="Processor" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="datalinks" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="datalink" minOccurs="0" maxOccurs="unbounded"
+ type="Link" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- FIXME: Add when myExp actually publishes this info -->
+ <!-- <xs:element name="coordinations" minOccurs="0" /> -->
+ </xs:all>
+ <xs:attribute name="id" type="xs:string" use="required" />
+ <xs:attribute name="role" type="xs:string" />
+ </xs:complexType>
+ <xs:complexType name="WorkflowPort">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="descriptions" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="xs:string"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="examples" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="example" type="xs:string" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ProcessorPort">
+ <xs:sequence>
+ <xs:element name="node" type="xs:string" />
+ <xs:element name="port" type="xs:string" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Processor">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="type" type="xs:string" />
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Link">
+ <xs:all>
+ <xs:element name="sink" type="ProcessorPort" />
+ <xs:element name="source" type="ProcessorPort" />
+ </xs:all>
+ </xs:complexType>
+
+ <xs:complexType name="ComponentDescriptionList">
+ <xs:sequence>
+ <xs:element name="workflow" type="Description"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="ComponentFamilyList">
+ <xs:sequence>
+ <xs:element name="pack" type="Description"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="LicenseType">
+ <xs:all>
+ <xs:element name="id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:property name="idElement" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="unique-name" type="xs:string" minOccurs="0" />
+ <xs:element name="title" type="xs:string" minOccurs="0" />
+ <xs:element name="description" type="xs:string" minOccurs="0" />
+ <xs:element name="url" type="xs:anyURI" minOccurs="0" />
+ <xs:element name="created-at" type="xs:string" minOccurs="0" />
+ <xs:element name="updated-at" type="xs:string" minOccurs="0" />
+ </xs:all>
+ <xs:attributeGroup ref="LocationAttributes" />
+ </xs:complexType>
+ <xs:complexType name="LicenseList">
+ <xs:sequence>
+ <xs:element name="license" type="LicenseType" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="PolicyList">
+ <xs:sequence>
+ <xs:element name="policy" type="Description" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="ComponentProfileList">
+ <xs:sequence>
+ <xs:element name="file" type="Description"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="content-uri" type="xs:string" />
+ <xs:element name="component-profiles" type="ComponentProfileList" />
+ <xs:element name="component-families" type="ComponentFamilyList" />
+ <xs:element name="workflows" type="ComponentDescriptionList" />
+ <xs:element name="workflow" type="ComponentType" />
+ <xs:element name="pack" type="ComponentFamilyType" />
+ <xs:element name="file" type="ComponentProfileType" />
+</xs:schema>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/resources/net/sf/taverna/t2/component/registry/version.properties
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/resources/net/sf/taverna/t2/component/registry/version.properties b/taverna-component-activity/src/main/resources/net/sf/taverna/t2/component/registry/version.properties
new file mode 100644
index 0000000..defbd48
--- /dev/null
+++ b/taverna-component-activity/src/main/resources/net/sf/taverna/t2/component/registry/version.properties
@@ -0,0 +1 @@
+version=${project.version}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/resources/schema.json
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/resources/schema.json b/taverna-component-activity/src/main/resources/schema.json
new file mode 100644
index 0000000..f27da75
--- /dev/null
+++ b/taverna-component-activity/src/main/resources/schema.json
@@ -0,0 +1,36 @@
+{
+ "$schema": "http://json-schema.org/draft-03/schema#",
+ "id": "http://ns.taverna.org.uk/2010/activity/component.schema.json",
+ "title": "Component activity configuration",
+ "type": "object",
+ "properties": {
+ "@context": {
+ "description": "JSON-LD context for interpreting the configuration as RDF",
+ "required": true,
+ "enum": ["http://ns.taverna.org.uk/2010/activity/component.context.json"]
+ },
+ "registryBase": {
+ "type": "string",
+ "required": true,
+ "format": "uri",
+ "description": "The URL of the registry containing the component family."
+ },
+ "familyName": {
+ "type": "string",
+ "required": true,
+ "minLength": 1,
+ "description": "The name of the component family that contains this component."
+ },
+ "componentName": {
+ "type": "string",
+ "required": true,
+ "minLength": 1,
+ "description": "The name of the component, unique within its family."
+ },
+ "componentVersion": {
+ "type": "integer",
+ "required": false,
+ "description": "The version of the component."
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
new file mode 100644
index 0000000..d2c6213
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
@@ -0,0 +1,103 @@
+package net.sf.taverna.t2.component;
+
+
+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/e15f9c85/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
new file mode 100644
index 0000000..c4f1076
--- /dev/null
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.registry;
+
+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 net.sf.taverna.t2.component.api.Family;
+import net.sf.taverna.t2.component.api.profile.Profile;
+import net.sf.taverna.t2.component.api.Version;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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"));
+ }
+
+}
[15/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/catalog/xml.xsd
----------------------------------------------------------------------
diff --git a/src/main/catalog/xml.xsd b/src/main/catalog/xml.xsd
deleted file mode 100644
index aea7d0d..0000000
--- a/src/main/catalog/xml.xsd
+++ /dev/null
@@ -1,287 +0,0 @@
-<?xml version='1.0'?>
-<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
-<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns ="http://www.w3.org/1999/xhtml"
- xml:lang="en">
-
- <xs:annotation>
- <xs:documentation>
- <div>
- <h1>About the XML namespace</h1>
-
- <div class="bodytext">
- <p>
- This schema document describes the XML namespace, in a form
- suitable for import by other schema documents.
- </p>
- <p>
- See <a href="http://www.w3.org/XML/1998/namespace.html">
- http://www.w3.org/XML/1998/namespace.html</a> and
- <a href="http://www.w3.org/TR/REC-xml">
- http://www.w3.org/TR/REC-xml</a> for information
- about this namespace.
- </p>
- <p>
- Note that local names in this namespace are intended to be
- defined only by the World Wide Web Consortium or its subgroups.
- The names currently defined in this namespace are listed below.
- They should not be used with conflicting semantics by any Working
- Group, specification, or document instance.
- </p>
- <p>
- See further below in this document for more information about <a
- href="#usage">how to refer to this schema document from your own
- XSD schema documents</a> and about <a href="#nsversioning">the
- namespace-versioning policy governing this schema document</a>.
- </p>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:attribute name="lang">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>lang (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- is a language code for the natural language of the content of
- any element; its value is inherited. This name is reserved
- by virtue of its definition in the XML specification.</p>
-
- </div>
- <div>
- <h4>Notes</h4>
- <p>
- Attempting to install the relevant ISO 2- and 3-letter
- codes as the enumerated possible values is probably never
- going to be a realistic possibility.
- </p>
- <p>
- See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
- http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
- and the IANA language subtag registry at
- <a href="http://www.iana.org/assignments/language-subtag-registry">
- http://www.iana.org/assignments/language-subtag-registry</a>
- for further information.
- </p>
- <p>
- The union allows for the 'un-declaration' of xml:lang with
- the empty string.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:union memberTypes="xs:language">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value=""/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="space">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>space (as an attribute name)</h3>
- <p>
- denotes an attribute whose
- value is a keyword indicating what whitespace processing
- discipline is intended for the content of the element; its
- value is inherited. This name is reserved by virtue of its
- definition in the XML specification.</p>
-
- </div>
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:NCName">
- <xs:enumeration value="default"/>
- <xs:enumeration value="preserve"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>base (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- provides a URI to be used as the base for interpreting any
- relative URIs in the scope of the element on which it
- appears; its value is inherited. This name is reserved
- by virtue of its definition in the XML Base specification.</p>
-
- <p>
- See <a
- href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
- for information about this attribute.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="id" type="xs:ID">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>id (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- should be interpreted as if declared to be of type ID.
- This name is reserved by virtue of its definition in the
- xml:id specification.</p>
-
- <p>
- See <a
- href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
- for information about this attribute.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attributeGroup name="specialAttrs">
- <xs:attribute ref="xml:base"/>
- <xs:attribute ref="xml:lang"/>
- <xs:attribute ref="xml:space"/>
- <xs:attribute ref="xml:id"/>
- </xs:attributeGroup>
-
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>Father (in any context at all)</h3>
-
- <div class="bodytext">
- <p>
- denotes Jon Bosak, the chair of
- the original XML Working Group. This name is reserved by
- the following decision of the W3C XML Plenary and
- XML Coordination groups:
- </p>
- <blockquote>
- <p>
- In appreciation for his vision, leadership and
- dedication the W3C XML Plenary on this 10th day of
- February, 2000, reserves for Jon Bosak in perpetuity
- the XML name "xml:Father".
- </p>
- </blockquote>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- <div xml:id="usage" id="usage">
- <h2><a name="usage">About this schema document</a></h2>
-
- <div class="bodytext">
- <p>
- This schema defines attributes and an attribute group suitable
- for use by schemas wishing to allow <code>xml:base</code>,
- <code>xml:lang</code>, <code>xml:space</code> or
- <code>xml:id</code> attributes on elements they define.
- </p>
- <p>
- To enable this, such a schema must import this schema for
- the XML namespace, e.g. as follows:
- </p>
- <pre>
- <schema . . .>
- . . .
- <import namespace="http://www.w3.org/XML/1998/namespace"
- schemaLocation="http://www.w3.org/2001/xml.xsd"/>
- </pre>
- <p>
- or
- </p>
- <pre>
- <import namespace="http://www.w3.org/XML/1998/namespace"
- schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
- </pre>
- <p>
- Subsequently, qualified reference to any of the attributes or the
- group defined below will have the desired effect, e.g.
- </p>
- <pre>
- <type . . .>
- . . .
- <attributeGroup ref="xml:specialAttrs"/>
- </pre>
- <p>
- will define a type which will schema-validate an instance element
- with any of those attributes.
- </p>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- <div id="nsversioning" xml:id="nsversioning">
- <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
- <div class="bodytext">
- <p>
- In keeping with the XML Schema WG's standard versioning
- policy, this schema document will persist at
- <a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd</a>.
- </p>
- <p>
- At the date of issue it can also be found at
- <a href="http://www.w3.org/2001/xml.xsd">
- http://www.w3.org/2001/xml.xsd</a>.
- </p>
- <p>
- The schema document at that URI may however change in the future,
- in order to remain compatible with the latest version of XML
- Schema itself, or with the XML namespace itself. In other words,
- if the XML Schema or XML namespaces change, the version of this
- document at <a href="http://www.w3.org/2001/xml.xsd">
- http://www.w3.org/2001/xml.xsd
- </a>
- will change accordingly; the version at
- <a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd
- </a>
- will not change.
- </p>
- <p>
- Previous dated (and unchanging) versions of this schema
- document are at:
- </p>
- <ul>
- <li><a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2007/08/xml.xsd">
- http://www.w3.org/2007/08/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2004/10/xml.xsd">
- http://www.w3.org/2004/10/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2001/03/xml.xsd">
- http://www.w3.org/2001/03/xml.xsd</a></li>
- </ul>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
-</xs:schema>
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/Component.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/Component.java b/src/main/java/net/sf/taverna/t2/component/api/Component.java
deleted file mode 100644
index 47bc7e9..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/Component.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-import java.util.SortedMap;
-
-import uk.org.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java b/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
deleted file mode 100644
index 2b5d829..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.api;
-
-/**
- * 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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java b/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
deleted file mode 100644
index 8c7d533..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/Family.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/Family.java b/src/main/java/net/sf/taverna/t2/component/api/Family.java
deleted file mode 100644
index f618af7..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/Family.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.profile.Profile;
-import uk.org.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/License.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/License.java b/src/main/java/net/sf/taverna/t2/component/api/License.java
deleted file mode 100644
index 7e7594d..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/License.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api;
-
-/**
- * @author alson
- *
- */
-public interface License extends NamedItem {
- public String getAbbreviation();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java b/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
deleted file mode 100644
index a31ad4d..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/Registry.java b/src/main/java/net/sf/taverna/t2/component/api/Registry.java
deleted file mode 100644
index f7b5be4..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/Registry.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java b/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
deleted file mode 100644
index ba91276..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api;
-
-/**
- * @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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/Version.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/Version.java b/src/main/java/net/sf/taverna/t2/component/api/Version.java
deleted file mode 100644
index 3f81739..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/Version.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.io.Serializable;
-import java.net.URL;
-
-import uk.org.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java b/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
deleted file mode 100644
index 172662d..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.config;
-
-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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java b/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
deleted file mode 100644
index baa8bb3..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package net.sf.taverna.t2.component.api.config;
-
-/**
- * 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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/package-info.java b/src/main/java/net/sf/taverna/t2/component/api/package-info.java
deleted file mode 100644
index 4af7984..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * An abstract API for working with components in a registry.
- * @author Donal Fellows
- * @author David Withers
- */
-package net.sf.taverna.t2.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java b/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
deleted file mode 100644
index f656dd0..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-public interface ActivityProfile extends AnnotatedElement {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java b/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
deleted file mode 100644
index dafec43..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-
-public interface AnnotatedElement {
- List<SemanticAnnotationProfile> getSemanticAnnotations()
- throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java b/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
deleted file mode 100644
index 5172f94..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-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(
- net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
- for (net.sf.taverna.t2.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java b/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
deleted file mode 100644
index e71c5ec..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-import net.sf.taverna.t2.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java b/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
deleted file mode 100644
index 1c3332b..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-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(
- net.sf.taverna.t2.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java b/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
deleted file mode 100644
index 5d66de8..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-
-public interface PortProfile extends AnnotatedElement {
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java b/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
deleted file mode 100644
index c0899f8..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.NamedItem;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
-
-import com.hp.hpl.jena.ontology.OntModel;
-
-public interface Profile extends NamedItem, AnnotatedElement {
-
- Registry getComponentRegistry();
-
- String getXML() throws ComponentException;
-
- net.sf.taverna.t2.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/4ce7eea2/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java b/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
deleted file mode 100644
index 3000576..0000000
--- a/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.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/4ce7eea2/src/main/resources/ComponentProfile.xsd
----------------------------------------------------------------------
diff --git a/src/main/resources/ComponentProfile.xsd b/src/main/resources/ComponentProfile.xsd
deleted file mode 100644
index 95b4405..0000000
--- a/src/main/resources/ComponentProfile.xsd
+++ /dev/null
@@ -1,261 +0,0 @@
-<?xml version="1.0"?>
-<xs:schema targetNamespace="http://ns.taverna.org.uk/2012/component/profile"
- elementFormDefault="qualified" xmlns="http://ns.taverna.org.uk/2012/component/profile"
- xmlns:cp="http://ns.taverna.org.uk/2012/component/profile" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
- jxb:version="2.1">
- <xs:annotation>
- <xs:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="net.sf.taverna.t2.component.api.profile.doc" />
- </jxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:import namespace="http://www.w3.org/2001/XMLSchema"
- schemaLocation="http://www.w3.org/2001/XMLSchema.xsd" />
-
- <xs:simpleType name="name">
- <xs:annotation>
- <xs:documentation>A valid name for a port or activity in a Taverna
- workflow.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="([a-zA_Z0-9_])+" />
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="componentElements">
- <xs:annotation>
- <xs:documentation>
- The component elements that can be annotated.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:enumeration value="InputPort"></xs:enumeration>
- <xs:enumeration value="OutputPort"></xs:enumeration>
- <xs:enumeration value="Activity"></xs:enumeration>
- <xs:enumeration value="Component"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="basicAnnotations">
- <xs:annotation>
- <xs:documentation>
- The basic annotations available in a Taverna
- workflow.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:enumeration value="Description"></xs:enumeration>
- <xs:enumeration value="Author"></xs:enumeration>
- <xs:enumeration value="Example"></xs:enumeration>
- <xs:enumeration value="Title"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="componentAnnotations">
- <xs:annotation>
- <xs:documentation>
- Annotations applicable to components.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="basicAnnotations">
- <xs:enumeration value="Description"></xs:enumeration>
- <xs:enumeration value="Author"></xs:enumeration>
- <xs:enumeration value="Title"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="portAnnotations">
- <xs:annotation>
- <xs:documentation>
- Annotations applicable to ports.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="basicAnnotations">
- <xs:enumeration value="Description"></xs:enumeration>
- <xs:enumeration value="Example"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="activityAnnotations">
- <xs:annotation>
- <xs:documentation>
- Annotations applicable to activities.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="basicAnnotations">
- <xs:enumeration value="Description"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="componentAnnotation">
- <xs:simpleContent>
- <xs:extension base="componentAnnotations">
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="portAnnotation">
- <xs:simpleContent>
- <xs:extension base="portAnnotations">
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="activityAnnotation">
- <xs:simpleContent>
- <xs:extension base="activityAnnotations">
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="semanticAnnotation">
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:attribute name="ontology" type="xs:string" use="required" />
- <xs:attribute name="predicate" type="xs:string" use="required" />
- <xs:attribute name="class" type="xs:string" use="optional" />
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="ontology">
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:attribute name="id" type="xs:string" use="required" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="port">
- <xs:sequence>
- <xs:element name="annotation" type="portAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="semanticAnnotation" type="semanticAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="name" type="name" />
- <xs:attribute name="minDepth" type="xs:nonNegativeInteger"
- default="0" />
- <xs:attribute name="maxDepth" type="xs:allNNI" default="unbounded" />
- <xs:attributeGroup ref="xs:occurs" />
- </xs:complexType>
-
- <xs:complexType name="activity">
- <xs:sequence>
- <xs:element name="annotation" type="activityAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="semanticAnnotation" type="semanticAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="type" type="xs:string" />
- <xs:attributeGroup ref="xs:occurs" />
- </xs:complexType>
-
- <xs:complexType name="replacement">
- <xs:complexContent>
- <xs:restriction base="xs:anyType">
- <xs:attribute name="replacementId" type="xs:string" use="required"/>
- <xs:attribute name="replacementMessage" type="xs:string" use="required"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:simpleType name="pattern">
- <xs:restriction base="xs:string">
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="pruneStack">
- <xs:complexContent>
- <xs:restriction base="xs:anyType"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="handleException">
- <xs:sequence>
- <xs:element name="pattern" type="pattern" minOccurs="1" maxOccurs="1"/>
- <xs:element name="pruneStack" type="pruneStack" minOccurs="0" maxOccurs="1"/>
- <xs:element name="replacement" type="replacement" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="failLists">
- <xs:complexContent>
- <xs:restriction base="xs:anyType"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="exceptionHandling">
- <xs:sequence>
- <xs:element name="failLists" type="failLists" minOccurs="0" maxOccurs="1"/>
- <xs:element name="handleException" type="handleException" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="component">
- <xs:sequence>
- <xs:element name="inputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="outputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="activity" type="activity" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="annotation" type="componentAnnotation" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="semanticAnnotation" type="semanticAnnotation" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="exceptionHandling" type="exceptionHandling" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="extends">
- <xs:attribute name="profileId" type="xs:string" use="required"/>
- </xs:complexType>
-
- <xs:element name="profile">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="id" type="xs:string" />
- <xs:element name="name" type="xs:string" />
- <xs:element name="description" type="xs:string" />
- <xs:element name="extends" type="extends" minOccurs = "0" />
- <xs:element name="ontology" type="ontology" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="component" type="component" >
- <xs:unique name="inputPortUnique">
- <xs:selector xpath="cp:inputPort"></xs:selector>
- <xs:field xpath="@name"></xs:field>
- </xs:unique>
- <xs:unique name="outputPortUnique">
- <xs:selector xpath="cp:outputPort" />
- <xs:field xpath="@name" />
- </xs:unique>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:key name="ontologyKey">
- <xs:selector xpath="cp:ontology" />
- <xs:field xpath="@id" />
- </xs:key>
- <xs:keyref name="componentKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- <xs:keyref name="inputKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:inputPorts/cp:inputPort/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- <xs:keyref name="outputKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:outputPorts/cp:outputPort/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- <xs:keyref name="activityKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:activities/cp:activity/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository/pom.xml b/taverna-component-repository/pom.xml
new file mode 100644
index 0000000..771618d
--- /dev/null
+++ b/taverna-component-repository/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>net.sf.taverna</groupId>
+ <artifactId>taverna-parent</artifactId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>net.sf.taverna.component</groupId>
+ <artifactId>component-repository</artifactId>
+ <version>${t2.activities.version}</version>
+ <name>Taverna Component Repository API</name>
+ <packaging>bundle</packaging>
+ <scm>
+ <connection>scm:git:https://github.com/taverna/taverna-component-repository.git</connection>
+ <developerConnection>scm:git:ssh://git@github.com/taverna/taverna-component-repository.git</developerConnection>
+ <url>https://github.com/taverna/taverna-component-repository/</url>
+ <tag>HEAD</tag>
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>uk.org.taverna.scufl2</groupId>
+ <artifactId>scufl2-api</artifactId>
+ <version>${scufl2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza.ext</groupId>
+ <artifactId>com.hp.hpl.jena</artifactId>
+ <version>0.6-incubating</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>mygrid-repository</id>
+ <name>myGrid Repository</name>
+ <url>http://www.mygrid.org.uk/maven/repository</url>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ <id>mygrid-snapshot-repository</id>
+ <name>myGrid Snapshot Repository</name>
+ <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+ </repository>
+ </repositories>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.sf.taverna.t2.component.api,net.sf.taverna.t2.component.api.profile,net.sf.taverna.t2.component.api.profile.doc</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.8.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <catalog>${basedir}/src/main/catalog/catalog.xml</catalog>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <inceptionYear>2014</inceptionYear>
+</project>
\ No newline at end of file
[05/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/catalog/XMLSchema.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/catalog/XMLSchema.xsd b/taverna-component-activity/src/main/catalog/XMLSchema.xsd
new file mode 100644
index 0000000..575975b
--- /dev/null
+++ b/taverna-component-activity/src/main/catalog/XMLSchema.xsd
@@ -0,0 +1,2473 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+<!-- The prose copy in the structures REC is the normative -->
+<!-- version (which shouldn't differ from this one except for -->
+<!-- this comment and entity expansions, but just in case -->
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+ <xs:documentation>
+ Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within <documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ The simpleType element and all of its members are defined
+ towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+ <xs:annotation>
+ <xs:documentation>
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+ </xs:documentation>
+ </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:group ref="xs:redefinable"/>
+ <xs:element ref="xs:element"/>
+ <xs:element ref="xs:attribute"/>
+ <xs:element ref="xs:notation"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="redefinable">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which can self-redefine (see <redefine> below).</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:simpleType"/>
+ <xs:element ref="xs:complexType"/>
+ <xs:element ref="xs:group"/>
+ <xs:element ref="xs:attributeGroup"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="qualified"/>
+ <xs:enumeration value="unqualified"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:reducedDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="typeDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="fullDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:typeDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:include"/>
+ <xs:element ref="xs:import"/>
+ <xs:element ref="xs:redefine"/>
+ <xs:element ref="xs:annotation"/>
+ </xs:choice>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="xs:schemaTop"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="version" type="xs:token"/>
+ <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
+ <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+ <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:key name="element">
+ <xs:selector xpath="xs:element"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attribute">
+ <xs:selector xpath="xs:attribute"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="type">
+ <xs:selector xpath="xs:complexType|xs:simpleType"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="group">
+ <xs:selector xpath="xs:group"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attributeGroup">
+ <xs:selector xpath="xs:attributeGroup"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="notation">
+ <xs:selector xpath="xs:notation"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="identityConstraint">
+ <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+ <xs:annotation><xs:documentation>
+ for maxOccurs</xs:documentation></xs:annotation>
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+ <xs:annotation><xs:documentation>
+ for all particles</xs:documentation></xs:annotation>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+ <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+ <xs:annotation><xs:documentation>
+ for element, group and attributeGroup,
+ which both define and reference</xs:documentation></xs:annotation>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+ <xs:annotation>
+ <xs:documentation>
+ 'complexType' uses this</xs:documentation></xs:annotation>
+ <xs:choice>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:group>
+
+
+
+ <xs:group name="nestedParticle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="particle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="attribute">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="use" use="optional" default="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="prohibited"/>
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelAttribute">
+ <xs:complexContent>
+ <xs:restriction base="xs:attribute">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="use" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="attribute" type="xs:attribute"/>
+ <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ </xs:choice>
+ <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+ <xs:choice>
+ <xs:element ref="xs:simpleContent"/>
+ <xs:element ref="xs:complexContent"/>
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent></xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:complexTypeModel"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Will be restricted to required or forbidden</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:derivationSet"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="block" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="restrictionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:group ref="xs:typeDefParticle"/>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:complexRestrictionType"/>
+ <xs:element name="extension" type="xs:extensionType"/>
+ </xs:choice>
+ <xs:attribute name="mixed" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Overrides any setting on complexType parent.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:extensionType">
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ No typeDefParticle group reference</xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+ <xs:element name="extension" type="xs:simpleExtensionType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+ </xs:annotation>
+ </xs:element>
+
+
+ <xs:simpleType name="blockSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="substitution"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.</xs:documentation>
+ </xs:annotation>
+
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="substitutionGroup" type="xs:QName"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:blockSet"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="substitutionGroup" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ group type for explicit groups, named top-level groups and
+ group references</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="realGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="all">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:all">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+ <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+ <xs:annotation>
+ <xs:documentation>
+ group type for the three kinds of group</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExplicitGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="allModel">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint</xs:documentation>
+ </xs:annotation>
+ <xs:element name="element" type="xs:narrowMaxMin"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+
+ <xs:complexType name="narrowMaxMin">
+ <xs:annotation>
+ <xs:documentation>restricted max/min</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:localElement">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="all">
+ <xs:annotation>
+ <xs:documentation>
+ Only elements allowed inside</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+ <xs:attribute name="processContents" use="optional" default="strict">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="lax"/>
+ <xs:enumeration value="strict"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'</xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively</xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ <xs:enumeration value="##other"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:attrDecls"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedAttributeGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:annotation"/>
+ <xs:group ref="xs:redefinable"/>
+ </xs:choice>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:anyURI"/>
+ <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element ref="xs:selector"/>
+ <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+ <xs:annotation>
+ <xs:documentation>The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:unique"/>
+ <xs:element ref="xs:key"/>
+ <xs:element ref="xs:keyref"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:keybase">
+ <xs:attribute name="refer" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="public" type="xs:public"/>
+ <xs:attribute name="system" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ A public identifier, per ISO 8879</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:appinfo"/>
+ <xs:element ref="xs:documentation"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+
+ <xs:complexType name="anyType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+ </xs:documentation>
+
+ <xs:documentation>
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="string" id="string">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#string"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="preserve" id="string.preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="boolean" id="boolean">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="boolean.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="float" id="float">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#float"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="float.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="double" id="double">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#double"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="double.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="decimal" id="decimal">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="totalDigits"/>
+ <hfp:hasFacet name="fractionDigits"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="decimal.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="duration" id="duration">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="duration.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="dateTime.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="time" id="time">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#time"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="time.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="date" id="date">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#date"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="date.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYearMonth" id="gYearMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYearMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYear" id="gYear">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYear.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonthDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gDay" id="gDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="hexBinary" id="hexBinary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="hexBinary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="base64Binary" id="base64Binary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="base64Binary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="anyURI" id="anyURI">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="anyURI.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="QName" id="QName">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="QName.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NOTATION" id="NOTATION">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+ <xs:documentation>
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="NOTATION.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ Now the derived primitive types
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="normalizedString" id="normalizedString">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:whiteSpace value="replace"
+ id="normalizedString.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="token" id="token">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#token"/>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="language" id="language">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#language"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern
+ value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
+ id="language.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.ietf.org/rfc/rfc3066.txt">
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREFS" id="IDREFS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:IDREF"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="IDREFS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITIES" id="ENTITIES">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:ENTITY"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="ENTITIES.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\c+" id="NMTOKEN.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+ pattern matches production 7 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:NMTOKEN"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="NMTOKENS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Name" id="Name">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\i\c*" id="Name.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Name">
+ pattern matches production 5 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NCName" id="NCName">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:Name">
+ <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+ pattern matches production 4 from the Namespaces in XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ID" id="ID">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREF" id="IDREF">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITY" id="ENTITY">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="integer" id="integer">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+ </xs:annotation>
+ <xs:restriction base="xs:decimal">
+ <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+ <xs:pattern value="[\-+]?[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="negativeInteger" id="negativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonPositiveInteger">
+ <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="long" id="long">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#long"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+ <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="int" id="int">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#int"/>
+ </xs:annotation>
+ <xs:restriction base="xs:long">
+ <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+ <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="short" id="short">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#short"/>
+ </xs:annotation>
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="-32768" id="short.minInclusive"/>
+ <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="byte" id="byte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="-128" id="byte.minInclusive"/>
+ <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedLong" id="unsignedLong">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:maxInclusive value="18446744073709551615"
+ id="unsignedLong.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedInt" id="unsignedInt">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedLong">
+ <xs:maxInclusive value="4294967295"
+ id="unsignedInt.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedShort" id="unsignedShort">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedInt">
+ <xs:maxInclusive value="65535"
+ id="unsignedShort.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedByte" id="unsignedByte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger" id="positiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="substitution"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+ <xs:choice>
+ <xs:element ref="xs:restriction"/>
+ <xs:element ref="xs:list"/>
+ <xs:element ref="xs:union"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {restriction, union, list}
+ </xs:documentation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="simpleType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleDerivation"/>
+ <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Can be restricted to required or forbidden
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required"
+ type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Required at the top level
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited">
+ <xs:annotation>
+ <xs:documentation>
+ Forbidden when nested
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="facets">
+ <xs:annotation>
+ <xs:documentation>
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:minExclusive"/>
+ <xs:element ref="xs:minInclusive"/>
+ <xs:element ref="xs:maxExclusive"/>
+ <xs:element ref="xs:maxInclusive"/>
+ <xs:element ref="xs:totalDigits"/>
+ <xs:element ref="xs:fractionDigits"/>
+ <xs:element ref="xs:length"/>
+ <xs:element ref="xs:minLength"/>
+ <xs:element ref="xs:maxLength"/>
+ <xs:element ref="xs:enumeration"/>
+ <xs:element ref="xs:whiteSpace"/>
+ <xs:element ref="xs:pattern"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="simpleRestrictionModel">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="restriction" id="restriction">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ <xs:attribute name="base" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="list" id="list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-list">
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="union" id="union">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-union">
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="memberTypes" use="optional">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="facet">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="value" use="required"/>
+ <xs:attribute name="fixed" type="xs:boolean" use="optional"
+ default="false"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="noFixedFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="fixed" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="numFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="totalDigits" id="totalDigits">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:numFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="length" id="length" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minLength" id="minLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="whiteSpace" id="whiteSpace">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="preserve"/>
+ <xs:enumeration value="replace"/>
+ <xs:enumeration value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="pattern" id="pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:noFixedFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/catalog/catalog.xml b/taverna-component-activity/src/main/catalog/catalog.xml
new file mode 100644
index 0000000..e61eda5
--- /dev/null
+++ b/taverna-component-activity/src/main/catalog/catalog.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="XMLSchema.xsd" />
+ <public publicId="http://www.w3.org/2001/XMLSchema" uri="XMLSchema.xsd" />
+ <system systemId="http://www.w3.org/2001/xml.xsd" uri="xml.xsd" />
+ <public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd" />
+</catalog>
\ No newline at end of file
[32/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..59e4c33
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
@@ -0,0 +1,26 @@
+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 java.io.File;
+
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..2882698
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..999cc6b
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.standard;
+
+import static org.junit.Assert.assertEquals;
+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 org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..7e43d98
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..ccbb606
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..0186291
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
@@ -0,0 +1,37 @@
+package org.apache.taverna.component.registry.standard;
+
+import static org.apache.taverna.component.registry.Harness.componentRegistry;
+import static org.apache.taverna.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;
+
+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/fb982e2f/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 d15cdb0..a2a1b06 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 @@
-net.sf.taverna.t2.component.registry.myexperiment.TestPasswordProvider
+org.apache.taverna.component.registry.myexperiment.TestPasswordProvider
[19/58] [abbrv] incubator-taverna-plugin-component git commit:
include taverna-component-repository
Posted by st...@apache.org.
include taverna-component-repository
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/f4168613
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/f4168613
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/f4168613
Branch: refs/heads/master
Commit: f41686134e947f55435fe36ef513166cd4c30068
Parents: a1b4ef7
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:23:39 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:23:39 2015 +0000
----------------------------------------------------------------------
pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/f4168613/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c5a1a8f..3c253fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,6 +21,7 @@
<modules>
<module>taverna-component-activity</module>
<module>taverna-component-activity-ui</module>
+ <module>taverna-component-repository</module>
</modules>
<repositories>
<repository>
[58/58] [abbrv] incubator-taverna-plugin-component git commit: The
correct (for now) way of getting the depth of output ports.
Posted by st...@apache.org.
The correct (for now) way of getting the depth of output ports.
Adapted from a3108eb0032d6f63b9eb28bf592355f4a913b55d
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/64985f73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/64985f73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/64985f73
Branch: refs/heads/master
Commit: 64985f73df7628a1118dadcca98a1af921c27e1e
Parents: ff88004
Author: Donal Fellows <dk...@apache.org>
Authored: Mon Feb 23 10:33:03 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Mon Feb 23 10:33:03 2015 +0000
----------------------------------------------------------------------
.../component/activity/ComponentActivityConfigurationBean.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/64985f73/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 b956b12..24cfe2e 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
@@ -95,7 +95,7 @@ public class ComponentActivityConfigurationBean extends
for (InputWorkflowPort iwp : w.getMainWorkflow().getInputPorts())
inputs.add(makeInputDefinition(iwp));
for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
- outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
+ outputs.add(makeOutputDefinition(vs.getPortResolvedDepth(owp), owp.getName()));
try {
eh = util.getFamily(getRegistryBase(), getFamilyName())
[56/58] [abbrv] incubator-taverna-plugin-component git commit:
net.sf.taverna.t2.component -> org.apache.taverna.component
Posted by st...@apache.org.
net.sf.taverna.t2.component -> org.apache.taverna.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/9bedcea5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/9bedcea5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/9bedcea5
Branch: refs/heads/master
Commit: 9bedcea5e2a70554ba056cdd1e39c2313acf0aeb
Parents: 52379d4
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 23:20:22 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 23:20:22 2015 +0000
----------------------------------------------------------------------
.../taverna/component/profile/ActivityProfileImpl.java | 4 ++--
.../taverna/component/profile/ComponentProfileImpl.java | 10 +++++-----
.../apache/taverna/component/profile/PortProfileImpl.java | 4 ++--
.../component/profile/SemanticAnnotationProfileImpl.java | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/9bedcea5/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 fb3029a..b829c8e 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
@@ -26,8 +26,8 @@ import java.util.List;
import org.apache.taverna.component.api.profile.ActivityProfile;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.doc.Activity;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+import org.apache.taverna.component.api.profile.doc.Activity;
+import org.apache.taverna.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/9bedcea5/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 bbca4fd..28ae9be 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
@@ -61,11 +61,11 @@ 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 net.sf.taverna.t2.component.api.profile.doc.Activity;
-import net.sf.taverna.t2.component.api.profile.doc.Ontology;
-import net.sf.taverna.t2.component.api.profile.doc.Port;
-import net.sf.taverna.t2.component.api.profile.doc.Profile;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+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 com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/9bedcea5/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 5ed740e..b72873c 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
@@ -26,8 +26,8 @@ import java.util.List;
import org.apache.taverna.component.api.profile.PortProfile;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.doc.Port;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+import org.apache.taverna.component.api.profile.doc.Port;
+import org.apache.taverna.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/9bedcea5/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 604a209..797a88c 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
@@ -32,7 +32,7 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+import org.apache.taverna.component.api.profile.doc.SemanticAnnotation;
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.OntClass;
[06/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java b/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
deleted file mode 100644
index 08639eb..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Version;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java b/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
deleted file mode 100644
index 4d3e8e3..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Version;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/Harness.java b/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
deleted file mode 100644
index 40a94de..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.Registry;
-
-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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java b/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
deleted file mode 100644
index a6ed62e..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java b/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
deleted file mode 100644
index 3dcefda..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import static org.junit.Assert.assertSame;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java b/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
deleted file mode 100644
index a65a416..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java b/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
deleted file mode 100644
index 8262ebc..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java b/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
deleted file mode 100644
index c015a96..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.component.registry.local;
-
-import static java.lang.System.getProperty;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-
-import java.io.File;
-
-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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java b/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
deleted file mode 100644
index 7874fa4..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java b/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
deleted file mode 100644
index 54aab8a..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.standard;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java b/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
deleted file mode 100644
index 6ea1cc0..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java b/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
deleted file mode 100644
index 4e428c7..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java b/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
deleted file mode 100644
index e5ff86a..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-
-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/e15f9c85/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java b/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
deleted file mode 100644
index 930bc0c..0000000
--- a/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.sf.taverna.t2.util;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.ReaderException;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class AnnotationTest {
- //uk.org.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/e15f9c85/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
----------------------------------------------------------------------
diff --git a/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI b/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
deleted file mode 100644
index d15cdb0..0000000
--- a/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.component.registry.myexperiment.TestPasswordProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/test/resources/ValidationComponent.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/ValidationComponent.xml b/src/test/resources/ValidationComponent.xml
deleted file mode 100644
index 62e094a..0000000
--- a/src/test/resources/ValidationComponent.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-
-<profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ns.taverna.org.uk/2012/component/profile"
- xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile http://ns.taverna.org.uk/2012/component/profile/ComponentProfile.xsd">
-
- <id>eu.scape-project.taverna.component.profile.validation</id>
- <name>Validation Component</name>
- <description>A SCAPE component for validation</description>
- <ontology id="scape">http://www.myexperiment.org/files/864/versions/1/download/SCAPEcomponents.owl</ontology>
- <component>
- <inputPort maxDepth='1'>
- <annotation>Example</annotation>
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#hasPortType"
- class="http://scape-project.eu/pc/vocab/profiles#PortType">
- http://scape-project.eu/pc/vocab/profiles#ObjectURIPort
- </semanticAnnotation>
- </inputPort>
- <inputPort maxDepth='0' minOccurs="2" maxOccurs="unbounded">
- <annotation>Example</annotation>
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#hasPortType"
- class="http://scape-project.eu/pc/vocab/profiles#MeasurePortType" />
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#hasMeasure"
- class="http://scape-project.eu/pc/vocab/profiles#Measure" />
- </inputPort>
- <inputPort maxDepth='0' minOccurs="0" maxOccurs="unbounded">
- <annotation>Example</annotation>
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#hasPortType"
- class="http://scape-project.eu/pc/vocab/profiles#PortType">
- http://scape-project.eu/pc/vocab/profiles#ParameterPort
- </semanticAnnotation>
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#hasParameter"
- class="http://scape-project.eu/pc/vocab/profiles#DefaultParameter"
- maxOccurs="unbounded" />
- </inputPort>
- <outputPort maxDepth='0' minOccurs="1" maxOccurs="unbounded">
- <annotation>Example</annotation>
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#acceptsMeasure"
- class="http://scape-project.eu/pc/vocab/profiles#Measure" />
- </outputPort>
- <activity type="Tool" minOccurs="0" maxOccurs="unbounded">
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#hasDependency"
- class="http://scape-project.eu/pc/vocab/profiles#Dependency"
- maxOccurs="unbounded" />
- </activity>
- <activity minOccurs="0" maxOccurs="unbounded" />
- <annotation>Title</annotation>
- <annotation minOccurs="0">Description</annotation>
- <annotation minOccurs="0">Author</annotation>
- <semanticAnnotation ontology="scape"
- predicate="http://scape-project.eu/pc/vocab/profiles#acceptsMimetype"
- class="http://scape-project.eu/pc/vocab/profiles#AcceptedMimetype"
- maxOccurs="unbounded" />
- </component>
-</profile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/test/resources/beanshell_test.t2flow
----------------------------------------------------------------------
diff --git a/src/test/resources/beanshell_test.t2flow b/src/test/resources/beanshell_test.t2flow
deleted file mode 100644
index decf4f0..0000000
--- a/src/test/resources/beanshell_test.t2flow
+++ /dev/null
@@ -1,113 +0,0 @@
-<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow"><dataflow id="70327265-5a03-4c8d-8ed6-bc3e6a65c626" role="top"><name>beanshell_test</name><inputPorts /><outputPorts><port><name>out</name></port></outputPorts><processors><processor><name>test</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>stringconstant-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
- <value>test</value>
-</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
- <maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
- <backoffFactor>1.0</backoffFactor>
- <initialDelay>0</initialDelay>
- <maxDelay>0</maxDelay>
- <maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor><processor><name>append_string</name><inputPorts><port><name>in1</name><depth>0</depth></port><port><name>in2</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</cla
ss><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
- <script>if (in2.equals("4")) throw new Exception("I don't like number 4");
-out = in1 + ":" + in2;
-Thread.sleep(500);</script>
- <dependencies />
- <inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <handledReferenceSchemes />
- <translatedElementType>java.lang.String</translatedElementType>
- <allowsLiteralValues>true</allowsLiteralValues>
- <name>in1</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <handledReferenceSchemes />
- <translatedElementType>java.lang.String</translatedElementType>
- <allowsLiteralValues>true</allowsLiteralValues>
- <name>in2</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- </inputs>
- <outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- <granularDepth>0</granularDepth>
- <name>out</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- </outputs>
-</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
- <maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
- <backoffFactor>1.0</backoffFactor>
- <initialDelay>0</initialDelay>
- <maxDelay>0</maxDelay>
- <maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>echo</name><inputPorts><port><name>in</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActi
vity</class><inputMap><map from="in" to="in" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
- <script>Thread.sleep(1000);
-out = in;</script>
- <dependencies />
- <inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <handledReferenceSchemes />
- <translatedElementType>java.lang.String</translatedElementType>
- <allowsLiteralValues>true</allowsLiteralValues>
- <name>in</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- </inputs>
- <outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- <granularDepth>0</granularDepth>
- <name>out</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- </outputs>
-</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
- <maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
- <backoffFactor>1.0</backoffFactor>
- <initialDelay>0</initialDelay>
- <maxDelay>0</maxDelay>
- <maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><port name="in" depth="0" /></strategy></iteration></iterationStrategyStack></processor><processor><name>generate_list</name><inputPorts /><outputPorts><port><name>list</name><depth>1</depth><granularDepth>1</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</class><inputMap /><outputMap><map from="list" to="list" /></outputMap><configBean en
coding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
- <script>list = new ArrayList();
-
-for (int i = 0; i < 10; i++) {
- list.add(String.valueOf(i));
-}
-Thread.sleep(1000);</script>
- <dependencies />
- <inputs />
- <outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- <granularDepth>1</granularDepth>
- <name>list</name>
- <depth>1</depth>
- <mimeTypes>
- <string>l('text/plain')</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- </outputs>
-</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
- <maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
- <backoffFactor>1.0</backoffFactor>
- <initialDelay>0</initialDelay>
- <maxDelay>0</maxDelay>
- <maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>append_string</processor><port>in1</port></sink><source type="processor"><processor>test</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>append_string</processor><port>in2</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="processor"><processor>echo</processor><port>in
</port></sink><source type="processor"><processor>append_string</processor><port>out</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><processor>echo</processor><port>out</port></source></datalink></datalinks></dataflow></workflow>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/test/resources/hello_anyone.wfbundle
----------------------------------------------------------------------
diff --git a/src/test/resources/hello_anyone.wfbundle b/src/test/resources/hello_anyone.wfbundle
deleted file mode 100644
index f825f04..0000000
Binary files a/src/test/resources/hello_anyone.wfbundle and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/pom.xml b/taverna-component-activity/pom.xml
new file mode 100644
index 0000000..01d00ca
--- /dev/null
+++ b/taverna-component-activity/pom.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>net.sf.taverna</groupId>
+ <artifactId>taverna-parent</artifactId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>net.sf.taverna.t2.activities</groupId>
+ <artifactId>component-activity</artifactId>
+ <version>${t2.activities.version}</version>
+ <name>Taverna Component activity</name>
+ <packaging>bundle</packaging>
+ <properties>
+ <jena.core.version>2.11.1</jena.core.version>
+ </properties>
+
+ <scm>
+ <connection>scm:git:https://github.com/taverna/taverna-component-activity.git</connection>
+ <developerConnection>scm:git:ssh://git@github.com/taverna/taverna-component-activity.git</developerConnection>
+ <url>https://github.com/taverna/taverna-component-activity/</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.taverna.component</groupId>
+ <artifactId>component-repository</artifactId>
+ <version>${t2.activities.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.core</groupId>
+ <artifactId>reference-api</artifactId>
+ <version>${t2.core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.core</groupId>
+ <artifactId>workflowmodel-api</artifactId>
+ <version>${t2.core.version}</version>
+ </dependency>
+ <dependency>
+ <!-- FIXME: Avoid -->
+ <groupId>net.sf.taverna.t2.core</groupId>
+ <artifactId>workflowmodel-impl</artifactId>
+ <version>${t2.core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>uk.org.taverna.platform</groupId>
+ <artifactId>taverna-execution-api</artifactId>
+ <version>${platform.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.activities</groupId>
+ <artifactId>dataflow-activity</artifactId>
+ <version>${t2.activities.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>uk.org.taverna.configuration</groupId>
+ <artifactId>taverna-app-configuration-api</artifactId>
+ <version>${taverna.configuration.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>uk.org.taverna.scufl2</groupId>
+ <artifactId>scufl2-api</artifactId>
+ <version>${scufl2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>uk.org.taverna.scufl2</groupId>
+ <artifactId>scufl2-t2flow</artifactId>
+ <version>${scufl2.version}</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>uk.org.taverna.scufl2</groupId>
+ <artifactId>scufl2-annotation</artifactId>
+ <version>${scufl2.version}</version>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.jdom</groupId>
+ <artifactId>com.springsource.org.jdom</artifactId>
+ <version>${jdom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons.io.version}</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>com.springsource.org.apache.httpcomponents.httpclient</artifactId>
+ <version>${apache.httpclient.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>com.springsource.org.apache.httpcomponents.httpclient-cache</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>com.springsource.org.apache.httpcomponents.httpmime</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
+ <version>${commons.httpclient.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.log4j</groupId>
+ <artifactId>com.springsource.org.apache.log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.clerezza.ext</groupId>
+ <artifactId>com.hp.hpl.jena</artifactId>
+ <version>0.6-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.security</groupId>
+ <artifactId>credential-manager</artifactId>
+ <version>${t2.security.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.activities</groupId>
+ <artifactId>activity-test-utils</artifactId>
+ <version>${t2.activities.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>mygrid-repository</id>
+ <name>myGrid Repository</name>
+ <url>http://www.mygrid.org.uk/maven/repository</url>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ <id>mygrid-snapshot-repository</id>
+ <name>myGrid Snapshot Repository</name>
+ <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.8.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <catalog>${basedir}/src/main/catalog/catalog.xml</catalog>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
[09/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/catalog/xml.xsd
----------------------------------------------------------------------
diff --git a/src/main/catalog/xml.xsd b/src/main/catalog/xml.xsd
deleted file mode 100644
index aea7d0d..0000000
--- a/src/main/catalog/xml.xsd
+++ /dev/null
@@ -1,287 +0,0 @@
-<?xml version='1.0'?>
-<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
-<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns ="http://www.w3.org/1999/xhtml"
- xml:lang="en">
-
- <xs:annotation>
- <xs:documentation>
- <div>
- <h1>About the XML namespace</h1>
-
- <div class="bodytext">
- <p>
- This schema document describes the XML namespace, in a form
- suitable for import by other schema documents.
- </p>
- <p>
- See <a href="http://www.w3.org/XML/1998/namespace.html">
- http://www.w3.org/XML/1998/namespace.html</a> and
- <a href="http://www.w3.org/TR/REC-xml">
- http://www.w3.org/TR/REC-xml</a> for information
- about this namespace.
- </p>
- <p>
- Note that local names in this namespace are intended to be
- defined only by the World Wide Web Consortium or its subgroups.
- The names currently defined in this namespace are listed below.
- They should not be used with conflicting semantics by any Working
- Group, specification, or document instance.
- </p>
- <p>
- See further below in this document for more information about <a
- href="#usage">how to refer to this schema document from your own
- XSD schema documents</a> and about <a href="#nsversioning">the
- namespace-versioning policy governing this schema document</a>.
- </p>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:attribute name="lang">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>lang (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- is a language code for the natural language of the content of
- any element; its value is inherited. This name is reserved
- by virtue of its definition in the XML specification.</p>
-
- </div>
- <div>
- <h4>Notes</h4>
- <p>
- Attempting to install the relevant ISO 2- and 3-letter
- codes as the enumerated possible values is probably never
- going to be a realistic possibility.
- </p>
- <p>
- See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
- http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
- and the IANA language subtag registry at
- <a href="http://www.iana.org/assignments/language-subtag-registry">
- http://www.iana.org/assignments/language-subtag-registry</a>
- for further information.
- </p>
- <p>
- The union allows for the 'un-declaration' of xml:lang with
- the empty string.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:union memberTypes="xs:language">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value=""/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="space">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>space (as an attribute name)</h3>
- <p>
- denotes an attribute whose
- value is a keyword indicating what whitespace processing
- discipline is intended for the content of the element; its
- value is inherited. This name is reserved by virtue of its
- definition in the XML specification.</p>
-
- </div>
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:NCName">
- <xs:enumeration value="default"/>
- <xs:enumeration value="preserve"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>base (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- provides a URI to be used as the base for interpreting any
- relative URIs in the scope of the element on which it
- appears; its value is inherited. This name is reserved
- by virtue of its definition in the XML Base specification.</p>
-
- <p>
- See <a
- href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
- for information about this attribute.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="id" type="xs:ID">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>id (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- should be interpreted as if declared to be of type ID.
- This name is reserved by virtue of its definition in the
- xml:id specification.</p>
-
- <p>
- See <a
- href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
- for information about this attribute.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attributeGroup name="specialAttrs">
- <xs:attribute ref="xml:base"/>
- <xs:attribute ref="xml:lang"/>
- <xs:attribute ref="xml:space"/>
- <xs:attribute ref="xml:id"/>
- </xs:attributeGroup>
-
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>Father (in any context at all)</h3>
-
- <div class="bodytext">
- <p>
- denotes Jon Bosak, the chair of
- the original XML Working Group. This name is reserved by
- the following decision of the W3C XML Plenary and
- XML Coordination groups:
- </p>
- <blockquote>
- <p>
- In appreciation for his vision, leadership and
- dedication the W3C XML Plenary on this 10th day of
- February, 2000, reserves for Jon Bosak in perpetuity
- the XML name "xml:Father".
- </p>
- </blockquote>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- <div xml:id="usage" id="usage">
- <h2><a name="usage">About this schema document</a></h2>
-
- <div class="bodytext">
- <p>
- This schema defines attributes and an attribute group suitable
- for use by schemas wishing to allow <code>xml:base</code>,
- <code>xml:lang</code>, <code>xml:space</code> or
- <code>xml:id</code> attributes on elements they define.
- </p>
- <p>
- To enable this, such a schema must import this schema for
- the XML namespace, e.g. as follows:
- </p>
- <pre>
- <schema . . .>
- . . .
- <import namespace="http://www.w3.org/XML/1998/namespace"
- schemaLocation="http://www.w3.org/2001/xml.xsd"/>
- </pre>
- <p>
- or
- </p>
- <pre>
- <import namespace="http://www.w3.org/XML/1998/namespace"
- schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
- </pre>
- <p>
- Subsequently, qualified reference to any of the attributes or the
- group defined below will have the desired effect, e.g.
- </p>
- <pre>
- <type . . .>
- . . .
- <attributeGroup ref="xml:specialAttrs"/>
- </pre>
- <p>
- will define a type which will schema-validate an instance element
- with any of those attributes.
- </p>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- <div id="nsversioning" xml:id="nsversioning">
- <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
- <div class="bodytext">
- <p>
- In keeping with the XML Schema WG's standard versioning
- policy, this schema document will persist at
- <a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd</a>.
- </p>
- <p>
- At the date of issue it can also be found at
- <a href="http://www.w3.org/2001/xml.xsd">
- http://www.w3.org/2001/xml.xsd</a>.
- </p>
- <p>
- The schema document at that URI may however change in the future,
- in order to remain compatible with the latest version of XML
- Schema itself, or with the XML namespace itself. In other words,
- if the XML Schema or XML namespaces change, the version of this
- document at <a href="http://www.w3.org/2001/xml.xsd">
- http://www.w3.org/2001/xml.xsd
- </a>
- will change accordingly; the version at
- <a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd
- </a>
- will not change.
- </p>
- <p>
- Previous dated (and unchanging) versions of this schema
- document are at:
- </p>
- <ul>
- <li><a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2007/08/xml.xsd">
- http://www.w3.org/2007/08/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2004/10/xml.xsd">
- http://www.w3.org/2004/10/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2001/03/xml.xsd">
- http://www.w3.org/2001/03/xml.xsd</a></li>
- </ul>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
-</xs:schema>
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java b/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
deleted file mode 100644
index 7a68813..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.getAnnotationString;
-import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.setAnnotationString;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
-import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.impl.InvocationContextImpl;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-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 = getAnnotationString(realizingDataflow,
- SemanticAnnotation.class, null);
- if (annotationValue != null)
- 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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java b/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
deleted file mode 100644
index 7d04aac..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static org.apache.log4j.Logger.getLogger;
-
-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.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
-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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * 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 (net.sf.taverna.t2.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));
- for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
- outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
-
- try {
- eh = util.getFamily(getRegistryBase(), getFamilyName())
- .getComponentProfile().getExceptionHandling();
- if (eh != null)
- outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (net.sf.taverna.t2.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 net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java b/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
deleted file mode 100644
index 670a0af..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version.ID;
-import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-
-import org.springframework.beans.factory.annotation.Required;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java b/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
deleted file mode 100644
index 846c36f..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.component.ComponentHealthCheck.NON_SHAREABLE;
-import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
-
-import java.util.List;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java b/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
deleted file mode 100644
index 70fc303..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.component.ComponentHealthCheck.OUT_OF_DATE;
-import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-
-import org.apache.log4j.Logger;
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java b/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
deleted file mode 100644
index f37e567..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-/**
- * @author alanrw
- *
- */
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java b/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
deleted file mode 100644
index 7d4c906..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java b/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
deleted file mode 100644
index 11a8fde..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-/**
- * @author alanrw
- *
- */
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java b/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
deleted file mode 100644
index 75f5b21..0000000
--- a/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
-import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
-import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
-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 net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-import net.sf.taverna.t2.component.api.profile.ExceptionReplacement;
-import net.sf.taverna.t2.component.api.profile.HandleException;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
-
-import org.apache.log4j.Logger;
-
-/**
- * @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/e15f9c85/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java b/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
deleted file mode 100644
index 92b4e51..0000000
--- a/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.profile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.profile.ActivityProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.doc.Activity;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java b/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
deleted file mode 100644
index d39ee57..0000000
--- a/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.profile;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-
-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 uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * @author alanrw
- *
- */
-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(), "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/e15f9c85/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java b/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
deleted file mode 100644
index 2a37972..0000000
--- a/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.profile;
-
-import static com.hp.hpl.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 net.sf.taverna.t2.workflowmodel.health.HealthCheck.NO_PROBLEM;
-import static net.sf.taverna.t2.workflowmodel.health.RemoteHealthChecker.contactEndpoint;
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.profile.ActivityProfile;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-import net.sf.taverna.t2.component.api.profile.PortProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.component.api.profile.doc.Activity;
-import net.sf.taverna.t2.component.api.profile.doc.Ontology;
-import net.sf.taverna.t2.component.api.profile.doc.Port;
-import net.sf.taverna.t2.component.api.profile.doc.Profile;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
-
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.ontology.OntProperty;
-
-/**
- * A ComponentProfile specifies the inputs, outputs and semantic annotations
- * that a Component must contain.
- *
- * @author David Withers
- */
-public class ComponentProfileImpl implements
- net.sf.taverna.t2.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 net.sf.taverna.t2.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 net.sf.taverna.t2.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 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<net.sf.taverna.t2.component.api.profile.ActivityProfile> getActivityProfiles() {
- List<net.sf.taverna.t2.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
- net.sf.taverna.t2.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<net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java b/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
deleted file mode 100644
index 31eb5f6..0000000
--- a/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.profile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.profile.PortProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.doc.Port;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java b/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
deleted file mode 100644
index 9961aa0..0000000
--- a/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.profile;
-
-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 net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java b/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
deleted file mode 100644
index b06ae67..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/Component.java b/src/main/java/net/sf/taverna/t2/component/registry/Component.java
deleted file mode 100644
index 4e8ac52..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/Component.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import uk.org.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
- net.sf.taverna.t2.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);
- }
-}
[10/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/catalog/XMLSchema.xsd
----------------------------------------------------------------------
diff --git a/src/main/catalog/XMLSchema.xsd b/src/main/catalog/XMLSchema.xsd
deleted file mode 100644
index 575975b..0000000
--- a/src/main/catalog/XMLSchema.xsd
+++ /dev/null
@@ -1,2473 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
-<!-- Note this schema is NOT the normative structures schema. -->
-<!-- The prose copy in the structures REC is the normative -->
-<!-- version (which shouldn't differ from this one except for -->
-<!-- this comment and entity expansions, but just in case -->
-<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
- <xs:annotation>
- <xs:documentation>
- Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
- Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
- The schema corresponding to this document is normative,
- with respect to the syntactic constraints it expresses in the
- XML Schema language. The documentation (within <documentation> elements)
- below, is not normative, but rather highlights important aspects of
- the W3C Recommendation of which this is a part</xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- The simpleType element and all of its members are defined
- towards the end of this schema document</xs:documentation>
- </xs:annotation>
-
- <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
- <xs:annotation>
- <xs:documentation>
- Get access to the xml: attribute groups for xml:lang
- as declared on 'schema' and 'documentation' below
- </xs:documentation>
- </xs:annotation>
- </xs:import>
-
- <xs:complexType name="openAttrs">
- <xs:annotation>
- <xs:documentation>
- This type is extended by almost all schema types
- to allow attributes from other namespaces to be
- added to user schemas.
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:anyType">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="annotated">
- <xs:annotation>
- <xs:documentation>
- This type is extended by all types which allow annotation
- other than <schema> itself
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="schemaTop">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which occur freely at the top level of schemas.
- All of their types are based on the "annotated" type by extension.</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:group ref="xs:redefinable"/>
- <xs:element ref="xs:element"/>
- <xs:element ref="xs:attribute"/>
- <xs:element ref="xs:notation"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="redefinable">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which can self-redefine (see <redefine> below).</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:simpleType"/>
- <xs:element ref="xs:complexType"/>
- <xs:element ref="xs:group"/>
- <xs:element ref="xs:attributeGroup"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="formChoice">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="qualified"/>
- <xs:enumeration value="unqualified"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="reducedDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="derivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:reducedDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:simpleType name="typeDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="fullDerivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:typeDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:element name="schema" id="schema">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:include"/>
- <xs:element ref="xs:import"/>
- <xs:element ref="xs:redefine"/>
- <xs:element ref="xs:annotation"/>
- </xs:choice>
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="xs:schemaTop"/>
- <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:sequence>
- <xs:attribute name="targetNamespace" type="xs:anyURI"/>
- <xs:attribute name="version" type="xs:token"/>
- <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
- <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
- <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="id" type="xs:ID"/>
- <xs:attribute ref="xml:lang"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:key name="element">
- <xs:selector xpath="xs:element"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="attribute">
- <xs:selector xpath="xs:attribute"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="type">
- <xs:selector xpath="xs:complexType|xs:simpleType"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="group">
- <xs:selector xpath="xs:group"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="attributeGroup">
- <xs:selector xpath="xs:attributeGroup"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="notation">
- <xs:selector xpath="xs:notation"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="identityConstraint">
- <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- </xs:element>
-
- <xs:simpleType name="allNNI">
- <xs:annotation><xs:documentation>
- for maxOccurs</xs:documentation></xs:annotation>
- <xs:union memberTypes="xs:nonNegativeInteger">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="unbounded"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:attributeGroup name="occurs">
- <xs:annotation><xs:documentation>
- for all particles</xs:documentation></xs:annotation>
- <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
- <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
- </xs:attributeGroup>
-
- <xs:attributeGroup name="defRef">
- <xs:annotation><xs:documentation>
- for element, group and attributeGroup,
- which both define and reference</xs:documentation></xs:annotation>
- <xs:attribute name="name" type="xs:NCName"/>
- <xs:attribute name="ref" type="xs:QName"/>
- </xs:attributeGroup>
-
- <xs:group name="typeDefParticle">
- <xs:annotation>
- <xs:documentation>
- 'complexType' uses this</xs:documentation></xs:annotation>
- <xs:choice>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:group>
-
-
-
- <xs:group name="nestedParticle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="particle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
-
- <xs:complexType name="attribute">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="use" use="optional" default="optional">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="prohibited"/>
- <xs:enumeration value="optional"/>
- <xs:enumeration value="required"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelAttribute">
- <xs:complexContent>
- <xs:restriction base="xs:attribute">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="use" use="prohibited"/>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="attrDecls">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="attribute" type="xs:attribute"/>
- <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
- </xs:choice>
- <xs:element ref="xs:anyAttribute" minOccurs="0"/>
- </xs:sequence>
- </xs:group>
-
- <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
- </xs:annotation>
- </xs:element>
-
- <xs:group name="complexTypeModel">
- <xs:choice>
- <xs:element ref="xs:simpleContent"/>
- <xs:element ref="xs:complexContent"/>
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- This branch is short for
- <complexContent>
- <restriction base="xs:anyType">
- ...
- </restriction>
- </complexContent></xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- </xs:choice>
- </xs:group>
-
- <xs:complexType name="complexType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:complexTypeModel"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Will be restricted to required or forbidden</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
- <xs:annotation>
- <xs:documentation>
- Not allowed if simpleContent child is chosen.
- May be overriden by setting on complexContent child.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:derivationSet"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="block" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="restrictionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:group ref="xs:typeDefParticle"/>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="complexRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:typeDefParticle"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="extensionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="complexContent" id="complexContent">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:complexRestrictionType"/>
- <xs:element name="extension" type="xs:extensionType"/>
- </xs:choice>
- <xs:attribute name="mixed" type="xs:boolean">
- <xs:annotation>
- <xs:documentation>
- Overrides any setting on complexType parent.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="simpleRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="simpleExtensionType">
- <xs:complexContent>
- <xs:restriction base="xs:extensionType">
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- No typeDefParticle group reference</xs:documentation>
- </xs:annotation>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="simpleContent" id="simpleContent">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:simpleRestrictionType"/>
- <xs:element name="extension" type="xs:simpleExtensionType"/>
- </xs:choice>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
- </xs:annotation>
- </xs:element>
-
-
- <xs:simpleType name="blockSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {substitution, extension,
- restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="substitution"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:complexType name="element" abstract="true">
- <xs:annotation>
- <xs:documentation>
- The element element can be used either
- at the top level to define an element-type binding globally,
- or within a content model to either reference a globally-defined
- element or type or declare an element-type binding locally.
- The ref form is not allowed at the top level.</xs:documentation>
- </xs:annotation>
-
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="substitutionGroup" type="xs:QName"/>
- <xs:attributeGroup ref="xs:occurs"/>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:blockSet"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="substitutionGroup" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="element" type="xs:topLevelElement" id="element">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="group" abstract="true">
- <xs:annotation>
- <xs:documentation>
- group type for explicit groups, named top-level groups and
- group references</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="realGroup">
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="namedGroup">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element name="all">
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:all">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="choice" type="xs:simpleExplicitGroup"/>
- <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="groupRef">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="required" type="xs:QName"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="explicitGroup">
- <xs:annotation>
- <xs:documentation>
- group type for the three kinds of group</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
- <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="simpleExplicitGroup">
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="allModel">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:annotation>
- <xs:documentation>This choice with min/max is here to
- avoid a pblm with the Elt:All/Choice/Seq
- Particle derivation constraint</xs:documentation>
- </xs:annotation>
- <xs:element name="element" type="xs:narrowMaxMin"/>
- </xs:choice>
- </xs:sequence>
- </xs:group>
-
-
- <xs:complexType name="narrowMaxMin">
- <xs:annotation>
- <xs:documentation>restricted max/min</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:localElement">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="all">
- <xs:annotation>
- <xs:documentation>
- Only elements allowed inside</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="all" id="all" type="xs:all">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="choice" type="xs:explicitGroup" id="choice">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="group" type="xs:namedGroup" id="group">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="wildcard">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
- <xs:attribute name="processContents" use="optional" default="strict">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="skip"/>
- <xs:enumeration value="lax"/>
- <xs:enumeration value="strict"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="any" id="any">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:wildcard">
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:annotation>
- <xs:documentation>
- simple type for the value of the 'namespace' attr of
- 'any' and 'anyAttribute'</xs:documentation>
- </xs:annotation>
- <xs:annotation>
- <xs:documentation>
- Value is
- ##any - - any non-conflicting WFXML/attribute at all
-
- ##other - - any non-conflicting WFXML/attribute from
- namespace other than targetNS
-
- ##local - - any unqualified non-conflicting WFXML/attribute
-
- one or - - any non-conflicting WFXML/attribute from
- more URI the listed namespaces
- references
- (space separated)
-
- ##targetNamespace or ##local may appear in the above list, to
- refer to the targetNamespace of the enclosing
- schema or an absent targetNamespace respectively</xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="namespaceList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##any"/>
- <xs:enumeration value="##other"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:union memberTypes="xs:anyURI">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##targetNamespace"/>
- <xs:enumeration value="##local"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="attributeGroup" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:attrDecls"/>
- <xs:attributeGroup ref="xs:defRef"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="namedAttributeGroup">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="attributeGroupRef">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="required" type="xs:QName"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="include" id="include">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="redefine" id="redefine">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:annotation"/>
- <xs:group ref="xs:redefinable"/>
- </xs:choice>
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="import" id="import">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:anyURI"/>
- <xs:attribute name="schemaLocation" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="selector" id="selector">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in selectors</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:annotation>
- <xs:documentation>The following pattern is intended to allow XPath
- expressions per the following EBNF:
- Selector ::= Path ( '|' Path )*
- Path ::= ('.//')? Step ( '/' Step )*
- Step ::= '.' | NameTest
- NameTest ::= QName | '*' | NCName ':' '*'
- child:: is also allowed
- </xs:documentation>
- </xs:annotation>
- <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="field" id="field">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in fields</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:annotation>
- <xs:documentation>The following pattern is intended to allow XPath
- expressions per the same EBNF as for selector,
- with the following change:
- Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
- </xs:documentation>
- </xs:annotation>
- <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="keybase">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element ref="xs:selector"/>
- <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="identityConstraint">
- <xs:annotation>
- <xs:documentation>The three kinds of identity constraints, all with
- type of or derived from 'keybase'.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:unique"/>
- <xs:element ref="xs:key"/>
- <xs:element ref="xs:keyref"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="unique" type="xs:keybase" id="unique">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="key" type="xs:keybase" id="key">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="keyref" id="keyref">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:keybase">
- <xs:attribute name="refer" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="notation" id="notation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="public" type="xs:public"/>
- <xs:attribute name="system" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:simpleType name="public">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- A public identifier, per ISO 8879</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token"/>
- </xs:simpleType>
-
- <xs:element name="appinfo" id="appinfo">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="documentation" id="documentation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:attribute ref="xml:lang"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="annotation" id="annotation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:appinfo"/>
- <xs:element ref="xs:documentation"/>
- </xs:choice>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:annotation>
- <xs:documentation>
- notations for use within XML Schema schemas</xs:documentation>
- </xs:annotation>
-
- <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
- <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
-
- <xs:complexType name="anyType" mixed="true">
- <xs:annotation>
- <xs:documentation>
- Not the real urType, but as close an approximation as we can
- get in the XML representation</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
- </xs:sequence>
- <xs:anyAttribute processContents="lax"/>
- </xs:complexType>
-
- <xs:annotation>
- <xs:documentation>
- First the built-in primitive datatypes. These definitions are for
- information only, the real built-in definitions are magic.
- </xs:documentation>
-
- <xs:documentation>
- For each built-in datatype in this schema (both primitive and
- derived) can be uniquely addressed via a URI constructed
- as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the datatype
-
- For example, to address the int datatype, the URI is:
-
- http://www.w3.org/2001/XMLSchema#int
-
- Additionally, each facet definition element can be uniquely
- addressed via a URI constructed as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the facet
-
- For example, to address the maxInclusive facet, the URI is:
-
- http://www.w3.org/2001/XMLSchema#maxInclusive
-
- Additionally, each facet usage in a built-in datatype definition
- can be uniquely addressed via a URI constructed as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the datatype, followed
- by a period (".") followed by the name of the facet
-
- For example, to address the usage of the maxInclusive facet in
- the definition of int, the URI is:
-
- http://www.w3.org/2001/XMLSchema#int.maxInclusive
-
- </xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="string" id="string">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality" value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#string"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="preserve" id="string.preserve"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="boolean" id="boolean">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="boolean.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="float" id="float">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#float"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="float.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="double" id="double">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#double"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="double.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="decimal" id="decimal">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="totalDigits"/>
- <hfp:hasFacet name="fractionDigits"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="decimal.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="duration" id="duration">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#duration"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="duration.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="dateTime" id="dateTime">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="dateTime.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="time" id="time">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#time"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="time.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="date" id="date">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#date"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="date.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gYearMonth" id="gYearMonth">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gYearMonth.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gYear" id="gYear">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gYear.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gMonthDay" id="gMonthDay">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gMonthDay.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gDay" id="gDay">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gDay.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gMonth" id="gMonth">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gMonth.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="hexBinary" id="hexBinary">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#binary"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="hexBinary.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="base64Binary" id="base64Binary">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="base64Binary.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="anyURI" id="anyURI">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="anyURI.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="QName" id="QName">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#QName"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="QName.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NOTATION" id="NOTATION">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
- <xs:documentation>
- NOTATION cannot be used directly in a schema; rather a type
- must be derived from it by specifying at least one enumeration
- facet whose value is the name of a NOTATION declared in the
- schema.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="NOTATION.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:annotation>
- <xs:documentation>
- Now the derived primitive types
- </xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="normalizedString" id="normalizedString">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:whiteSpace value="replace"
- id="normalizedString.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="token" id="token">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#token"/>
- </xs:annotation>
- <xs:restriction base="xs:normalizedString">
- <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="language" id="language">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#language"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern
- value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
- id="language.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.ietf.org/rfc/rfc3066.txt">
- pattern specifies the content of section 2.12 of XML 1.0e2
- and RFC 3066 (Revised version of RFC 1766).
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="IDREFS" id="IDREFS">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:IDREF"/>
- </xs:simpleType>
- <xs:minLength value="1" id="IDREFS.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ENTITIES" id="ENTITIES">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:ENTITY"/>
- </xs:simpleType>
- <xs:minLength value="1" id="ENTITIES.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NMTOKEN" id="NMTOKEN">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern value="\c+" id="NMTOKEN.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
- pattern matches production 7 from the XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NMTOKENS" id="NMTOKENS">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:NMTOKEN"/>
- </xs:simpleType>
- <xs:minLength value="1" id="NMTOKENS.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="Name" id="Name">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#Name"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern value="\i\c*" id="Name.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml#NT-Name">
- pattern matches production 5 from the XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NCName" id="NCName">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
- </xs:annotation>
- <xs:restriction base="xs:Name">
- <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
- pattern matches production 4 from the Namespaces in XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ID" id="ID">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ID"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="IDREF" id="IDREF">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="ENTITY" id="ENTITY">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="integer" id="integer">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#integer"/>
- </xs:annotation>
- <xs:restriction base="xs:decimal">
- <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
- <xs:pattern value="[\-+]?[0-9]+"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="negativeInteger" id="negativeInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:nonPositiveInteger">
- <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="long" id="long">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#long"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
- <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="int" id="int">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#int"/>
- </xs:annotation>
- <xs:restriction base="xs:long">
- <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
- <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="short" id="short">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#short"/>
- </xs:annotation>
- <xs:restriction base="xs:int">
- <xs:minInclusive value="-32768" id="short.minInclusive"/>
- <xs:maxInclusive value="32767" id="short.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="byte" id="byte">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#byte"/>
- </xs:annotation>
- <xs:restriction base="xs:short">
- <xs:minInclusive value="-128" id="byte.minInclusive"/>
- <xs:maxInclusive value="127" id="byte.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedLong" id="unsignedLong">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
- </xs:annotation>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:maxInclusive value="18446744073709551615"
- id="unsignedLong.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedInt" id="unsignedInt">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedLong">
- <xs:maxInclusive value="4294967295"
- id="unsignedInt.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedShort" id="unsignedShort">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedInt">
- <xs:maxInclusive value="65535"
- id="unsignedShort.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedByte" id="unsignedByte">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedShort">
- <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="positiveInteger" id="positiveInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="derivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="substitution"/>
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:group name="simpleDerivation">
- <xs:choice>
- <xs:element ref="xs:restriction"/>
- <xs:element ref="xs:list"/>
- <xs:element ref="xs:union"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="simpleDerivationSet">
- <xs:annotation>
- <xs:documentation>
- #all or (possibly empty) subset of {restriction, union, list}
- </xs:documentation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:complexType name="simpleType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleDerivation"/>
- <xs:attribute name="final" type="xs:simpleDerivationSet"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Can be restricted to required or forbidden
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="required"
- type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Required at the top level
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited">
- <xs:annotation>
- <xs:documentation>
- Forbidden when nested
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="final" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
- </xs:annotation>
- </xs:element>
-
- <xs:group name="facets">
- <xs:annotation>
- <xs:documentation>
- We should use a substitution group for facets, but
- that's ruled out because it would allow users to
- add their own, which we're not ready for yet.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:minExclusive"/>
- <xs:element ref="xs:minInclusive"/>
- <xs:element ref="xs:maxExclusive"/>
- <xs:element ref="xs:maxInclusive"/>
- <xs:element ref="xs:totalDigits"/>
- <xs:element ref="xs:fractionDigits"/>
- <xs:element ref="xs:length"/>
- <xs:element ref="xs:minLength"/>
- <xs:element ref="xs:maxLength"/>
- <xs:element ref="xs:enumeration"/>
- <xs:element ref="xs:whiteSpace"/>
- <xs:element ref="xs:pattern"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="simpleRestrictionModel">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:group>
-
- <xs:element name="restriction" id="restriction">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
- base attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleRestrictionModel"/>
- <xs:attribute name="base" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="list" id="list">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-list">
- itemType attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType"
- minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="itemType" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="union" id="union">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-union">
- memberTypes attribute must be non-empty or there must be
- at least one simpleType child
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType"
- minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="memberTypes" use="optional">
- <xs:simpleType>
- <xs:list itemType="xs:QName"/>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="facet">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="value" use="required"/>
- <xs:attribute name="fixed" type="xs:boolean" use="optional"
- default="false"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="noFixedFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="fixed" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="numFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="totalDigits" id="totalDigits">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:numFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="length" id="length" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minLength" id="minLength" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="whiteSpace" id="whiteSpace">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="preserve"/>
- <xs:enumeration value="replace"/>
- <xs:enumeration value="collapse"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="pattern" id="pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:noFixedFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:string" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/src/main/catalog/catalog.xml b/src/main/catalog/catalog.xml
deleted file mode 100644
index e61eda5..0000000
--- a/src/main/catalog/catalog.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
- <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="XMLSchema.xsd" />
- <public publicId="http://www.w3.org/2001/XMLSchema" uri="XMLSchema.xsd" />
- <system systemId="http://www.w3.org/2001/xml.xsd" uri="xml.xsd" />
- <public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd" />
-</catalog>
\ No newline at end of file
[31/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.api.*
Posted by st...@apache.org.
org.apache.taverna.component.api.*
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/2421ba84
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/2421ba84
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/2421ba84
Branch: refs/heads/master
Commit: 2421ba84df2af2084cd2e496f7d34caca38866a4
Parents: 8b8dbce
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 19:24:01 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 19:24:01 2015 +0000
----------------------------------------------------------------------
...bstractSemanticAnnotationContextualView.java | 2 +-
.../annotation/AnnotateSemanticsMenuAction.java | 5 +-
.../AnnotationPropertyPanelFactory.java | 2 +-
.../DatatypePropertyPanelFactory.java | 2 +-
.../DateTimePropertyPanelFactory.java | 2 +-
.../FallbackPropertyPanelFactory.java | 2 +-
...jectPropertyWithIndividualsPanelFactory.java | 3 +-
.../annotation/PropertyPanelFactorySPI.java | 2 +-
.../SemanticAnnotationContextualView.java | 14 +-
...SemanticAnnotationContextualViewFactory.java | 5 +-
.../annotation/SemanticAnnotationPanel.java | 3 +-
.../annotation/SemanticAnnotationUtils.java | 7 +-
.../annotation/UnresolveablePredicatePanel.java | 2 +-
.../preference/ComponentPreference.java | 7 +-
.../ui/ComponentActivityConfigurationBean.java | 23 +--
.../ui/config/ComponentConfigurationPanel.java | 16 +-
.../ui/config/ComponentConfigureAction.java | 3 +-
.../ComponentDataflowHealthCheckExplainer.java | 3 +-
.../ui/file/ComponentDataflowHealthChecker.java | 10 +-
.../t2/component/ui/file/ComponentOpener.java | 8 +-
.../t2/component/ui/file/ComponentSaver.java | 14 +-
.../component/ui/file/FileManagerObserver.java | 2 +-
.../AbstractContextComponentMenuAction.java | 3 +-
.../ui/menu/ComponentConfigureMenuAction.java | 3 +-
...penComponentFromComponentActivityAction.java | 4 +-
...omponentFromComponentActivityMenuAction.java | 3 +-
.../ui/menu/ReplaceByComponentAction.java | 13 +-
.../ui/menu/ReplaceByComponentMenuAction.java | 3 +-
.../ui/menu/component/ComponentCopyAction.java | 10 +-
.../menu/component/ComponentCreatorSupport.java | 8 +-
.../menu/component/ComponentDeleteAction.java | 6 +-
.../ui/menu/component/ComponentMergeAction.java | 6 +-
.../menu/component/ComponentSearchAction.java | 8 +-
.../component/ComponentSearchMenuAction.java | 3 +-
.../ComponentServiceCreatorAction.java | 2 +-
.../ComponentWorkflowCreatorAction.java | 2 +-
.../OpenWorkflowFromComponentAction.java | 8 +-
.../family/ComponentFamilyCreateAction.java | 10 +-
.../family/ComponentFamilyDeleteAction.java | 8 +-
.../profile/ComponentProfileCopyAction.java | 10 +-
.../profile/ComponentProfileDeleteAction.java | 4 +-
.../profile/ComponentProfileImportAction.java | 12 +-
.../ComponentProfileImportMenuAction.java | 3 +-
.../ui/panel/ComponentChoiceMessage.java | 4 +-
.../ui/panel/ComponentChooserPanel.java | 6 +-
.../ui/panel/ComponentListCellRenderer.java | 8 +-
.../ui/panel/ComponentVersionChooserPanel.java | 8 +-
.../component/ui/panel/FamilyChoiceMessage.java | 2 +-
.../component/ui/panel/FamilyChooserPanel.java | 8 +-
.../component/ui/panel/LicenseChooserPanel.java | 6 +-
.../t2/component/ui/panel/PrefixPanel.java | 5 +-
.../ui/panel/ProfileChoiceMessage.java | 2 +-
.../component/ui/panel/ProfileChooserPanel.java | 6 +-
...stryAndFamilyChooserComponentEntryPanel.java | 7 +-
.../ui/panel/RegistryAndFamilyChooserPanel.java | 4 +-
.../ui/panel/RegistryChoiceMessage.java | 2 +-
.../ui/panel/RegistryChooserPanel.java | 2 +-
.../component/ui/panel/SearchChoicePanel.java | 8 +-
.../ui/panel/SharingPolicyChooserPanel.java | 6 +-
.../ui/preference/ComponentPreferencePanel.java | 6 +-
.../ui/preference/RegistryTableModel.java | 2 +-
.../serviceprovider/ComponentServiceDesc.java | 16 +-
.../ComponentServiceProvider.java | 16 +-
.../ComponentServiceProviderConfig.java | 9 +-
.../component/ui/util/ComponentHealthCheck.java | 6 +-
.../sf/taverna/t2/component/ui/util/Utils.java | 5 +-
.../ComponentActivityContextViewFactory.java | 5 +-
...itySemanticAnnotationContextViewFactory.java | 8 +-
...omponentActivitySemanticAnnotationPanel.java | 2 +-
.../ui/view/ComponentContextViewFactory.java | 5 +-
.../ui/view/ComponentContextualView.java | 3 +-
.../taverna/t2/component/ui/view/ViewUtil.java | 8 +-
.../spring/component-activity-context.xml | 4 +-
.../taverna/t2/component/ComponentActivity.java | 4 +-
.../ComponentActivityConfigurationBean.java | 18 +-
.../t2/component/ComponentActivityFactory.java | 4 +-
.../ComponentActivityUpgradeChecker.java | 2 +-
.../sf/taverna/t2/component/ProxyCallback.java | 6 +-
.../component/profile/ActivityProfileImpl.java | 5 +-
.../component/profile/BaseProfileLocator.java | 3 +-
.../component/profile/ComponentProfileImpl.java | 27 ++-
.../t2/component/profile/PortProfileImpl.java | 5 +-
.../profile/SemanticAnnotationProfileImpl.java | 2 +-
.../t2/component/registry/Component.java | 7 +-
.../t2/component/registry/ComponentFamily.java | 13 +-
.../registry/ComponentImplementationCache.java | 5 +-
.../component/registry/ComponentRegistry.java | 14 +-
.../t2/component/registry/ComponentUtil.java | 14 +-
.../t2/component/registry/ComponentVersion.java | 7 +-
.../ComponentVersionIdentification.java | 14 +-
.../registry/local/LocalComponent.java | 8 +-
.../registry/local/LocalComponentFamily.java | 8 +-
.../registry/local/LocalComponentRegistry.java | 12 +-
.../local/LocalComponentRegistryFactory.java | 4 +-
.../registry/local/LocalComponentVersion.java | 2 +-
.../t2/component/registry/standard/Client.java | 2 +-
.../registry/standard/NewComponent.java | 11 +-
.../registry/standard/NewComponentFamily.java | 9 +-
.../registry/standard/NewComponentLicense.java | 3 +-
.../registry/standard/NewComponentProfile.java | 3 +-
.../registry/standard/NewComponentRegistry.java | 16 +-
.../standard/NewComponentRegistryFactory.java | 2 +-
.../t2/component/registry/standard/Policy.java | 4 +-
.../taverna/t2/component/utils/SystemUtils.java | 3 +-
.../spring/component-activity-context.xml | 2 +-
.../component/registry/ComponentFamilyTest.java | 7 +-
.../registry/ComponentRegistryTest.java | 7 +-
.../t2/component/registry/ComponentTest.java | 9 +-
.../registry/ComponentVersionTest.java | 7 +-
.../taverna/t2/component/registry/Harness.java | 2 +-
.../local/LocalComponentRegistryTest.java | 2 +-
.../standard/NewComponentRegistryTest.java | 2 +-
.../registry/standard/RegistrySupport.java | 6 +-
.../sf/taverna/t2/component/api/Component.java | 71 -------
.../t2/component/api/ComponentException.java | 50 -----
.../t2/component/api/ComponentFactory.java | 27 ---
.../net/sf/taverna/t2/component/api/Family.java | 99 ---------
.../sf/taverna/t2/component/api/License.java | 12 --
.../sf/taverna/t2/component/api/NamedItem.java | 8 -
.../sf/taverna/t2/component/api/Registry.java | 139 -------------
.../taverna/t2/component/api/SharingPolicy.java | 17 --
.../sf/taverna/t2/component/api/Version.java | 206 -------------------
.../component/api/config/ComponentConfig.java | 5 -
.../api/config/ComponentPropertyNames.java | 14 --
.../taverna/t2/component/api/package-info.java | 6 -
.../component/api/profile/ActivityProfile.java | 5 -
.../component/api/profile/AnnotatedElement.java | 10 -
.../api/profile/ExceptionHandling.java | 32 ---
.../api/profile/ExceptionReplacement.java | 27 ---
.../component/api/profile/HandleException.java | 39 ----
.../t2/component/api/profile/PortProfile.java | 5 -
.../t2/component/api/profile/Profile.java | 47 -----
.../api/profile/SemanticAnnotationProfile.java | 54 -----
.../apache/taverna/component/api/Component.java | 71 +++++++
.../component/api/ComponentException.java | 50 +++++
.../taverna/component/api/ComponentFactory.java | 27 +++
.../apache/taverna/component/api/Family.java | 100 +++++++++
.../apache/taverna/component/api/License.java | 12 ++
.../apache/taverna/component/api/NamedItem.java | 8 +
.../apache/taverna/component/api/Registry.java | 139 +++++++++++++
.../taverna/component/api/SharingPolicy.java | 17 ++
.../apache/taverna/component/api/Version.java | 206 +++++++++++++++++++
.../component/api/config/ComponentConfig.java | 5 +
.../api/config/ComponentPropertyNames.java | 14 ++
.../taverna/component/api/package-info.java | 6 +
.../component/api/profile/ActivityProfile.java | 5 +
.../component/api/profile/AnnotatedElement.java | 10 +
.../api/profile/ExceptionHandling.java | 32 +++
.../api/profile/ExceptionReplacement.java | 27 +++
.../component/api/profile/HandleException.java | 39 ++++
.../component/api/profile/PortProfile.java | 5 +
.../taverna/component/api/profile/Profile.java | 47 +++++
.../api/profile/SemanticAnnotationProfile.java | 54 +++++
.../src/main/resources/ComponentProfile.xsd | 2 +-
154 files changed, 1249 insertions(+), 1226 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
index 045330b..93b07a2 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AbstractSemanticAnnotationContextualView.java
@@ -30,11 +30,11 @@ import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import uk.org.taverna.scufl2.api.common.AbstractNamed;
import uk.org.taverna.scufl2.api.common.Named;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
index 9e6cf62..92d2935 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotateSemanticsMenuAction.java
@@ -21,11 +21,12 @@ 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 uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.common.AbstractNamed;
import uk.org.taverna.scufl2.api.port.ActivityPort;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.lang.ui.DeselectingButton;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import net.sf.taverna.t2.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
index 6c07e16..5f1ff0e 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/AnnotationPropertyPanelFactory.java
@@ -27,7 +27,7 @@ import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.get
import javax.swing.JComponent;
import javax.swing.JTextArea;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.RDFNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
index 84095b1..a8d6344 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DatatypePropertyPanelFactory.java
@@ -27,7 +27,7 @@ import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.get
import javax.swing.JComponent;
import javax.swing.JTextArea;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.RDFNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
index fb0acc2..566f49d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/DateTimePropertyPanelFactory.java
@@ -33,7 +33,7 @@ import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.text.DefaultCaret;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import com.hp.hpl.jena.datatypes.xsd.XSDDateTime;
import com.hp.hpl.jena.ontology.OntProperty;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
index 6555093..5b32370 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/FallbackPropertyPanelFactory.java
@@ -6,7 +6,7 @@ package net.sf.taverna.t2.component.annotation;
import javax.swing.JComponent;
import javax.swing.JLabel;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Statement;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
index 94cfe6a..c6c27dd 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/ObjectPropertyWithIndividualsPanelFactory.java
@@ -47,8 +47,9 @@ import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
import net.sf.taverna.t2.component.localworld.LocalWorld;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
import net.sf.taverna.t2.lang.ui.DeselectingButton;
import com.hp.hpl.jena.ontology.Individual;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
index 4a47dbb..e9a9981 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/PropertyPanelFactorySPI.java
@@ -27,7 +27,7 @@ import javax.swing.JComponent;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Statement;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
index 8446192..b347252 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualView.java
@@ -26,16 +26,16 @@ import static org.apache.log4j.Logger.getLogger;
import java.util.ArrayList;
import java.util.List;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
import net.sf.taverna.t2.workbench.file.FileManager;
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 uk.org.taverna.scufl2.api.common.AbstractNamed;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
index afe983b..448bd14 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationContextualViewFactory.java
@@ -23,12 +23,13 @@ package net.sf.taverna.t2.component.annotation;
import java.util.Arrays;
import java.util.List;
+import org.apache.taverna.component.api.ComponentFactory;
+import org.apache.taverna.component.api.Version;
+
import uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.common.AbstractNamed;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.port.ActivityPort;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
index e049d32..98266f5 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationPanel.java
@@ -39,7 +39,8 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
import net.sf.taverna.t2.lang.ui.DeselectingButton;
import com.hp.hpl.jena.ontology.OntProperty;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
index c13990f..0fd8c27 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/SemanticAnnotationUtils.java
@@ -31,11 +31,10 @@ import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Set;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
-
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 uk.org.taverna.scufl2.api.annotation.Annotation;
import uk.org.taverna.scufl2.api.common.AbstractNamed;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
index dfad45b..8e369e1 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/annotation/UnresolveablePredicatePanel.java
@@ -10,7 +10,7 @@ import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
index a626ad0..0645c14 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
@@ -18,11 +18,10 @@ import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
-
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 uk.org.taverna.configuration.AbstractConfigurable;
import uk.org.taverna.configuration.ConfigurationManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
index 1971c43..81f3cc7 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
@@ -1,11 +1,11 @@
package net.sf.taverna.t2.component.ui;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
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 java.net.MalformedURLException;
import java.net.URL;
@@ -13,14 +13,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.config.ComponentPropertyNames;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-
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 uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.configurations.Configuration;
@@ -112,7 +111,7 @@ public class ComponentActivityConfigurationBean extends Version.Identifier {
.getComponentProfile().getExceptionHandling();
if (eh != null)
result.outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (net.sf.taverna.t2.component.api.ComponentException e) {
+ } catch (org.apache.taverna.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/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
index e0a119b..169b170 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
@@ -1,12 +1,12 @@
package net.sf.taverna.t2.component.ui.config;
import static java.awt.event.ItemEvent.SELECTED;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import static net.sf.taverna.t2.component.ui.util.Utils.SHORT_STRING;
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 java.awt.GridBagConstraints;
import java.awt.GridLayout;
@@ -20,14 +20,14 @@ import java.util.SortedMap;
import javax.swing.JComboBox;
import javax.swing.JLabel;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.panel.ComponentListCellRenderer;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
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 uk.org.taverna.commons.services.ServiceRegistry;
import uk.org.taverna.scufl2.api.activity.Activity;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
index 58698c6..e6c46b9 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
@@ -3,7 +3,8 @@ package net.sf.taverna.t2.component.ui.config;
import java.awt.Frame;
import java.awt.event.ActionEvent;
-import net.sf.taverna.t2.component.api.ComponentFactory;
+import org.apache.taverna.component.api.ComponentFactory;
+
import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
import net.sf.taverna.t2.workbench.edits.EditManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
index 6f966d9..a625f29 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
@@ -15,7 +15,8 @@ import java.util.Set;
import javax.swing.JComponent;
import javax.swing.JTextArea;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
import net.sf.taverna.t2.component.ui.util.ComponentHealthCheck;
import net.sf.taverna.t2.visit.VisitKind;
import net.sf.taverna.t2.visit.VisitReport;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
index 77f6251..3ae26c4 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
@@ -11,17 +11,17 @@ import static org.apache.log4j.Logger.getLogger;
import java.util.List;
import java.util.Set;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
import net.sf.taverna.t2.component.ui.util.ComponentHealthCheck;
import net.sf.taverna.t2.visit.VisitReport;
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.core.Workflow;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
index a1c31cd..4e200f3 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
@@ -9,10 +9,6 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.Version.ID;
import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
import net.sf.taverna.t2.workbench.file.DataflowInfo;
import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
@@ -20,6 +16,10 @@ import net.sf.taverna.t2.workbench.file.FileType;
import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
index 9751c6d..c2db36c 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
@@ -16,13 +16,6 @@ import java.util.List;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider;
import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
import net.sf.taverna.t2.workbench.file.DataflowInfo;
@@ -31,6 +24,13 @@ import net.sf.taverna.t2.workbench.file.FileType;
import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.validation.ValidationReport;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
index 3fa679e..60da60f 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
@@ -11,7 +11,6 @@ import java.awt.Insets;
import javax.swing.border.Border;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.util.Utils;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
@@ -23,6 +22,7 @@ import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphController;
import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
import org.apache.batik.swing.JSVGCanvas;
+import org.apache.taverna.component.api.Version;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
index 484d846..510a910 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
@@ -2,7 +2,8 @@ package net.sf.taverna.t2.component.ui.menu;
import java.net.URI;
-import net.sf.taverna.t2.component.api.config.ComponentConfig;
+import org.apache.taverna.component.api.config.ComponentConfig;
+
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.core.Processor;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
index 6d1433b..ca7c88d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
@@ -5,8 +5,9 @@ import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
import javax.swing.Action;
+import org.apache.taverna.component.api.ComponentFactory;
+
import uk.org.taverna.commons.services.ServiceRegistry;
-import net.sf.taverna.t2.component.api.ComponentFactory;
import net.sf.taverna.t2.component.ui.config.ComponentConfigureAction;
import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
index dc204fe..a98af8d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
@@ -8,8 +8,6 @@ import static org.apache.log4j.Logger.getLogger;
import java.awt.event.ActionEvent;
import java.net.MalformedURLException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.ComponentAction;
import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
@@ -19,6 +17,8 @@ import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentFactory;
+import org.apache.taverna.component.api.Version;
import uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
index 827660c..8d46720 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
@@ -7,9 +7,10 @@ import java.net.URI;
import javax.swing.Action;
+import org.apache.taverna.component.api.ComponentFactory;
+
import uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.core.Processor;
-import net.sf.taverna.t2.component.api.ComponentFactory;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import net.sf.taverna.t2.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
index 3552115..8e8806a 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
@@ -10,9 +10,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 net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
import static net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean.ignorableNames;
import static net.sf.taverna.t2.component.ui.util.Utils.uniqueName;
+import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
import static uk.org.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
import java.awt.BorderLayout;
@@ -27,11 +27,12 @@ import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JSeparator;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
+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 net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
index f6c29ea..f2d5fb0 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
@@ -7,7 +7,8 @@ import java.net.URI;
import javax.swing.Action;
-import net.sf.taverna.t2.component.api.ComponentFactory;
+import org.apache.taverna.component.api.ComponentFactory;
+
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
index d36a819..696d53c 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
@@ -21,11 +21,6 @@ import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.ComponentChoiceMessage;
import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
@@ -38,6 +33,11 @@ import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
index 3612ccc..7c715bf 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
@@ -15,6 +15,10 @@ 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.jdom.Element;
import org.jdom.JDOMException;
@@ -27,10 +31,6 @@ import uk.org.taverna.scufl2.api.port.InputProcessorPort;
import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
import net.sf.taverna.t2.component.ui.panel.RegistryAndFamilyChooserComponentEntryPanel;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
index a946499..b87eaba 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
@@ -19,9 +19,6 @@ import java.util.concurrent.ExecutionException;
import javax.swing.AbstractAction;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
@@ -30,6 +27,9 @@ import net.sf.taverna.t2.component.ui.util.Utils;
import net.sf.taverna.t2.workbench.file.FileManager;
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 uk.org.taverna.scufl2.api.configurations.Configuration;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
index 66cdb5c..82f0b1e 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
@@ -21,9 +21,6 @@ import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.ComponentChoiceMessage;
import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
@@ -33,6 +30,9 @@ import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
index 28d202e..5574edd 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
@@ -26,10 +26,6 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.PrefixPanel;
import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
@@ -42,6 +38,10 @@ import net.sf.taverna.t2.workbench.edits.EditManager;
import net.sf.taverna.t2.workbench.selection.SelectionManager;
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 uk.org.taverna.commons.services.ServiceRegistry;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
index 999b000..9695cf8 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
@@ -7,8 +7,9 @@ import java.net.URI;
import javax.swing.Action;
+import org.apache.taverna.component.api.ComponentFactory;
+
import uk.org.taverna.commons.services.ServiceRegistry;
-import net.sf.taverna.t2.component.api.ComponentFactory;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.ui.menu.MenuManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
index d2298c2..f5d0c87 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
@@ -12,12 +12,12 @@ import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.menu.component.ComponentCreatorSupport.CopiedProcessor;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.workbench.selection.SelectionManager;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.Version;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
index 925f076..e186c10 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
@@ -9,7 +9,6 @@ import static org.apache.log4j.Logger.getLogger;
import java.awt.event.ActionEvent;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.ComponentAction;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.component.ui.util.Utils;
@@ -20,6 +19,7 @@ import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.Version;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
index 9653e3b..41ac068 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
@@ -17,10 +17,6 @@ import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.ComponentAction;
import net.sf.taverna.t2.component.ui.panel.ComponentChoiceMessage;
@@ -34,6 +30,10 @@ import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
index bc49233..f2f421c 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
@@ -24,11 +24,6 @@ import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.LicenseChooserPanel;
import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
@@ -37,6 +32,11 @@ import net.sf.taverna.t2.component.ui.panel.SharingPolicyChooserPanel;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
index e97c843..58ff4ce 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
@@ -25,10 +25,6 @@ import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.FamilyChooserPanel;
import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
@@ -38,6 +34,10 @@ import net.sf.taverna.t2.component.ui.util.Utils;
import net.sf.taverna.t2.workbench.file.FileManager;
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 uk.org.taverna.scufl2.api.configurations.Configuration;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
index 802f382..a7acd82 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
@@ -20,12 +20,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.License;
+import org.apache.taverna.component.api.Registry;
+import org.apache.taverna.component.api.SharingPolicy;
+import org.apache.taverna.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.SharingPolicy;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.LicenseChooserPanel;
import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
index 47d36ab..b5e7ed9 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
@@ -21,14 +21,14 @@ import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.profile.Profile;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
index 50df661..dfc5d99 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
@@ -28,12 +28,6 @@ import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.filechooser.FileNameExtensionFilter;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.LicenseChooserPanel;
import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
@@ -42,6 +36,12 @@ import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.lang.ui.DeselectingButton;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
index 8c7f482..160c70d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
@@ -9,7 +9,8 @@ import java.net.URI;
import javax.swing.Action;
-import net.sf.taverna.t2.component.api.ComponentFactory;
+import org.apache.taverna.component.api.ComponentFactory;
+
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
index 4de9295..e74c362 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
@@ -3,8 +3,8 @@
*/
package net.sf.taverna.t2.component.ui.panel;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
+import org.apache.taverna.component.api.Component;
+import org.apache.taverna.component.api.Family;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
index 0e4fe68..344962f 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
@@ -24,14 +24,14 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
index 1446faf..a4c2121 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
@@ -7,10 +7,10 @@ import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
+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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
index f36c99a..58f42fd 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
@@ -23,15 +23,15 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
index adc0306..75ce6c0 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
@@ -3,7 +3,7 @@
*/
package net.sf.taverna.t2.component.ui.panel;
-import net.sf.taverna.t2.component.api.Family;
+import org.apache.taverna.component.api.Family;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
index e8b7438..262bb5c 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
@@ -25,14 +25,14 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
index 68e7011..cdec8b9 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
@@ -41,13 +41,13 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.Registry;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
index 51c51b5..34b3485 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
@@ -17,8 +17,9 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.profile.Profile;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.profile.Profile;
+
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
index a5cb21e..eabad3b 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
@@ -3,7 +3,7 @@
*/
package net.sf.taverna.t2.component.ui.panel;
-import net.sf.taverna.t2.component.api.profile.Profile;
+import org.apache.taverna.component.api.profile.Profile;
/**
* @author alanrw
[20/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository-api pom
Posted by st...@apache.org.
taverna-component-repository-api pom
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/a0acabc2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/a0acabc2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/a0acabc2
Branch: refs/heads/master
Commit: a0acabc283e7115839c1dbb18a0768e0d2a31c3c
Parents: f416861
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:25:13 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:25:13 2015 +0000
----------------------------------------------------------------------
taverna-component-repository/pom.xml | 51 ++++++++-----------------------
1 file changed, 12 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/a0acabc2/taverna-component-repository/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository/pom.xml b/taverna-component-repository/pom.xml
index 771618d..72c9560 100644
--- a/taverna-component-repository/pom.xml
+++ b/taverna-component-repository/pom.xml
@@ -3,53 +3,27 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>net.sf.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>3.0.1-SNAPSHOT</version>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-engine</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
- <groupId>net.sf.taverna.component</groupId>
- <artifactId>component-repository</artifactId>
- <version>${t2.activities.version}</version>
- <name>Taverna Component Repository API</name>
+ <artifactId>taverna-component-repository-api</artifactId>
<packaging>bundle</packaging>
- <scm>
- <connection>scm:git:https://github.com/taverna/taverna-component-repository.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/taverna/taverna-component-repository.git</developerConnection>
- <url>https://github.com/taverna/taverna-component-repository/</url>
- <tag>HEAD</tag>
- </scm>
+ <name>Apache Taverna Component Repository API</name>
+ <inceptionYear>2014</inceptionYear>
<dependencies>
<dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-api</artifactId>
- <version>${scufl2.version}</version>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-api</artifactId>
+ <version>${taverna.language.version}</version>
</dependency>
<dependency>
+ <!-- FIXME: Use jena-osgi bundle -->
<groupId>org.apache.clerezza.ext</groupId>
<artifactId>com.hp.hpl.jena</artifactId>
<version>0.6-incubating</version>
</dependency>
</dependencies>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository</url>
- </repository>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- <id>mygrid-snapshot-repository</id>
- <name>myGrid Snapshot Repository</name>
- <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
- </repository>
- </repositories>
<build>
<plugins>
<plugin>
@@ -58,7 +32,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>net.sf.taverna.t2.component.api,net.sf.taverna.t2.component.api.profile,net.sf.taverna.t2.component.api.profile.doc</Export-Package>
+ <Export-Package>org.apache.taverna.component.api,org.apache.taverna.component.api.profile,org.apache.taverna.component.api.profile.doc</Export-Package>
</instructions>
</configuration>
</plugin>
@@ -79,5 +53,4 @@
</plugin>
</plugins>
</build>
- <inceptionYear>2014</inceptionYear>
-</project>
\ No newline at end of file
+</project>
[35/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..5694aa2
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
@@ -0,0 +1,144 @@
+/**
+ *
+ */
+package org.apache.taverna.component.profile;
+
+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 org.apache.taverna.component.api.ComponentException;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+/**
+ * @author alanrw
+ *
+ */
+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(), "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/fb982e2f/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
new file mode 100644
index 0000000..bbca4fd
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
@@ -0,0 +1,685 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.profile;
+
+import static com.hp.hpl.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 net.sf.taverna.t2.workflowmodel.health.HealthCheck.NO_PROBLEM;
+import static net.sf.taverna.t2.workflowmodel.health.RemoteHealthChecker.contactEndpoint;
+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 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 net.sf.taverna.t2.component.api.profile.doc.Activity;
+import net.sf.taverna.t2.component.api.profile.doc.Ontology;
+import net.sf.taverna.t2.component.api.profile.doc.Port;
+import net.sf.taverna.t2.component.api.profile.doc.Profile;
+import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.OntProperty;
+
+/**
+ * A ComponentProfile specifies the inputs, outputs and semantic annotations
+ * that a Component must contain.
+ *
+ * @author David Withers
+ */
+public class ComponentProfileImpl implements
+ org.apache.taverna.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 org.apache.taverna.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 org.apache.taverna.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 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<org.apache.taverna.component.api.profile.ActivityProfile> getActivityProfiles() {
+ List<org.apache.taverna.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
+ org.apache.taverna.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<org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..5ed740e
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package 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 net.sf.taverna.t2.component.api.profile.doc.Port;
+import net.sf.taverna.t2.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/fb982e2f/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
new file mode 100644
index 0000000..604a209
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.profile;
+
+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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.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/fb982e2f/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
new file mode 100644
index 0000000..5ee9b21
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
@@ -0,0 +1,33 @@
+package org.apache.taverna.component.registry;
+
+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/fb982e2f/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
new file mode 100644
index 0000000..4bf4e0d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Version;
+
+import uk.org.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
+ org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..51ca8bc
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import java.util.ArrayList;
+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 uk.org.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
+ org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..8d52693
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
@@ -0,0 +1,64 @@
+/**
+ *
+ */
+package org.apache.taverna.component.registry;
+
+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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Version;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+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/fb982e2f/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
new file mode 100644
index 0000000..48c6c1e
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+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 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;
+
+/**
+ * A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
+ *
+ * @author David Withers
+ */
+public abstract class ComponentRegistry implements
+ org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..b4e7d6d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
@@ -0,0 +1,112 @@
+package org.apache.taverna.component.registry;
+
+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 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/fb982e2f/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
new file mode 100644
index 0000000..6768bbc
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.apache.taverna.component.registry;
+
+import org.apache.taverna.component.api.Component;
+import org.apache.taverna.component.api.ComponentException;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+public abstract class ComponentVersion implements
+ org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..801add9
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
@@ -0,0 +1,196 @@
+/**
+ *
+ */
+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;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ComponentVersionIdentification implements
+ org.apache.taverna.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,
+ org.apache.taverna.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(org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..308300c
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
@@ -0,0 +1,133 @@
+/**
+ *
+ */
+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 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 uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..b868d81
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
@@ -0,0 +1,140 @@
+/**
+ *
+ */
+package org.apache.taverna.component.registry.local;
+
+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 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 uk.org.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);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..f4d8997
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
@@ -0,0 +1,204 @@
+/**
+ *
+ */
+package org.apache.taverna.component.registry.local;
+
+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 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;
+
+/**
+ * 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 + "]";
+ }
+ }
+}
[57/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.scufl2
Posted by st...@apache.org.
org.apache.taverna.scufl2
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/ff880041
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/ff880041
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/ff880041
Branch: refs/heads/master
Commit: ff8800415f8193698f988afaaccfd53b666728ed
Parents: 9bedcea
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 23:21:29 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 23:21:29 2015 +0000
----------------------------------------------------------------------
.../taverna/component/ui/ComponentAction.java | 2 +-
.../ui/ComponentActivityConfigurationBean.java | 14 +++----
...bstractSemanticAnnotationContextualView.java | 4 +-
.../annotation/AnnotateSemanticsMenuAction.java | 6 +--
.../SemanticAnnotationContextualView.java | 12 +++---
...SemanticAnnotationContextualViewFactory.java | 8 ++--
.../ui/annotation/SemanticAnnotationUtils.java | 6 +--
.../ui/annotation/TurtleContextualView.java | 6 +--
.../ui/config/ComponentConfigurationPanel.java | 2 +-
.../ui/config/ComponentConfigureAction.java | 2 +-
.../ui/file/ComponentDataflowHealthChecker.java | 4 +-
.../component/ui/file/ComponentOpener.java | 2 +-
.../component/ui/file/ComponentSaver.java | 6 +--
.../component/ui/file/FileManagerObserver.java | 2 +-
.../AbstractContextComponentMenuAction.java | 4 +-
.../ui/menu/NestedWorkflowCreationDialog.java | 44 ++++++++++----------
.../menu/NestedWorkflowCreatorMenuAction.java | 4 +-
...penComponentFromComponentActivityAction.java | 4 +-
...omponentFromComponentActivityMenuAction.java | 4 +-
.../ui/menu/ReplaceByComponentAction.java | 18 ++++----
.../ui/menu/ReplaceByComponentMenuAction.java | 2 +-
.../menu/component/ComponentCreatorSupport.java | 18 ++++----
.../menu/component/ComponentDeleteAction.java | 4 +-
.../ComponentServiceCreatorAction.java | 10 ++---
.../ComponentServiceCreatorMenuAction.java | 4 +-
.../ComponentWorkflowCreatorAction.java | 2 +-
.../OpenWorkflowFromComponentAction.java | 2 +-
.../family/ComponentFamilyDeleteAction.java | 4 +-
.../serviceprovider/ComponentServiceDesc.java | 4 +-
.../ComponentServiceProvider.java | 4 +-
.../ComponentServiceProviderConfig.java | 2 +-
.../component/ui/util/ComponentHealthCheck.java | 8 ++--
.../apache/taverna/component/ui/util/Utils.java | 10 ++---
.../ComponentActivityContextViewFactory.java | 2 +-
...itySemanticAnnotationContextViewFactory.java | 14 +++----
.../ui/view/ComponentContextViewFactory.java | 4 +-
.../taverna/component/ui/view/ViewUtil.java | 8 ++--
.../ComponentActivityConfigurationBean.java | 6 +--
.../taverna/component/registry/Component.java | 2 +-
.../component/registry/ComponentFamily.java | 2 +-
.../registry/ComponentImplementationCache.java | 2 +-
.../component/registry/ComponentVersion.java | 2 +-
.../registry/local/LocalComponent.java | 2 +-
.../registry/local/LocalComponentFamily.java | 2 +-
.../registry/local/LocalComponentVersion.java | 2 +-
.../registry/standard/NewComponent.java | 2 +-
.../registry/standard/NewComponentFamily.java | 2 +-
.../registry/standard/NewComponentRegistry.java | 2 +-
.../component/utils/AnnotationUtils.java | 12 +++---
.../taverna/component/AnnotationTest.java | 8 ++--
.../component/registry/ComponentFamilyTest.java | 4 +-
.../component/registry/ComponentTest.java | 4 +-
.../registry/ComponentVersionTest.java | 4 +-
.../standard/NewComponentRegistryTest.java | 4 +-
54 files changed, 159 insertions(+), 159 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 0996620..a0b9eec 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
@@ -13,7 +13,7 @@ import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
import org.apache.log4j.Logger;
import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
@SuppressWarnings("serial")
public abstract class ComponentAction extends AbstractAction {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 f0adfd5..05bcff9 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
@@ -21,13 +21,13 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.config.ComponentPropertyNames;
import org.apache.taverna.component.api.profile.ExceptionHandling;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+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;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 48f75f0..edbce41 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
@@ -36,8 +36,8 @@ import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import org.apache.log4j.Logger;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.common.Named;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.common.Named;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.Model;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 6249239..6c183d2 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
@@ -24,9 +24,9 @@ import javax.swing.JScrollPane;
import org.apache.taverna.component.api.ComponentFactory;
import org.apache.taverna.component.api.Version;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.port.ActivityPort;
+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 net.sf.taverna.t2.lang.ui.DeselectingButton;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import net.sf.taverna.t2.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 b32ac69..6507e2d 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
@@ -37,12 +37,12 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.profile.Profile;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+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;
/**
* @author David Withers
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 6652dc4..ca1b5cb 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
@@ -26,10 +26,10 @@ import java.util.List;
import org.apache.taverna.component.api.ComponentFactory;
import org.apache.taverna.component.api.Version;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.ActivityPort;
+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 net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 b59ffcc..3d03b0c 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
@@ -36,9 +36,9 @@ import org.apache.taverna.component.api.ComponentException;
import org.apache.taverna.component.api.profile.Profile;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+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 com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.ontology.OntResource;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 586c557..4d4a062 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
@@ -19,9 +19,9 @@ import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import org.slf4j.Logger;
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.AbstractNamed;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 293a8bc..386b620 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
@@ -30,7 +30,7 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.ui.panel.ComponentListCellRenderer;
import uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.activity.Activity;
@SuppressWarnings("serial")
public class ComponentConfigurationPanel extends ActivityConfigurationPanel {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 f7252cc..bf7d088 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
@@ -12,7 +12,7 @@ import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
import uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.activity.Activity;
@SuppressWarnings("serial")
public class ComponentConfigureAction extends ActivityConfigurationAction {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 b9076d5..c93b799 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
@@ -23,8 +23,8 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import org.apache.taverna.component.ui.util.ComponentHealthCheck;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 4e07171..76e28a1 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
@@ -21,7 +21,7 @@ import org.apache.taverna.component.api.ComponentFactory;
import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.Version.ID;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 424961a..8e08216 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
@@ -32,9 +32,9 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProvider;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.validation.ValidationReport;
-import uk.org.taverna.scufl2.validation.structural.StructuralValidator;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.validation.ValidationReport;
+import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 0490874..4c5ce34 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
@@ -24,7 +24,7 @@ import org.apache.batik.swing.JSVGCanvas;
import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.ui.util.Utils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
public class FileManagerObserver implements StartupSPI {
private static final Color COLOR = new Color(230, 147, 210);
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 8a90895..f910879 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
@@ -5,8 +5,8 @@ import java.net.URI;
import org.apache.taverna.component.api.config.ComponentConfig;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
public abstract class AbstractContextComponentMenuAction extends AbstractContextualMenuAction {
public AbstractContextComponentMenuAction(URI parentId, int positionHint) {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 0aecacf..16cb8d1 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
@@ -11,7 +11,7 @@ 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 uk.org.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
import java.awt.BorderLayout;
import java.awt.Component;
@@ -67,27 +67,27 @@ import net.sf.taverna.t2.workflow.edits.SetIterationStrategyStackEdit;
import org.apache.log4j.Logger;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.Named;
-import uk.org.taverna.scufl2.api.common.NamedSet;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.BlockingControlLink;
-import uk.org.taverna.scufl2.api.core.ControlLink;
-import uk.org.taverna.scufl2.api.core.DataLink;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.ProcessorPort;
-import uk.org.taverna.scufl2.api.port.ReceiverPort;
-import uk.org.taverna.scufl2.api.port.SenderPort;
-import uk.org.taverna.scufl2.api.profiles.Profile;
+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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 79f290d..7e281f3 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
@@ -15,8 +15,8 @@ import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import net.sf.taverna.t2.workbench.edits.EditManager;
import net.sf.taverna.t2.workbench.selection.SelectionManager;
import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 2803f04..c6685d6 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
@@ -20,8 +20,8 @@ import org.apache.taverna.component.ui.ComponentAction;
import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 83ad528..26eaf91 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
@@ -10,8 +10,8 @@ import javax.swing.Action;
import org.apache.taverna.component.api.ComponentFactory;
import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.file.FileType;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 781a63a..7cc713e 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
@@ -13,7 +13,7 @@ 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 uk.org.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
@@ -50,14 +50,14 @@ import net.sf.taverna.t2.workflow.edits.AddActivityOutputPortMappingEdit;
import net.sf.taverna.t2.workflow.edits.RemoveActivityEdit;
import net.sf.taverna.t2.workflow.edits.RenameEdit;
//import net.sf.taverna.t2.workflowmodel.utils.Tools;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+import 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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 2cea6b0..de6c62c 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
@@ -14,7 +14,7 @@ import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
import net.sf.taverna.t2.workbench.edits.EditManager;
import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import uk.org.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Processor;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 fb215c5..2748317 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
@@ -27,15 +27,15 @@ import org.apache.taverna.component.ui.util.ComponentFileType;
import org.jdom.Element;
import org.jdom.JDOMException;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.DataLink;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+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 net.sf.taverna.t2.workbench.edits.CompoundEdit;
import net.sf.taverna.t2.workbench.edits.Edit;
import net.sf.taverna.t2.workbench.edits.EditException;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 10ef628..887362c 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
@@ -31,8 +31,8 @@ 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 uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 1e8900f..97209c6 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
@@ -6,7 +6,7 @@ package org.apache.taverna.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 uk.org.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
import java.awt.event.ActionEvent;
@@ -21,10 +21,10 @@ import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
import com.fasterxml.jackson.databind.JsonNode;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.profiles.Profile;
+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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 1be55fb..0f4aa5d 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
@@ -10,8 +10,8 @@ import javax.swing.Action;
import org.apache.taverna.component.ui.menu.AbstractContextComponentMenuAction;
import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
import net.sf.taverna.t2.workbench.selection.SelectionManager;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 c1ef1e4..d96578c 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
@@ -21,7 +21,7 @@ import org.apache.taverna.component.ui.ComponentAction;
import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.component.ui.util.Utils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 94e7fdb..fbda434 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
@@ -35,7 +35,7 @@ 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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 9bd39b8..4e3c561 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
@@ -39,8 +39,8 @@ 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 uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 2f98978..70aaa60 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
@@ -24,8 +24,8 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.Version.ID;
import org.apache.taverna.component.ui.preference.ComponentPreference;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
import com.fasterxml.jackson.databind.node.ObjectNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 25ea0c1..bd553db 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
@@ -33,8 +33,8 @@ 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 uk.org.taverna.scufl2.api.common.Visitor;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
+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;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 9d8e82f..45358a6 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
@@ -9,7 +9,7 @@ import java.net.URL;
import org.apache.taverna.component.api.Family;
import org.apache.taverna.component.api.Version;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
public class ComponentServiceProviderConfig {
private URL registryBase;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 3743c79..c9f7362 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
@@ -11,10 +11,10 @@ import org.apache.taverna.component.api.ComponentFactory;
import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Visitor;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor;
+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;
public class ComponentHealthCheck extends VisitKind {
public static final int NO_PROBLEM = 0;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 fc36f4a..786823d 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
@@ -14,11 +14,11 @@ 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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Named;
-import uk.org.taverna.scufl2.api.common.NamedSet;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+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 net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
import net.sf.taverna.t2.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 1c3bb2a..f85d8d5 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
@@ -13,7 +13,7 @@ import org.apache.taverna.component.api.ComponentFactory;
import org.apache.taverna.component.ui.config.ComponentConfigureAction;
import uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.activity.Activity;
import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 7151c7f..9ec1b9f 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
@@ -14,13 +14,13 @@ import org.apache.taverna.component.api.profile.Profile;
import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
import org.apache.taverna.component.ui.annotation.AbstractSemanticAnnotationContextualView;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.Port;
+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 net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 349e298..bd86839 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
@@ -10,8 +10,8 @@ import org.apache.taverna.component.api.Version;
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
public class ComponentContextViewFactory implements
ContextualViewFactory<WorkflowBundle> {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 b6f6800..1b07cc3 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,10 +17,10 @@ import org.apache.taverna.component.api.Family;
import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+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
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 66429cb..b956b12 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
@@ -24,9 +24,9 @@ import org.apache.taverna.component.registry.ComponentImplementationCache;
import org.apache.taverna.component.registry.ComponentUtil;
import org.apache.taverna.component.registry.ComponentVersionIdentification;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+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;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 4bf4e0d..3750300 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
@@ -31,7 +31,7 @@ import java.util.TreeMap;
import org.apache.taverna.component.api.ComponentException;
import org.apache.taverna.component.api.Version;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* A Component is a building block for creating Taverna workflows. Components
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 51ca8bc..5c9adda 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
@@ -31,7 +31,7 @@ import org.apache.taverna.component.api.Registry;
import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.api.profile.Profile;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* A ComponentFamily is a collection of Components that share the same
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 8d52693..57d6625 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
@@ -13,7 +13,7 @@ import org.apache.log4j.Logger;
import org.apache.taverna.component.api.ComponentException;
import org.apache.taverna.component.api.Version;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 6768bbc..60e0b65 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
@@ -6,7 +6,7 @@ package org.apache.taverna.component.registry;
import org.apache.taverna.component.api.Component;
import org.apache.taverna.component.api.ComponentException;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 308300c..51a7b97 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
@@ -20,7 +20,7 @@ import org.apache.taverna.component.api.Version;
import org.apache.taverna.component.registry.Component;
import org.apache.taverna.component.utils.SystemUtils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 b868d81..4727c3d 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
@@ -21,7 +21,7 @@ import org.apache.taverna.component.registry.ComponentFamily;
import org.apache.taverna.component.registry.ComponentUtil;
import org.apache.taverna.component.utils.SystemUtils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 87f19d3..cee0c9f 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
@@ -17,7 +17,7 @@ import org.apache.taverna.component.api.ComponentException;
import org.apache.taverna.component.registry.ComponentVersion;
import org.apache.taverna.component.utils.SystemUtils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 7109bec..a4c4a08 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
@@ -22,7 +22,7 @@ import org.apache.taverna.component.registry.api.ComponentType;
import org.apache.taverna.component.registry.api.Description;
import org.apache.taverna.component.utils.SystemUtils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
class NewComponent extends Component {
static final String ELEMENTS = "title,description";
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 ff02a33..34f57de 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
@@ -13,7 +13,7 @@ import org.apache.taverna.component.registry.ComponentUtil;
import org.apache.taverna.component.registry.api.ComponentFamilyType;
import org.apache.taverna.component.registry.api.Description;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
/**
* A family of components in the new-interface registry.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 b8d46f1..9217752 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
@@ -45,7 +45,7 @@ import org.apache.taverna.component.registry.api.PolicyList;
import org.apache.taverna.component.utils.AnnotationUtils;
import org.apache.taverna.component.utils.SystemUtils;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
class NewComponentRegistry extends ComponentRegistry {
private static final String PROFILE_MIME_TYPE = "application/vnd.taverna.component-profile+xml";
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 2e886de..3890f4e 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
@@ -4,12 +4,12 @@ import java.io.IOException;
import java.io.StringReader;
import java.util.WeakHashMap;
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.Child;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.common.URITools;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
+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 com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 aa711fb..0d0a9a2 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
@@ -7,12 +7,12 @@ import java.io.IOException;
import org.apache.taverna.component.utils.AnnotationUtils;
import org.junit.Test;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.ReaderException;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+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 {
- //uk.org.taverna.scufl2.annotation.AnnotationTools anntoo;
+ //org.apache.taverna.scufl2.annotation.AnnotationTools anntoo;
@Test
public void test() throws ReaderException, IOException {
AnnotationUtils au = new AnnotationUtils();
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 f4fea1f..05e51b0 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
@@ -35,8 +35,8 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 71549df..7699b7e 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
@@ -35,8 +35,8 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 fdff6b6..b8bc098 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
@@ -33,8 +33,8 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ff880041/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 999cc6b..db5e712 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
@@ -35,8 +35,8 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
/**
*
[51/58] [abbrv] incubator-taverna-plugin-component git commit: name
tweak
Posted by st...@apache.org.
name tweak
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/ca64c500
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/ca64c500
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/ca64c500
Branch: refs/heads/master
Commit: ca64c500fb3a6b2c6acf937b24c0a39a48da7601
Parents: 43334c1
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 21:40:44 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 21:40:44 2015 +0000
----------------------------------------------------------------------
taverna-component-activity-ui/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/ca64c500/taverna-component-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/pom.xml b/taverna-component-activity-ui/pom.xml
index 550d002..feaf2b6 100644
--- a/taverna-component-activity-ui/pom.xml
+++ b/taverna-component-activity-ui/pom.xml
@@ -8,7 +8,7 @@
<version>2.1.0-incubating-SNAPSHOT</version>
</parent>
<artifactId>component-activity-ui</artifactId>
- <name>Taverna 3 Component activity UI bindings</name>
+ <name>Apache Taverna Component Workbench integration</name>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
[52/58] [abbrv] incubator-taverna-plugin-component git commit: newer
maven-jaxb2-plugin
Posted by st...@apache.org.
newer maven-jaxb2-plugin
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/e2f0dc0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/e2f0dc0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/e2f0dc0b
Branch: refs/heads/master
Commit: e2f0dc0b8242dd10d1f396cc7bfc14ad818b7605
Parents: ca64c50
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 23:01:45 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 23:01:45 2015 +0000
----------------------------------------------------------------------
taverna-component-repository-api/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e2f0dc0b/taverna-component-repository-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/pom.xml b/taverna-component-repository-api/pom.xml
index 1dc342b..421073a 100644
--- a/taverna-component-repository-api/pom.xml
+++ b/taverna-component-repository-api/pom.xml
@@ -39,7 +39,7 @@
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.8.3</version>
+ <version>0.12.3</version>
<executions>
<execution>
<goals>
[08/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java b/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
deleted file mode 100644
index 7339b10..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import uk.org.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
- net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java b/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
deleted file mode 100644
index 2283295..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry;
-
-import static java.lang.System.currentTimeMillis;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java b/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
deleted file mode 100644
index 40d1346..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
-
-/**
- * A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
- *
- * @author David Withers
- */
-public abstract class ComponentRegistry implements
- net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java b/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
deleted file mode 100644
index 4380d22..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.profile.BaseProfileLocator;
-import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
-import net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java b/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
deleted file mode 100644
index 8d6c443..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-public abstract class ComponentVersion implements
- net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java b/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
deleted file mode 100644
index 9115a32..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.Version.ID;
-
-/**
- * @author alanrw
- *
- */
-public class ComponentVersionIdentification implements
- net.sf.taverna.t2.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,
- net.sf.taverna.t2.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(net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java b/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
deleted file mode 100644
index bfb1007..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-import static net.sf.taverna.t2.component.registry.local.LocalComponentRegistry.ENC;
-import static org.apache.commons.io.FileUtils.readFileToString;
-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.util.NoSuchElementException;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.registry.Component;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-import org.apache.log4j.Logger;
-
-import uk.org.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java b/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
deleted file mode 100644
index 96a32ab..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-import static net.sf.taverna.t2.component.registry.local.LocalComponentRegistry.ENC;
-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 java.io.File;
-import java.io.IOException;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.registry.ComponentFamily;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-import org.apache.log4j.Logger;
-
-import uk.org.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);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java b/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
deleted file mode 100644
index 9fcc19a..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
-import net.sf.taverna.t2.component.registry.ComponentRegistry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-import org.apache.log4j.Logger;
-
-/**
- * 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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java b/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
deleted file mode 100644
index c56fe52..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.sf.taverna.t2.component.registry.local;
-
-import java.io.File;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java b/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
deleted file mode 100644
index 74a7389..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-import static java.lang.Integer.parseInt;
-import static net.sf.taverna.t2.component.registry.local.LocalComponent.COMPONENT_FILENAME;
-import static org.apache.commons.io.FileUtils.readFileToString;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.registry.ComponentVersion;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-import org.apache.log4j.Logger;
-
-import uk.org.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
deleted file mode 100644
index 61f9997..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
+++ /dev/null
@@ -1,637 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-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 net.sf.taverna.t2.component.registry.ClientVersion.VERSION;
-import static org.apache.commons.io.IOUtils.copy;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
-import net.sf.taverna.t2.component.registry.standard.annotations.Unused;
-import net.sf.taverna.t2.security.credentialmanager.CMException;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.security.credentialmanager.UsernamePassword;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
deleted file mode 100644
index a3f9536..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static java.lang.String.format;
-import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.logger;
-import static net.sf.taverna.t2.component.registry.standard.Policy.getPolicy;
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-import static net.sf.taverna.t2.component.utils.SystemUtils.getValue;
-
-import java.lang.ref.SoftReference;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.IllegalFormatException;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.registry.Component;
-import net.sf.taverna.t2.component.registry.ComponentVersion;
-import net.sf.taverna.t2.component.registry.api.ComponentType;
-import net.sf.taverna.t2.component.registry.api.Description;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import uk.org.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
deleted file mode 100644
index ce7107f..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.registry.ComponentFamily;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
-import net.sf.taverna.t2.component.registry.api.Description;
-import uk.org.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
deleted file mode 100644
index 02d2b3a..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.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;
- }
-
-}
[21/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository -> taverna-component-repository-api
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/catalog/xml.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/catalog/xml.xsd b/taverna-component-repository/src/main/catalog/xml.xsd
deleted file mode 100644
index aea7d0d..0000000
--- a/taverna-component-repository/src/main/catalog/xml.xsd
+++ /dev/null
@@ -1,287 +0,0 @@
-<?xml version='1.0'?>
-<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
-<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns ="http://www.w3.org/1999/xhtml"
- xml:lang="en">
-
- <xs:annotation>
- <xs:documentation>
- <div>
- <h1>About the XML namespace</h1>
-
- <div class="bodytext">
- <p>
- This schema document describes the XML namespace, in a form
- suitable for import by other schema documents.
- </p>
- <p>
- See <a href="http://www.w3.org/XML/1998/namespace.html">
- http://www.w3.org/XML/1998/namespace.html</a> and
- <a href="http://www.w3.org/TR/REC-xml">
- http://www.w3.org/TR/REC-xml</a> for information
- about this namespace.
- </p>
- <p>
- Note that local names in this namespace are intended to be
- defined only by the World Wide Web Consortium or its subgroups.
- The names currently defined in this namespace are listed below.
- They should not be used with conflicting semantics by any Working
- Group, specification, or document instance.
- </p>
- <p>
- See further below in this document for more information about <a
- href="#usage">how to refer to this schema document from your own
- XSD schema documents</a> and about <a href="#nsversioning">the
- namespace-versioning policy governing this schema document</a>.
- </p>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:attribute name="lang">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>lang (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- is a language code for the natural language of the content of
- any element; its value is inherited. This name is reserved
- by virtue of its definition in the XML specification.</p>
-
- </div>
- <div>
- <h4>Notes</h4>
- <p>
- Attempting to install the relevant ISO 2- and 3-letter
- codes as the enumerated possible values is probably never
- going to be a realistic possibility.
- </p>
- <p>
- See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
- http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
- and the IANA language subtag registry at
- <a href="http://www.iana.org/assignments/language-subtag-registry">
- http://www.iana.org/assignments/language-subtag-registry</a>
- for further information.
- </p>
- <p>
- The union allows for the 'un-declaration' of xml:lang with
- the empty string.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:union memberTypes="xs:language">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value=""/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="space">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>space (as an attribute name)</h3>
- <p>
- denotes an attribute whose
- value is a keyword indicating what whitespace processing
- discipline is intended for the content of the element; its
- value is inherited. This name is reserved by virtue of its
- definition in the XML specification.</p>
-
- </div>
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:NCName">
- <xs:enumeration value="default"/>
- <xs:enumeration value="preserve"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>base (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- provides a URI to be used as the base for interpreting any
- relative URIs in the scope of the element on which it
- appears; its value is inherited. This name is reserved
- by virtue of its definition in the XML Base specification.</p>
-
- <p>
- See <a
- href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
- for information about this attribute.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="id" type="xs:ID">
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>id (as an attribute name)</h3>
- <p>
- denotes an attribute whose value
- should be interpreted as if declared to be of type ID.
- This name is reserved by virtue of its definition in the
- xml:id specification.</p>
-
- <p>
- See <a
- href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
- for information about this attribute.
- </p>
- </div>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attributeGroup name="specialAttrs">
- <xs:attribute ref="xml:base"/>
- <xs:attribute ref="xml:lang"/>
- <xs:attribute ref="xml:space"/>
- <xs:attribute ref="xml:id"/>
- </xs:attributeGroup>
-
- <xs:annotation>
- <xs:documentation>
- <div>
-
- <h3>Father (in any context at all)</h3>
-
- <div class="bodytext">
- <p>
- denotes Jon Bosak, the chair of
- the original XML Working Group. This name is reserved by
- the following decision of the W3C XML Plenary and
- XML Coordination groups:
- </p>
- <blockquote>
- <p>
- In appreciation for his vision, leadership and
- dedication the W3C XML Plenary on this 10th day of
- February, 2000, reserves for Jon Bosak in perpetuity
- the XML name "xml:Father".
- </p>
- </blockquote>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- <div xml:id="usage" id="usage">
- <h2><a name="usage">About this schema document</a></h2>
-
- <div class="bodytext">
- <p>
- This schema defines attributes and an attribute group suitable
- for use by schemas wishing to allow <code>xml:base</code>,
- <code>xml:lang</code>, <code>xml:space</code> or
- <code>xml:id</code> attributes on elements they define.
- </p>
- <p>
- To enable this, such a schema must import this schema for
- the XML namespace, e.g. as follows:
- </p>
- <pre>
- <schema . . .>
- . . .
- <import namespace="http://www.w3.org/XML/1998/namespace"
- schemaLocation="http://www.w3.org/2001/xml.xsd"/>
- </pre>
- <p>
- or
- </p>
- <pre>
- <import namespace="http://www.w3.org/XML/1998/namespace"
- schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
- </pre>
- <p>
- Subsequently, qualified reference to any of the attributes or the
- group defined below will have the desired effect, e.g.
- </p>
- <pre>
- <type . . .>
- . . .
- <attributeGroup ref="xml:specialAttrs"/>
- </pre>
- <p>
- will define a type which will schema-validate an instance element
- with any of those attributes.
- </p>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- <div id="nsversioning" xml:id="nsversioning">
- <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
- <div class="bodytext">
- <p>
- In keeping with the XML Schema WG's standard versioning
- policy, this schema document will persist at
- <a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd</a>.
- </p>
- <p>
- At the date of issue it can also be found at
- <a href="http://www.w3.org/2001/xml.xsd">
- http://www.w3.org/2001/xml.xsd</a>.
- </p>
- <p>
- The schema document at that URI may however change in the future,
- in order to remain compatible with the latest version of XML
- Schema itself, or with the XML namespace itself. In other words,
- if the XML Schema or XML namespaces change, the version of this
- document at <a href="http://www.w3.org/2001/xml.xsd">
- http://www.w3.org/2001/xml.xsd
- </a>
- will change accordingly; the version at
- <a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd
- </a>
- will not change.
- </p>
- <p>
- Previous dated (and unchanging) versions of this schema
- document are at:
- </p>
- <ul>
- <li><a href="http://www.w3.org/2009/01/xml.xsd">
- http://www.w3.org/2009/01/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2007/08/xml.xsd">
- http://www.w3.org/2007/08/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2004/10/xml.xsd">
- http://www.w3.org/2004/10/xml.xsd</a></li>
- <li><a href="http://www.w3.org/2001/03/xml.xsd">
- http://www.w3.org/2001/03/xml.xsd</a></li>
- </ul>
- </div>
- </div>
- </xs:documentation>
- </xs:annotation>
-
-</xs:schema>
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java
deleted file mode 100644
index 47bc7e9..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-import java.util.SortedMap;
-
-import uk.org.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
deleted file mode 100644
index 2b5d829..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.api;
-
-/**
- * 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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
deleted file mode 100644
index 8c7d533..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java
deleted file mode 100644
index f618af7..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.profile.Profile;
-import uk.org.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java
deleted file mode 100644
index 7e7594d..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api;
-
-/**
- * @author alson
- *
- */
-public interface License extends NamedItem {
- public String getAbbreviation();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
deleted file mode 100644
index a31ad4d..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java
deleted file mode 100644
index f7b5be4..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
deleted file mode 100644
index ba91276..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api;
-
-/**
- * @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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java
deleted file mode 100644
index 3f81739..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.io.Serializable;
-import java.net.URL;
-
-import uk.org.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
deleted file mode 100644
index 172662d..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.config;
-
-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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
deleted file mode 100644
index baa8bb3..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package net.sf.taverna.t2.component.api.config;
-
-/**
- * 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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java
deleted file mode 100644
index 4af7984..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * An abstract API for working with components in a registry.
- * @author Donal Fellows
- * @author David Withers
- */
-package net.sf.taverna.t2.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
deleted file mode 100644
index f656dd0..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-public interface ActivityProfile extends AnnotatedElement {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
deleted file mode 100644
index dafec43..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-
-public interface AnnotatedElement {
- List<SemanticAnnotationProfile> getSemanticAnnotations()
- throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
deleted file mode 100644
index 5172f94..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-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(
- net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
- for (net.sf.taverna.t2.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
deleted file mode 100644
index e71c5ec..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-import net.sf.taverna.t2.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
deleted file mode 100644
index 1c3332b..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-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(
- net.sf.taverna.t2.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
deleted file mode 100644
index 5d66de8..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-
-public interface PortProfile extends AnnotatedElement {
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
deleted file mode 100644
index c0899f8..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.NamedItem;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
-
-import com.hp.hpl.jena.ontology.OntModel;
-
-public interface Profile extends NamedItem, AnnotatedElement {
-
- Registry getComponentRegistry();
-
- String getXML() throws ComponentException;
-
- net.sf.taverna.t2.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/c70b61ee/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
deleted file mode 100644
index 3000576..0000000
--- a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.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/c70b61ee/taverna-component-repository/src/main/resources/ComponentProfile.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/resources/ComponentProfile.xsd b/taverna-component-repository/src/main/resources/ComponentProfile.xsd
deleted file mode 100644
index 95b4405..0000000
--- a/taverna-component-repository/src/main/resources/ComponentProfile.xsd
+++ /dev/null
@@ -1,261 +0,0 @@
-<?xml version="1.0"?>
-<xs:schema targetNamespace="http://ns.taverna.org.uk/2012/component/profile"
- elementFormDefault="qualified" xmlns="http://ns.taverna.org.uk/2012/component/profile"
- xmlns:cp="http://ns.taverna.org.uk/2012/component/profile" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
- jxb:version="2.1">
- <xs:annotation>
- <xs:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="net.sf.taverna.t2.component.api.profile.doc" />
- </jxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:import namespace="http://www.w3.org/2001/XMLSchema"
- schemaLocation="http://www.w3.org/2001/XMLSchema.xsd" />
-
- <xs:simpleType name="name">
- <xs:annotation>
- <xs:documentation>A valid name for a port or activity in a Taverna
- workflow.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="([a-zA_Z0-9_])+" />
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="componentElements">
- <xs:annotation>
- <xs:documentation>
- The component elements that can be annotated.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:enumeration value="InputPort"></xs:enumeration>
- <xs:enumeration value="OutputPort"></xs:enumeration>
- <xs:enumeration value="Activity"></xs:enumeration>
- <xs:enumeration value="Component"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="basicAnnotations">
- <xs:annotation>
- <xs:documentation>
- The basic annotations available in a Taverna
- workflow.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:enumeration value="Description"></xs:enumeration>
- <xs:enumeration value="Author"></xs:enumeration>
- <xs:enumeration value="Example"></xs:enumeration>
- <xs:enumeration value="Title"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="componentAnnotations">
- <xs:annotation>
- <xs:documentation>
- Annotations applicable to components.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="basicAnnotations">
- <xs:enumeration value="Description"></xs:enumeration>
- <xs:enumeration value="Author"></xs:enumeration>
- <xs:enumeration value="Title"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="portAnnotations">
- <xs:annotation>
- <xs:documentation>
- Annotations applicable to ports.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="basicAnnotations">
- <xs:enumeration value="Description"></xs:enumeration>
- <xs:enumeration value="Example"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="activityAnnotations">
- <xs:annotation>
- <xs:documentation>
- Annotations applicable to activities.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="basicAnnotations">
- <xs:enumeration value="Description"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="componentAnnotation">
- <xs:simpleContent>
- <xs:extension base="componentAnnotations">
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="portAnnotation">
- <xs:simpleContent>
- <xs:extension base="portAnnotations">
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="activityAnnotation">
- <xs:simpleContent>
- <xs:extension base="activityAnnotations">
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="semanticAnnotation">
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:attribute name="ontology" type="xs:string" use="required" />
- <xs:attribute name="predicate" type="xs:string" use="required" />
- <xs:attribute name="class" type="xs:string" use="optional" />
- <xs:attributeGroup ref="xs:occurs" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="ontology">
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:attribute name="id" type="xs:string" use="required" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:complexType name="port">
- <xs:sequence>
- <xs:element name="annotation" type="portAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="semanticAnnotation" type="semanticAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="name" type="name" />
- <xs:attribute name="minDepth" type="xs:nonNegativeInteger"
- default="0" />
- <xs:attribute name="maxDepth" type="xs:allNNI" default="unbounded" />
- <xs:attributeGroup ref="xs:occurs" />
- </xs:complexType>
-
- <xs:complexType name="activity">
- <xs:sequence>
- <xs:element name="annotation" type="activityAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="semanticAnnotation" type="semanticAnnotation"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="type" type="xs:string" />
- <xs:attributeGroup ref="xs:occurs" />
- </xs:complexType>
-
- <xs:complexType name="replacement">
- <xs:complexContent>
- <xs:restriction base="xs:anyType">
- <xs:attribute name="replacementId" type="xs:string" use="required"/>
- <xs:attribute name="replacementMessage" type="xs:string" use="required"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:simpleType name="pattern">
- <xs:restriction base="xs:string">
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="pruneStack">
- <xs:complexContent>
- <xs:restriction base="xs:anyType"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="handleException">
- <xs:sequence>
- <xs:element name="pattern" type="pattern" minOccurs="1" maxOccurs="1"/>
- <xs:element name="pruneStack" type="pruneStack" minOccurs="0" maxOccurs="1"/>
- <xs:element name="replacement" type="replacement" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="failLists">
- <xs:complexContent>
- <xs:restriction base="xs:anyType"/>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="exceptionHandling">
- <xs:sequence>
- <xs:element name="failLists" type="failLists" minOccurs="0" maxOccurs="1"/>
- <xs:element name="handleException" type="handleException" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="component">
- <xs:sequence>
- <xs:element name="inputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="outputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="activity" type="activity" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="annotation" type="componentAnnotation" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="semanticAnnotation" type="semanticAnnotation" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="exceptionHandling" type="exceptionHandling" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="extends">
- <xs:attribute name="profileId" type="xs:string" use="required"/>
- </xs:complexType>
-
- <xs:element name="profile">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="id" type="xs:string" />
- <xs:element name="name" type="xs:string" />
- <xs:element name="description" type="xs:string" />
- <xs:element name="extends" type="extends" minOccurs = "0" />
- <xs:element name="ontology" type="ontology" minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="component" type="component" >
- <xs:unique name="inputPortUnique">
- <xs:selector xpath="cp:inputPort"></xs:selector>
- <xs:field xpath="@name"></xs:field>
- </xs:unique>
- <xs:unique name="outputPortUnique">
- <xs:selector xpath="cp:outputPort" />
- <xs:field xpath="@name" />
- </xs:unique>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:key name="ontologyKey">
- <xs:selector xpath="cp:ontology" />
- <xs:field xpath="@id" />
- </xs:key>
- <xs:keyref name="componentKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- <xs:keyref name="inputKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:inputPorts/cp:inputPort/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- <xs:keyref name="outputKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:outputPorts/cp:outputPort/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- <xs:keyref name="activityKeyRef" refer="ontologyKey">
- <xs:selector xpath="cp:component/cp:activities/cp:activity/cp:semanticAnnotation" />
- <xs:field xpath="@ontology" />
- </xs:keyref>
- </xs:element>
-
-</xs:schema>
[07/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
deleted file mode 100644
index c442057..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.profile.BaseProfileLocator;
-import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
-import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
deleted file mode 100644
index 31d3e40..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
+++ /dev/null
@@ -1,469 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.standard.Policy.PRIVATE;
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.Version.ID;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.registry.ComponentRegistry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
-import net.sf.taverna.t2.component.registry.api.ComponentDescriptionList;
-import net.sf.taverna.t2.component.registry.api.ComponentFamilyList;
-import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
-import net.sf.taverna.t2.component.registry.api.ComponentProfileList;
-import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
-import net.sf.taverna.t2.component.registry.api.ComponentType;
-import net.sf.taverna.t2.component.registry.api.Content;
-import net.sf.taverna.t2.component.registry.api.Description;
-import net.sf.taverna.t2.component.registry.api.LicenseList;
-import net.sf.taverna.t2.component.registry.api.LicenseType;
-import net.sf.taverna.t2.component.registry.api.ObjectFactory;
-import net.sf.taverna.t2.component.registry.api.Permissions;
-import net.sf.taverna.t2.component.registry.api.PolicyList;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
deleted file mode 100644
index 20a92f9..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.jaxbContext;
-import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.logger;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.registry.ComponentRegistry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
deleted file mode 100644
index 1f99bc0..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static java.lang.System.identityHashCode;
-import static net.sf.taverna.t2.component.registry.api.Privilege.DOWNLOAD;
-import static net.sf.taverna.t2.component.registry.api.Privilege.VIEW;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.registry.api.Permissions;
-import net.sf.taverna.t2.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
deleted file mode 100644
index 7c6e061..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard.annotations;
-
-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 {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
deleted file mode 100644
index fd48b0b..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Miscellaneous annotations on other parts of the component engine.
- *
- * @author Donal Fellows
- */
-package net.sf.taverna.t2.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java b/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
deleted file mode 100644
index 1889391..0000000
--- a/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * This is the new interface to the myExperiment registry, a.k.a. μExperiment.
- * @author Donal Fellows
- */
-package net.sf.taverna.t2.component.registry.standard;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java b/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
deleted file mode 100644
index 51185d5..0000000
--- a/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package net.sf.taverna.t2.component.utils;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.WeakHashMap;
-
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.Child;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.common.URITools;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.rdf.model.Property;
-import com.hp.hpl.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/e15f9c85/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java b/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
deleted file mode 100644
index 4fec684..0000000
--- a/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package net.sf.taverna.t2.component.utils;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.registry.api.Description;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-import uk.org.taverna.platform.execution.api.WorkflowCompiler;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-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();
- }
-
- 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/e15f9c85/src/main/resources/BaseProfile.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/BaseProfile.xml b/src/main/resources/BaseProfile.xml
deleted file mode 100644
index 2697854..0000000
--- a/src/main/resources/BaseProfile.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0"?>
-
-<profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ns.taverna.org.uk/2012/component/profile"
- xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile http://ns.taverna.org.uk/2012/component/profile/ComponentProfile.xsd">
-
- <id>http://purl.org/wfever/workflow-base-profile</id>
- <name>Workflow base annotation profile</name>
- <description>A base profile for annotating (Taverna) workflows, processes and ports.
- This profile is meant to be used as a common base for more specific profiles.
- The common annotations here are mostly optional (minOccurs=0),
- covering general annotations like title, contact person, example value.</description>
-
- <!-- <ontology id="dcterms">http://purl.org/dc/terms/</ontology> The above
- is flaky.. Instead we use the OWL2 DL object/datatype version from http://bloody-byte.net/rdf/dc_owl2dl/ -->
- <ontology id="dcterms">http://bloody-byte.net/rdf/dc_owl2dl/dcterms_od.owl</ontology>
- <ontology id="foaf">http://xmlns.com/foaf/spec/index.rdf</ontology>
- <ontology id="prov">http://www.w3.org/ns/prov.rdf</ontology>
- <ontology id="pav">http://pav-ontology.googlecode.com/svn/trunk/pav.owl</ontology>
- <ontology id="ro">http://wf4ever.github.com/ro/ro.owl</ontology>
- <ontology id="wfdesc">http://wf4ever.github.com/ro/wfdesc.owl</ontology>
- <ontology id="cito">http://speronitomcat.web.cs.unibo.it:8080/LODE/source?url=http://purl.org/spar/cito</ontology>
- <ontology id="dcat">http://www.w3.org/ns/dcat.rdf</ontology>
- <ontology id="roterms">https://raw.github.com/wf4ever/ro/wfannotations/roterms.owl</ontology>
- <ontology id="skos">http://www.w3.org/TR/skos-reference/skos.rdf</ontology>
- <component>
- <inputPort>
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#exampleValue"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded"
- class="http://purl.org/wf4ever/roterms#WorkflowValue" />
-
- <!-- TODO: property chains (?) to say hasArchetype for the typing -->
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#ofSemanticType"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded"
- class="http://www.w3.org/2004/02/skos/core#Concept" />
- <semanticAnnotation
- predicate="http://purl.org/wf4ever/roterms#ofStructuralType"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/format"
- ontology="dcterms" minOccurs="0" class="http://purl.org/dc/terms/IMT" />
- <!-- -->
-
-
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#defaultValue"
- ontology="roterms" minOccurs="0"
- class="http://purl.org/wf4ever/roterms#WorkflowValue" />
- </inputPort>
-
- <outputPort>
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#exampleValue"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded"
- class="http://purl.org/wf4ever/roterms#WorkflowValue" />
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#ofSemanticType"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded"
- class="http://www.w3.org/2004/02/skos/core#Concept" />
- <semanticAnnotation
- predicate="http://purl.org/wf4ever/roterms#ofStructuralType"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
-
- <semanticAnnotation predicate="http://purl.org/dc/terms/format"
- ontology="dcterms" minOccurs="0" class="http://purl.org/dc/terms/IMT" />
- </outputPort>
-
- <activity minOccurs="1" maxOccurs="unbounded">
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#performsTask"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded"
- class="http://www.w3.org/2004/02/skos/core#Concept" />
- <semanticAnnotation
- predicate="http://purl.org/wf4ever/roterms#requiresSoftware"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
- <semanticAnnotation
- predicate="http://purl.org/wf4ever/roterms#requiresHardware"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#requireDataset"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded"
- class="http://www.w3.org/ns/dcat#Dataset" />
- </activity>
-
-
-
-
- <semanticAnnotation predicate="http://purl.org/dc/terms/title"
- ontology="dcterms" minOccurs="0" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/description"
- ontology="dcterms" minOccurs="0" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/created"
- ontology="dcterms" minOccurs="0"
- class="http://www.w3.org/2001/XMLSchema#dateTime" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/modified"
- ontology="dcterms" minOccurs="0"
- class="http://www.w3.org/2001/XMLSchema#dateTime" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/license"
- ontology="dcterms" minOccurs="0"
- class="http://purl.org/dc/terms/LicenseDocument" />
- <semanticAnnotation predicate="http://purl.org/pav/authoredBy"
- ontology="pav" minOccurs="0" maxOccurs="unbounded"
- class="http://xmlns.com/foaf/0.1/Person" />
- <semanticAnnotation predicate="http://purl.org/pav/contributedBy"
- ontology="pav" minOccurs="0" maxOccurs="unbounded"
- class="http://xmlns.com/foaf/0.1/Person" />
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#technicalContact"
- ontology="roterms" minOccurs="0" class="http://xmlns.com/foaf/0.1/Agent" />
- <semanticAnnotation predicate="http://purl.org/pav/previousVersion"
- ontology="pav" minOccurs="0" class="http://purl.org/wf4ever/wfdesc#Workflow" />
- <semanticAnnotation predicate="http://purl.org/spar/cito/isDocumentedBy"
- ontology="cito" minOccurs="0" maxOccurs="unbounded" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/audience"
- ontology="dcterms" minOccurs="0" maxOccurs="unbounded"
- class="http://xmlns.com/foaf/0.1/Project" />
- <semanticAnnotation predicate="http://purl.org/dc/terms/identifier"
- ontology="dcterms" minOccurs="1" />
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#requiresSoftware"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
- <semanticAnnotation predicate="http://purl.org/wf4ever/roterms#requiresHardware"
- ontology="roterms" minOccurs="0" maxOccurs="unbounded" />
- <semanticAnnotation predicate="http://xmlns.com/foaf/0.1/depiction"
- ontology="foaf" minOccurs="0" class="http://xmlns.com/foaf/0.1/Image" />
-
-
- </component>
-
-
-</profile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/resources/EmptyProfile.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/EmptyProfile.xml b/src/main/resources/EmptyProfile.xml
deleted file mode 100644
index 2851b83..0000000
--- a/src/main/resources/EmptyProfile.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-
-<profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ns.taverna.org.uk/2012/component/profile"
- xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile ComponentProfile.xsd">
-
- <id>net.sf.taverna.t2.component.profile.empty</id>
- <name>Empty profile</name>
- <description>A basic empty profile that does not allow additional semantic annotation</description>
- <component>
- </component>
-</profile>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/resources/META-INF/spring/component-activity-context.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/component-activity-context.xml b/src/main/resources/META-INF/spring/component-activity-context.xml
deleted file mode 100644
index a879865..0000000
--- a/src/main/resources/META-INF/spring/component-activity-context.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <bean id="ComponentLocalHealthChecker"
- class="net.sf.taverna.t2.component.ComponentActivityLocalChecker" />
- <bean id="ComponentUpgradeHealthChecker"
- class="net.sf.taverna.t2.component.ComponentActivityUpgradeChecker">
- <property name="componentUtil" ref="componentUtil" />
- </bean>
- <bean id="baseProfileLocator" class="net.sf.taverna.t2.component.profile.BaseProfileLocator">
- <property name="appConfig" ref="app-config" />
- </bean>
-
- <bean id="componentActivityFactory" class="net.sf.taverna.t2.component.ComponentActivityFactory">
- <property name="componentUtil" ref="componentUtil" />
- <property name="dataflowCache" ref="cache" />
- <property name="edits" ref="edits" />
- <property name="annotationUtils" ref="annotationUtil" />
- </bean>
-
- <bean id="networkRegistry"
- class="net.sf.taverna.t2.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="net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory">
- <property name="componentUtil" ref="componentUtil" />
- <property name="systemUtils" ref="systemUtil" />
- </bean>
- <bean id="componentUtil" class="net.sf.taverna.t2.component.registry.ComponentUtil">
- <property name="networkLocator" ref="networkRegistry" />
- <property name="fileLocator" ref="fileRegistry" />
- <property name="baseLocator" ref="baseProfileLocator" />
- </bean>
-
- <bean id="cache" class="net.sf.taverna.t2.component.registry.ComponentImplementationCache">
- <property name="componentUtil" ref="componentUtil" />
- </bean>
- <bean id="systemUtil" class="net.sf.taverna.t2.component.utils.SystemUtils">
- <property name="appConfig" ref="app-config" />
- <property name="workflowBundler" ref="workflowBundleIO" />
- <property name="compilers" ref="compilers" />
- </bean>
- <bean id="annotationUtil" class="net.sf.taverna.t2.component.utils.AnnotationUtils" />
-
- <osgi:service ref="ComponentLocalHealthChecker"
- interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
- <osgi:service ref="ComponentUpgradeHealthChecker"
- interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
- <osgi:service ref="componentActivityFactory"
- interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
- <osgi:service ref="componentUtil"
- interface="net.sf.taverna.t2.component.api.ComponentFactory" />
-
- <osgi:reference id="app-config"
- interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
- <osgi:reference id="credentialManager"
- interface="net.sf.taverna.t2.security.credentialmanager.CredentialManager" />
- <osgi:reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" />
- <osgi:reference id="workflowBundleIO" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleIO" />
- <osgi:list id="compilers" interface="uk.org.taverna.platform.execution.api.WorkflowCompiler" />
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/resources/NewMyExperimentSchema.xsd
----------------------------------------------------------------------
diff --git a/src/main/resources/NewMyExperimentSchema.xsd b/src/main/resources/NewMyExperimentSchema.xsd
deleted file mode 100644
index ba06860..0000000
--- a/src/main/resources/NewMyExperimentSchema.xsd
+++ /dev/null
@@ -1,454 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- elementFormDefault="unqualified" attributeFormDefault="unqualified"
- xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
- jxb:version="2.1">
- <xs:annotation>
- <xs:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="net.sf.taverna.t2.component.registry.api" />
- </jxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:attributeGroup name="LocationAttributes">
- <xs:attribute name="id" type="xs:string" />
- <xs:attribute name="uri" type="xs:anyURI" />
- <xs:attribute name="resource" type="xs:anyURI" />
- <xs:attribute name="version" type="xs:int" />
- </xs:attributeGroup>
- <xs:complexType name="StatsInfo">
- <xs:sequence>
- <xs:element name="total" type="xs:int" />
- <xs:element name="breakdown">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="site" type="xs:int" />
- <xs:element name="other" type="xs:int" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Statistics">
- <xs:sequence>
- <xs:element name="viewings" type="StatsInfo" />
- <xs:element name="downloads" type="StatsInfo" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Description" mixed="true">
- <xs:all>
- <xs:element name="title" type="xs:string" minOccurs="0" />
- <xs:element name="description" type="xs:string" minOccurs="0" />
- <xs:element name="license-type" type="Description"
- minOccurs="0" />
- <xs:element name="permissions" type="Permissions"
- minOccurs="0" />
- <xs:element name="content-uri" type="xs:string" minOccurs="0" />
- </xs:all>
- <xs:attributeGroup ref="LocationAttributes" />
- </xs:complexType>
- <xs:complexType name="Privileges">
- <xs:sequence>
- <xs:element name="privilege" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="type" type="Privilege" use="required" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:simpleType name="Privilege">
- <xs:restriction base="xs:string">
- <xs:enumeration value="view" />
- <xs:enumeration value="download" />
- <xs:enumeration value="edit" />
- </xs:restriction>
- </xs:simpleType>
- <xs:complexType name="Permissions">
- <xs:choice>
- <xs:element name="permission" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="category" type="xs:string" />
- <xs:element name="id" type="xs:int" minOccurs="0" />
- <xs:element name="privilege" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="type" type="Privilege" use="required" />
- </xs:complexType>
- </xs:element>
- <xs:element name="use-layout" type="xs:boolean" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="group-policy-id" type="xs:string" />
- </xs:choice>
- </xs:complexType>
- <xs:complexType name="Content">
- <xs:simpleContent>
- <xs:extension base="xs:base64Binary">
- <xs:attribute name="encoding" type="xs:string" />
- <xs:attribute name="type" type="xs:string" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="Comments">
- <xs:sequence>
- <xs:element name="comment" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Tags">
- <xs:sequence>
- <xs:element name="tag" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Taggings">
- <xs:sequence>
- <xs:element name="tagging" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Credits">
- <xs:sequence>
- <xs:element name="credit" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Attributions">
- <xs:sequence>
- <xs:element name="attribution" type="Description"
- minOccurs="1" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Versions">
- <xs:sequence>
- <xs:element name="workflow" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="ComponentType">
- <xs:annotation>
- <xs:documentation>
- The type of components and workflows.
- </xs:documentation>
- </xs:annotation>
- <xs:all>
- <xs:element name="id" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:appinfo>
- <jxb:property name="idElement" />
- </xs:appinfo>
- </xs:annotation>
- </xs:element>
- <xs:element name="title" type="xs:string" minOccurs="0" />
- <xs:element name="description" type="xs:string" minOccurs="0" />
- <xs:element name="type" type="Description" minOccurs="0" />
- <xs:element name="uploader" type="Description" minOccurs="0" />
- <xs:element name="created-at" type="xs:string" minOccurs="0" />
- <xs:element name="updated-at" type="xs:string" minOccurs="0" />
- <xs:element name="license-type" type="Description"
- minOccurs="0" />
- <xs:element name="content-uri" type="xs:anyURI" minOccurs="0" />
- <xs:element name="content-type" type="xs:string"
- minOccurs="0" />
- <xs:element name="content" type="Content" minOccurs="0" />
- <xs:element name="tags" type="Tags" minOccurs="0" />
- <xs:element name="taggings" type="Taggings" minOccurs="0" />
- <xs:element name="versions" type="Versions" minOccurs="0" />
- <xs:element name="comments" type="Comments" minOccurs="0" />
- <xs:element name="credits" type="Credits" minOccurs="0" />
- <xs:element name="attributions" type="Attributions"
- minOccurs="0" />
- <xs:element name="privileges" type="Privileges" minOccurs="0" />
- <xs:element name="statistics" type="Statistics" minOccurs="0" />
- <xs:element name="permissions" type="Permissions"
- minOccurs="0" />
- <!-- Unique bits below -->
- <xs:element name="component-family" type="xs:anyURI"
- minOccurs="0" />
- <xs:element name="preview" type="xs:anyURI" minOccurs="0" />
- <xs:element name="thumbnail" type="xs:anyURI" minOccurs="0" />
- <xs:element name="thumbnail-big" type="xs:anyURI"
- minOccurs="0" />
- <xs:element name="svg" type="xs:anyURI" minOccurs="0" />
- <xs:element name="reviews" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="review" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="ratings" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="rating" type="Description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="citations" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="citation" type="Description"
- minOccurs="1" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="components" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="dataflows" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="dataflow" type="DataflowType"
- maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:all>
- <xs:attributeGroup ref="LocationAttributes" />
- </xs:complexType>
-
- <xs:complexType name="ComponentFamilyType">
- <xs:annotation>
- <xs:documentation>
- The type of component families and packs.
- </xs:documentation>
- </xs:annotation>
- <xs:all>
- <xs:element name="id" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:appinfo>
- <jxb:property name="idElement" />
- </xs:appinfo>
- </xs:annotation>
- </xs:element>
- <xs:element name="title" type="xs:string" minOccurs="0" />
- <xs:element name="description" type="xs:string" minOccurs="0" />
- <xs:element name="owner" type="Description" minOccurs="0" />
- <xs:element name="created-at" type="xs:string" minOccurs="0" />
- <xs:element name="updated-at" type="xs:string" minOccurs="0" />
- <xs:element name="tags" type="Tags" minOccurs="0" />
- <xs:element name="taggings" type="Taggings" minOccurs="0" />
- <xs:element name="license-type" type="Description"
- minOccurs="0" />
- <xs:element name="download-url" type="xs:anyURI"
- minOccurs="0" />
- <xs:element name="privileges" type="Privileges" minOccurs="0" />
- <xs:element name="comments" type="Comments" minOccurs="0" />
- <xs:element name="statistics" type="Statistics" minOccurs="0" />
- <xs:element name="versions" type="Versions" minOccurs="0" />
- <xs:element name="permissions" type="Permissions"
- minOccurs="0" />
- <!-- Unique bits below. -->
- <xs:element name="component-profile" type="xs:anyURI"
- minOccurs="0" />
- <xs:element name="internal-pack-items" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="internal-pack-item" type="Description"
- maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="external-pack-items" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="external-pack-item" type="Description"
- maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="relationships">
- <xs:complexType>
- <xs:sequence>
- <xs:any minOccurs="0" maxOccurs="unbounded"
- processContents="lax" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:all>
- <xs:attributeGroup ref="LocationAttributes" />
- </xs:complexType>
-
- <xs:complexType name="ComponentProfileType">
- <xs:annotation>
- <xs:documentation>
- The type of component profiles and files.
- </xs:documentation>
- </xs:annotation>
- <xs:all>
- <xs:element name="id" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:appinfo>
- <jxb:property name="idElement" />
- </xs:appinfo>
- </xs:annotation>
- </xs:element>
- <xs:element name="filename" type="xs:string" minOccurs="0" />
- <xs:element name="title" type="xs:string" minOccurs="0" />
- <xs:element name="description" type="xs:string" minOccurs="0" />
- <xs:element name="type" type="Description" minOccurs="0" />
- <xs:element name="uploader" type="Description" minOccurs="0" />
- <xs:element name="content-type" type="xs:string"
- minOccurs="0" />
- <xs:element name="content" type="Content" minOccurs="0" />
- <xs:element name="content-uri" type="xs:anyURI" minOccurs="0" />
- <xs:element name="created-at" type="xs:string" minOccurs="0" />
- <xs:element name="updated-at" type="xs:string" minOccurs="0" />
- <xs:element name="license-type" type="Description"
- minOccurs="0" />
- <xs:element name="credits" type="Credits" minOccurs="0" />
- <xs:element name="attributions" type="Attributions"
- minOccurs="0" />
- <xs:element name="tags" type="Tags" minOccurs="0" />
- <xs:element name="taggings" type="Taggings" minOccurs="0" />
- <xs:element name="privileges" type="Privileges" minOccurs="0" />
- <xs:element name="comments" type="Comments" minOccurs="0" />
- <xs:element name="statistics" type="Statistics" minOccurs="0" />
- <xs:element name="permissions" minOccurs="0" type="Permissions" />
- </xs:all>
- <xs:attributeGroup ref="LocationAttributes" />
- </xs:complexType>
-
- <xs:complexType name="DataflowType">
- <xs:all>
- <xs:element name="sources" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="source" minOccurs="0" maxOccurs="unbounded"
- type="WorkflowPort" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="sinks" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="sink" minOccurs="0" maxOccurs="unbounded"
- type="WorkflowPort" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="processors" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="processor" minOccurs="0" maxOccurs="unbounded"
- type="Processor" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="datalinks" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="datalink" minOccurs="0" maxOccurs="unbounded"
- type="Link" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <!-- FIXME: Add when myExp actually publishes this info -->
- <!-- <xs:element name="coordinations" minOccurs="0" /> -->
- </xs:all>
- <xs:attribute name="id" type="xs:string" use="required" />
- <xs:attribute name="role" type="xs:string" />
- </xs:complexType>
- <xs:complexType name="WorkflowPort">
- <xs:sequence>
- <xs:element name="name" type="xs:string" />
- <xs:element name="descriptions" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="description" type="xs:string"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="examples" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="example" type="xs:string" minOccurs="0"
- maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="ProcessorPort">
- <xs:sequence>
- <xs:element name="node" type="xs:string" />
- <xs:element name="port" type="xs:string" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Processor">
- <xs:sequence>
- <xs:element name="name" type="xs:string" />
- <xs:element name="type" type="xs:string" />
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Link">
- <xs:all>
- <xs:element name="sink" type="ProcessorPort" />
- <xs:element name="source" type="ProcessorPort" />
- </xs:all>
- </xs:complexType>
-
- <xs:complexType name="ComponentDescriptionList">
- <xs:sequence>
- <xs:element name="workflow" type="Description"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="ComponentFamilyList">
- <xs:sequence>
- <xs:element name="pack" type="Description"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="LicenseType">
- <xs:all>
- <xs:element name="id" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:appinfo>
- <jxb:property name="idElement" />
- </xs:appinfo>
- </xs:annotation>
- </xs:element>
- <xs:element name="unique-name" type="xs:string" minOccurs="0" />
- <xs:element name="title" type="xs:string" minOccurs="0" />
- <xs:element name="description" type="xs:string" minOccurs="0" />
- <xs:element name="url" type="xs:anyURI" minOccurs="0" />
- <xs:element name="created-at" type="xs:string" minOccurs="0" />
- <xs:element name="updated-at" type="xs:string" minOccurs="0" />
- </xs:all>
- <xs:attributeGroup ref="LocationAttributes" />
- </xs:complexType>
- <xs:complexType name="LicenseList">
- <xs:sequence>
- <xs:element name="license" type="LicenseType" minOccurs="0"
- maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="PolicyList">
- <xs:sequence>
- <xs:element name="policy" type="Description" minOccurs="0"
- maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="ComponentProfileList">
- <xs:sequence>
- <xs:element name="file" type="Description"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:element name="content-uri" type="xs:string" />
- <xs:element name="component-profiles" type="ComponentProfileList" />
- <xs:element name="component-families" type="ComponentFamilyList" />
- <xs:element name="workflows" type="ComponentDescriptionList" />
- <xs:element name="workflow" type="ComponentType" />
- <xs:element name="pack" type="ComponentFamilyType" />
- <xs:element name="file" type="ComponentProfileType" />
-</xs:schema>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/resources/net/sf/taverna/t2/component/registry/version.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/component/registry/version.properties b/src/main/resources/net/sf/taverna/t2/component/registry/version.properties
deleted file mode 100644
index defbd48..0000000
--- a/src/main/resources/net/sf/taverna/t2/component/registry/version.properties
+++ /dev/null
@@ -1 +0,0 @@
-version=${project.version}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/main/resources/schema.json
----------------------------------------------------------------------
diff --git a/src/main/resources/schema.json b/src/main/resources/schema.json
deleted file mode 100644
index f27da75..0000000
--- a/src/main/resources/schema.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-03/schema#",
- "id": "http://ns.taverna.org.uk/2010/activity/component.schema.json",
- "title": "Component activity configuration",
- "type": "object",
- "properties": {
- "@context": {
- "description": "JSON-LD context for interpreting the configuration as RDF",
- "required": true,
- "enum": ["http://ns.taverna.org.uk/2010/activity/component.context.json"]
- },
- "registryBase": {
- "type": "string",
- "required": true,
- "format": "uri",
- "description": "The URL of the registry containing the component family."
- },
- "familyName": {
- "type": "string",
- "required": true,
- "minLength": 1,
- "description": "The name of the component family that contains this component."
- },
- "componentName": {
- "type": "string",
- "required": true,
- "minLength": 1,
- "description": "The name of the component, unique within its family."
- },
- "componentVersion": {
- "type": "integer",
- "required": false,
- "description": "The version of the component."
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java b/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
deleted file mode 100644
index d2c6213..0000000
--- a/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package net.sf.taverna.t2.component;
-
-
-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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java b/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
deleted file mode 100644
index c4f1076..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Version;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/e15f9c85/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java b/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
deleted file mode 100644
index c27185b..0000000
--- a/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.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);
- }
-
-}
[24/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository -> taverna-component-repository-api
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/catalog/XMLSchema.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/catalog/XMLSchema.xsd b/taverna-component-repository-api/src/main/catalog/XMLSchema.xsd
new file mode 100644
index 0000000..575975b
--- /dev/null
+++ b/taverna-component-repository-api/src/main/catalog/XMLSchema.xsd
@@ -0,0 +1,2473 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+<!-- The prose copy in the structures REC is the normative -->
+<!-- version (which shouldn't differ from this one except for -->
+<!-- this comment and entity expansions, but just in case -->
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+ <xs:documentation>
+ Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within <documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ The simpleType element and all of its members are defined
+ towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+ <xs:annotation>
+ <xs:documentation>
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+ </xs:documentation>
+ </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:group ref="xs:redefinable"/>
+ <xs:element ref="xs:element"/>
+ <xs:element ref="xs:attribute"/>
+ <xs:element ref="xs:notation"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="redefinable">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which can self-redefine (see <redefine> below).</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:simpleType"/>
+ <xs:element ref="xs:complexType"/>
+ <xs:element ref="xs:group"/>
+ <xs:element ref="xs:attributeGroup"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="qualified"/>
+ <xs:enumeration value="unqualified"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:reducedDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="typeDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="fullDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:typeDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:include"/>
+ <xs:element ref="xs:import"/>
+ <xs:element ref="xs:redefine"/>
+ <xs:element ref="xs:annotation"/>
+ </xs:choice>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="xs:schemaTop"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="version" type="xs:token"/>
+ <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
+ <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+ <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:key name="element">
+ <xs:selector xpath="xs:element"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attribute">
+ <xs:selector xpath="xs:attribute"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="type">
+ <xs:selector xpath="xs:complexType|xs:simpleType"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="group">
+ <xs:selector xpath="xs:group"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attributeGroup">
+ <xs:selector xpath="xs:attributeGroup"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="notation">
+ <xs:selector xpath="xs:notation"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="identityConstraint">
+ <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+ <xs:annotation><xs:documentation>
+ for maxOccurs</xs:documentation></xs:annotation>
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+ <xs:annotation><xs:documentation>
+ for all particles</xs:documentation></xs:annotation>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+ <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+ <xs:annotation><xs:documentation>
+ for element, group and attributeGroup,
+ which both define and reference</xs:documentation></xs:annotation>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+ <xs:annotation>
+ <xs:documentation>
+ 'complexType' uses this</xs:documentation></xs:annotation>
+ <xs:choice>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:group>
+
+
+
+ <xs:group name="nestedParticle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="particle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="attribute">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="use" use="optional" default="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="prohibited"/>
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelAttribute">
+ <xs:complexContent>
+ <xs:restriction base="xs:attribute">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="use" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="attribute" type="xs:attribute"/>
+ <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ </xs:choice>
+ <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+ <xs:choice>
+ <xs:element ref="xs:simpleContent"/>
+ <xs:element ref="xs:complexContent"/>
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent></xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:complexTypeModel"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Will be restricted to required or forbidden</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:derivationSet"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="block" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="restrictionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:group ref="xs:typeDefParticle"/>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:complexRestrictionType"/>
+ <xs:element name="extension" type="xs:extensionType"/>
+ </xs:choice>
+ <xs:attribute name="mixed" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Overrides any setting on complexType parent.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:extensionType">
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ No typeDefParticle group reference</xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+ <xs:element name="extension" type="xs:simpleExtensionType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+ </xs:annotation>
+ </xs:element>
+
+
+ <xs:simpleType name="blockSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="substitution"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.</xs:documentation>
+ </xs:annotation>
+
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="substitutionGroup" type="xs:QName"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:blockSet"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="substitutionGroup" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ group type for explicit groups, named top-level groups and
+ group references</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="realGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="all">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:all">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+ <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+ <xs:annotation>
+ <xs:documentation>
+ group type for the three kinds of group</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExplicitGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="allModel">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint</xs:documentation>
+ </xs:annotation>
+ <xs:element name="element" type="xs:narrowMaxMin"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+
+ <xs:complexType name="narrowMaxMin">
+ <xs:annotation>
+ <xs:documentation>restricted max/min</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:localElement">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="all">
+ <xs:annotation>
+ <xs:documentation>
+ Only elements allowed inside</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+ <xs:attribute name="processContents" use="optional" default="strict">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="lax"/>
+ <xs:enumeration value="strict"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'</xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively</xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ <xs:enumeration value="##other"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:attrDecls"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedAttributeGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:annotation"/>
+ <xs:group ref="xs:redefinable"/>
+ </xs:choice>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:anyURI"/>
+ <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element ref="xs:selector"/>
+ <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+ <xs:annotation>
+ <xs:documentation>The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:unique"/>
+ <xs:element ref="xs:key"/>
+ <xs:element ref="xs:keyref"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:keybase">
+ <xs:attribute name="refer" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="public" type="xs:public"/>
+ <xs:attribute name="system" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ A public identifier, per ISO 8879</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:appinfo"/>
+ <xs:element ref="xs:documentation"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+
+ <xs:complexType name="anyType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+ </xs:documentation>
+
+ <xs:documentation>
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="string" id="string">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#string"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="preserve" id="string.preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="boolean" id="boolean">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="boolean.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="float" id="float">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#float"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="float.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="double" id="double">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#double"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="double.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="decimal" id="decimal">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="totalDigits"/>
+ <hfp:hasFacet name="fractionDigits"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="decimal.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="duration" id="duration">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="duration.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="dateTime.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="time" id="time">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#time"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="time.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="date" id="date">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#date"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="date.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYearMonth" id="gYearMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYearMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYear" id="gYear">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYear.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonthDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gDay" id="gDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="hexBinary" id="hexBinary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="hexBinary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="base64Binary" id="base64Binary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="base64Binary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="anyURI" id="anyURI">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="anyURI.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="QName" id="QName">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="QName.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NOTATION" id="NOTATION">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+ <xs:documentation>
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="NOTATION.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ Now the derived primitive types
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="normalizedString" id="normalizedString">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:whiteSpace value="replace"
+ id="normalizedString.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="token" id="token">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#token"/>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="language" id="language">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#language"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern
+ value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
+ id="language.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.ietf.org/rfc/rfc3066.txt">
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREFS" id="IDREFS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:IDREF"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="IDREFS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITIES" id="ENTITIES">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:ENTITY"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="ENTITIES.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\c+" id="NMTOKEN.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+ pattern matches production 7 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:NMTOKEN"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="NMTOKENS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Name" id="Name">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\i\c*" id="Name.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Name">
+ pattern matches production 5 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NCName" id="NCName">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:Name">
+ <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+ pattern matches production 4 from the Namespaces in XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ID" id="ID">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREF" id="IDREF">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITY" id="ENTITY">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="integer" id="integer">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+ </xs:annotation>
+ <xs:restriction base="xs:decimal">
+ <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+ <xs:pattern value="[\-+]?[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="negativeInteger" id="negativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonPositiveInteger">
+ <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="long" id="long">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#long"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+ <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="int" id="int">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#int"/>
+ </xs:annotation>
+ <xs:restriction base="xs:long">
+ <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+ <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="short" id="short">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#short"/>
+ </xs:annotation>
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="-32768" id="short.minInclusive"/>
+ <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="byte" id="byte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="-128" id="byte.minInclusive"/>
+ <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedLong" id="unsignedLong">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:maxInclusive value="18446744073709551615"
+ id="unsignedLong.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedInt" id="unsignedInt">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedLong">
+ <xs:maxInclusive value="4294967295"
+ id="unsignedInt.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedShort" id="unsignedShort">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedInt">
+ <xs:maxInclusive value="65535"
+ id="unsignedShort.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedByte" id="unsignedByte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger" id="positiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="substitution"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+ <xs:choice>
+ <xs:element ref="xs:restriction"/>
+ <xs:element ref="xs:list"/>
+ <xs:element ref="xs:union"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {restriction, union, list}
+ </xs:documentation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="simpleType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleDerivation"/>
+ <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Can be restricted to required or forbidden
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required"
+ type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Required at the top level
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited">
+ <xs:annotation>
+ <xs:documentation>
+ Forbidden when nested
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="facets">
+ <xs:annotation>
+ <xs:documentation>
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:minExclusive"/>
+ <xs:element ref="xs:minInclusive"/>
+ <xs:element ref="xs:maxExclusive"/>
+ <xs:element ref="xs:maxInclusive"/>
+ <xs:element ref="xs:totalDigits"/>
+ <xs:element ref="xs:fractionDigits"/>
+ <xs:element ref="xs:length"/>
+ <xs:element ref="xs:minLength"/>
+ <xs:element ref="xs:maxLength"/>
+ <xs:element ref="xs:enumeration"/>
+ <xs:element ref="xs:whiteSpace"/>
+ <xs:element ref="xs:pattern"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="simpleRestrictionModel">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="restriction" id="restriction">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ <xs:attribute name="base" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="list" id="list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-list">
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="union" id="union">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-union">
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="memberTypes" use="optional">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="facet">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="value" use="required"/>
+ <xs:attribute name="fixed" type="xs:boolean" use="optional"
+ default="false"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="noFixedFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="fixed" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="numFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="totalDigits" id="totalDigits">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:numFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="length" id="length" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minLength" id="minLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="whiteSpace" id="whiteSpace">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="preserve"/>
+ <xs:enumeration value="replace"/>
+ <xs:enumeration value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="pattern" id="pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:noFixedFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/catalog/catalog.xml b/taverna-component-repository-api/src/main/catalog/catalog.xml
new file mode 100644
index 0000000..e61eda5
--- /dev/null
+++ b/taverna-component-repository-api/src/main/catalog/catalog.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="XMLSchema.xsd" />
+ <public publicId="http://www.w3.org/2001/XMLSchema" uri="XMLSchema.xsd" />
+ <system systemId="http://www.w3.org/2001/xml.xsd" uri="xml.xsd" />
+ <public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd" />
+</catalog>
\ No newline at end of file
[49/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/localworld/LocalWorld.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/localworld/LocalWorld.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/localworld/LocalWorld.java
deleted file mode 100644
index 4e2422b..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/localworld/LocalWorld.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.localworld;
-
-import static com.hp.hpl.jena.rdf.model.ModelFactory.createOntologyModel;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.createTurtle;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.populateModelFromString;
-import static org.apache.log4j.Logger.getLogger;
-
-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 uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.rdf.model.Resource;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentDefaults.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentDefaults.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentDefaults.java
deleted file mode 100644
index b507f4f..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentDefaults.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.sf.taverna.t2.component.preference;
-
-import java.io.File;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import uk.org.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
deleted file mode 100644
index 0645c14..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/preference/ComponentPreference.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.preference;
-
-import static net.sf.taverna.t2.component.preference.ComponentDefaults.REGISTRY_LIST;
-import static net.sf.taverna.t2.component.preference.ComponentDefaults.getDefaultProperties;
-import static org.apache.commons.lang.StringUtils.join;
-import static org.apache.log4j.Logger.getLogger;
-
-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 org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Registry;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentAction.java
deleted file mode 100644
index 3536ebe..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.workbench.models.graph.GraphController;
-import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraph;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-@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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
deleted file mode 100644
index 81f3cc7..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentActivityConfigurationBean.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package net.sf.taverna.t2.component.ui;
-
-import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
-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 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 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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.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 (org.apache.taverna.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentConstants.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentConstants.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentConstants.java
deleted file mode 100644
index 51ad9e0..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/ComponentConstants.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
deleted file mode 100644
index 169b170..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigurationPanel.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package net.sf.taverna.t2.component.ui.config;
-
-import static java.awt.event.ItemEvent.SELECTED;
-import static net.sf.taverna.t2.component.ui.util.Utils.SHORT_STRING;
-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 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 net.sf.taverna.t2.component.ui.panel.ComponentListCellRenderer;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-
-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 uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-@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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
deleted file mode 100644
index e6c46b9..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/config/ComponentConfigureAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package net.sf.taverna.t2.component.ui.config;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import org.apache.taverna.component.api.ComponentFactory;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-@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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
deleted file mode 100644
index a625f29..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthCheckExplainer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.file;
-
-import static java.util.Collections.sort;
-import static net.sf.taverna.t2.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.getDisplayName;
-
-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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import net.sf.taverna.t2.component.ui.util.ComponentHealthCheck;
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
deleted file mode 100644
index 3ae26c4..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentDataflowHealthChecker.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.file;
-
-import static net.sf.taverna.t2.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
-import static net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.checkComponent;
-import static net.sf.taverna.t2.visit.VisitReport.Status.SEVERE;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.component.ui.util.ComponentHealthCheck;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-
-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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.Workflow;
-
-/**
- * @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;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
deleted file mode 100644
index 4e200f3..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentOpener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.file;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-
-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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
deleted file mode 100644
index c2db36c..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/ComponentSaver.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.checkComponent;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider;
-import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
-
-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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.validation.ValidationReport;
-import uk.org.taverna.scufl2.validation.structural.StructuralValidator;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
deleted file mode 100644
index 60da60f..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/file/FileManagerObserver.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.StartupSPI;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphController;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-
-import org.apache.batik.swing.JSVGCanvas;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-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(
- "net.sf.taverna.t2.component.registry.Component", COLOR);
- colours.setPreferredColour(
- "net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
deleted file mode 100644
index 510a910..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/AbstractContextComponentMenuAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.sf.taverna.t2.component.ui.menu;
-
-import java.net.URI;
-
-import org.apache.taverna.component.api.config.ComponentConfig;
-
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
deleted file mode 100644
index ca7c88d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentConfigureMenuAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.sf.taverna.t2.component.ui.menu;
-
-import static javax.swing.Action.NAME;
-import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.component.api.ComponentFactory;
-
-import uk.org.taverna.commons.services.ServiceRegistry;
-import net.sf.taverna.t2.component.ui.config.ComponentConfigureAction;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentMenu.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentMenu.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentMenu.java
deleted file mode 100644
index 25a2dc0..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentMenu.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu;
-
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentSection.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentSection.java
deleted file mode 100644
index 154d953..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ComponentSection.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreationDialog.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreationDialog.java
deleted file mode 100644
index 6c5d5be..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreationDialog.java
+++ /dev/null
@@ -1,628 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.uniqueName;
-import static org.apache.log4j.Logger.getLogger;
-import static uk.org.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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.Named;
-import uk.org.taverna.scufl2.api.common.NamedSet;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.BlockingControlLink;
-import uk.org.taverna.scufl2.api.core.ControlLink;
-import uk.org.taverna.scufl2.api.core.DataLink;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.ProcessorPort;
-import uk.org.taverna.scufl2.api.port.ReceiverPort;
-import uk.org.taverna.scufl2.api.port.SenderPort;
-import uk.org.taverna.scufl2.api.profiles.Profile;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreatorMenuAction.java
deleted file mode 100644
index e2fc5cd..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/NestedWorkflowCreatorMenuAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowActivityIcon;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
deleted file mode 100644
index a98af8d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-import java.net.MalformedURLException;
-
-import net.sf.taverna.t2.component.ui.ComponentAction;
-import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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;
- }
-}
[34/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..e8197c1
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
@@ -0,0 +1,44 @@
+package org.apache.taverna.component.registry.local;
+
+import java.io.File;
+import java.net.URL;
+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 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/fb982e2f/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
new file mode 100644
index 0000000..87f19d3
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
@@ -0,0 +1,93 @@
+/**
+ *
+ */
+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 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 uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..0fe6304
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
@@ -0,0 +1,637 @@
+package org.apache.taverna.component.registry.standard;
+
+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 org.apache.taverna.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 net.sf.taverna.t2.security.credentialmanager.CMException;
+import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+import net.sf.taverna.t2.security.credentialmanager.UsernamePassword;
+
+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 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/fb982e2f/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
new file mode 100644
index 0000000..7109bec
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
@@ -0,0 +1,221 @@
+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 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 uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..ff02a33
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
@@ -0,0 +1,133 @@
+package org.apache.taverna.component.registry.standard;
+
+import static org.apache.taverna.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 uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..ddb87c0
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
@@ -0,0 +1,58 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.component.api.License;
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..cade980
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
@@ -0,0 +1,103 @@
+package org.apache.taverna.component.registry.standard;
+
+import static org.apache.taverna.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;
+
+/**
+ * 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/fb982e2f/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
new file mode 100644
index 0000000..b8d46f1
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
@@ -0,0 +1,469 @@
+package org.apache.taverna.component.registry.standard;
+
+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 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 net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+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/fb982e2f/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
new file mode 100644
index 0000000..04075ad
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
@@ -0,0 +1,66 @@
+package org.apache.taverna.component.registry.standard;
+
+import static org.apache.taverna.component.registry.standard.NewComponentRegistry.jaxbContext;
+import static org.apache.taverna.component.registry.standard.NewComponentRegistry.logger;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+
+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 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/fb982e2f/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
new file mode 100644
index 0000000..74b9496
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
@@ -0,0 +1,136 @@
+package org.apache.taverna.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 org.apache.taverna.component.api.SharingPolicy;
+import org.apache.taverna.component.registry.api.Permissions;
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..4b6fe39
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
@@ -0,0 +1,25 @@
+package org.apache.taverna.component.registry.standard.annotations;
+
+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 {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..ca6704f
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * Miscellaneous annotations on other parts of the component engine.
+ *
+ * @author Donal Fellows
+ */
+package org.apache.taverna.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..43a53f7
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * 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
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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
new file mode 100644
index 0000000..2e886de
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
@@ -0,0 +1,91 @@
+package org.apache.taverna.component.utils;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.WeakHashMap;
+
+import uk.org.taverna.scufl2.api.annotation.Annotation;
+import uk.org.taverna.scufl2.api.common.Child;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.common.URITools;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.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/fb982e2f/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
new file mode 100644
index 0000000..61fecbc
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
@@ -0,0 +1,118 @@
+package org.apache.taverna.component.utils;
+
+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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.registry.api.Description;
+
+import net.sf.taverna.t2.workflowmodel.Dataflow;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
+import uk.org.taverna.platform.execution.api.WorkflowCompiler;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+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();
+ }
+
+ 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/fb982e2f/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 2851b83..cc5edd5 100644
--- a/taverna-component-activity/src/main/resources/EmptyProfile.xml
+++ b/taverna-component-activity/src/main/resources/EmptyProfile.xml
@@ -4,7 +4,7 @@
xmlns="http://ns.taverna.org.uk/2012/component/profile"
xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile ComponentProfile.xsd">
- <id>net.sf.taverna.t2.component.profile.empty</id>
+ <id>org.apache.taverna.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/fb982e2f/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 4746ede..f1f47a6 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
@@ -7,16 +7,16 @@
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
<bean id="ComponentLocalHealthChecker"
- class="net.sf.taverna.t2.component.ComponentActivityLocalChecker" />
+ class="org.apache.taverna.component.ComponentActivityLocalChecker" />
<bean id="ComponentUpgradeHealthChecker"
- class="net.sf.taverna.t2.component.ComponentActivityUpgradeChecker">
+ class="org.apache.taverna.component.ComponentActivityUpgradeChecker">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="baseProfileLocator" class="net.sf.taverna.t2.component.profile.BaseProfileLocator">
+ <bean id="baseProfileLocator" class="org.apache.taverna.component.profile.BaseProfileLocator">
<property name="appConfig" ref="app-config" />
</bean>
- <bean id="componentActivityFactory" class="net.sf.taverna.t2.component.ComponentActivityFactory">
+ <bean id="componentActivityFactory" class="org.apache.taverna.component.ComponentActivityFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="dataflowCache" ref="cache" />
<property name="edits" ref="edits" />
@@ -24,32 +24,32 @@
</bean>
<bean id="networkRegistry"
- class="net.sf.taverna.t2.component.registry.standard.NewComponentRegistryFactory">
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory">
+ class="org.apache.taverna.component.registry.local.LocalComponentRegistryFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="systemUtils" ref="systemUtil" />
</bean>
- <bean id="componentUtil" class="net.sf.taverna.t2.component.registry.ComponentUtil">
+ <bean id="componentUtil" class="org.apache.taverna.component.registry.ComponentUtil">
<property name="networkLocator" ref="networkRegistry" />
<property name="fileLocator" ref="fileRegistry" />
<property name="baseLocator" ref="baseProfileLocator" />
</bean>
- <bean id="cache" class="net.sf.taverna.t2.component.registry.ComponentImplementationCache">
+ <bean id="cache" class="org.apache.taverna.component.registry.ComponentImplementationCache">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="systemUtil" class="net.sf.taverna.t2.component.utils.SystemUtils">
+ <bean id="systemUtil" class="org.apache.taverna.component.utils.SystemUtils">
<property name="appConfig" ref="app-config" />
<property name="workflowBundler" ref="workflowBundleIO" />
<property name="compilers" ref="compilers" />
</bean>
- <bean id="annotationUtil" class="net.sf.taverna.t2.component.utils.AnnotationUtils" />
+ <bean id="annotationUtil" class="org.apache.taverna.component.utils.AnnotationUtils" />
<osgi:service ref="ComponentLocalHealthChecker"
interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
@@ -65,6 +65,6 @@
<osgi:reference id="credentialManager"
interface="net.sf.taverna.t2.security.credentialmanager.CredentialManager" />
<osgi:reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" />
- <osgi:reference id="workflowBundleIO" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleIO" />
+ <osgi:reference id="workflowBundleIO" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleIO" />
<osgi:list id="compilers" interface="uk.org.taverna.platform.execution.api.WorkflowCompiler" />
</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/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 ba06860..0a8dc83 100644
--- a/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
+++ b/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
@@ -7,7 +7,7 @@
<xs:annotation>
<xs:appinfo>
<jxb:schemaBindings>
- <jxb:package name="net.sf.taverna.t2.component.registry.api" />
+ <jxb:package name="org.apache.taverna.component.registry.api" />
</jxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
[11/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
taverna-component-activity/
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/e15f9c85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/e15f9c85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/e15f9c85
Branch: refs/heads/master
Commit: e15f9c8505eb5f0bf3ae7b08790635a1067cbefd
Parents: 481ad43
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:19:21 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:19:21 2015 +0000
----------------------------------------------------------------------
.travis.yml | 1 -
README.md | 7 -
pom.xml | 190 --
src/main/catalog/XMLSchema.xsd | 2473 ------------------
src/main/catalog/catalog.xml | 7 -
src/main/catalog/xml.xsd | 287 --
.../taverna/t2/component/ComponentActivity.java | 152 --
.../ComponentActivityConfigurationBean.java | 145 -
.../t2/component/ComponentActivityFactory.java | 125 -
.../ComponentActivityLocalChecker.java | 52 -
.../ComponentActivityUpgradeChecker.java | 69 -
.../t2/component/ComponentExceptionFactory.java | 27 -
.../t2/component/ComponentHealthCheck.java | 24 -
.../ComponentImplementationException.java | 26 -
.../sf/taverna/t2/component/ProxyCallback.java | 250 --
.../component/profile/ActivityProfileImpl.java | 54 -
.../component/profile/BaseProfileLocator.java | 145 -
.../component/profile/ComponentProfileImpl.java | 686 -----
.../t2/component/profile/PortProfileImpl.java | 59 -
.../profile/SemanticAnnotationProfileImpl.java | 177 --
.../t2/component/registry/ClientVersion.java | 33 -
.../t2/component/registry/Component.java | 161 --
.../t2/component/registry/ComponentFamily.java | 162 --
.../registry/ComponentImplementationCache.java | 65 -
.../component/registry/ComponentRegistry.java | 245 --
.../t2/component/registry/ComponentUtil.java | 113 -
.../t2/component/registry/ComponentVersion.java | 65 -
.../ComponentVersionIdentification.java | 196 --
.../registry/local/LocalComponent.java | 134 -
.../registry/local/LocalComponentFamily.java | 141 -
.../registry/local/LocalComponentRegistry.java | 205 --
.../local/LocalComponentRegistryFactory.java | 45 -
.../registry/local/LocalComponentVersion.java | 94 -
.../t2/component/registry/standard/Client.java | 637 -----
.../registry/standard/NewComponent.java | 220 --
.../registry/standard/NewComponentFamily.java | 132 -
.../registry/standard/NewComponentLicense.java | 58 -
.../registry/standard/NewComponentProfile.java | 103 -
.../registry/standard/NewComponentRegistry.java | 469 ----
.../standard/NewComponentRegistryFactory.java | 66 -
.../t2/component/registry/standard/Policy.java | 135 -
.../registry/standard/annotations/Unused.java | 25 -
.../standard/annotations/package-info.java | 6 -
.../registry/standard/package-info.java | 5 -
.../t2/component/utils/AnnotationUtils.java | 91 -
.../taverna/t2/component/utils/SystemUtils.java | 117 -
src/main/resources/BaseProfile.xml | 123 -
src/main/resources/EmptyProfile.xml | 12 -
.../spring/component-activity-context.xml | 70 -
src/main/resources/NewMyExperimentSchema.xsd | 454 ----
.../t2/component/registry/version.properties | 1 -
src/main/resources/schema.json | 36 -
.../t2/component/ComponentActivityTest.java | 103 -
.../component/registry/ComponentFamilyTest.java | 125 -
.../registry/ComponentRegistryTest.java | 184 --
.../t2/component/registry/ComponentTest.java | 114 -
.../registry/ComponentVersionTest.java | 97 -
.../taverna/t2/component/registry/Harness.java | 11 -
.../local/LocalComponentFamilyTest.java | 43 -
.../local/LocalComponentRegistryTest.java | 61 -
.../registry/local/LocalComponentTest.java | 43 -
.../local/LocalComponentVersionTest.java | 43 -
.../registry/local/RegistrySupport.java | 24 -
.../standard/NewComponentFamilyTest.java | 25 -
.../standard/NewComponentRegistryTest.java | 75 -
.../registry/standard/NewComponentTest.java | 25 -
.../standard/NewComponentVersionTest.java | 25 -
.../registry/standard/RegistrySupport.java | 33 -
.../net/sf/taverna/t2/util/AnnotationTest.java | 31 -
...rity.credentialmanager.CredentialProviderSPI | 1 -
src/test/resources/ValidationComponent.xml | 62 -
src/test/resources/beanshell_test.t2flow | 113 -
src/test/resources/hello_anyone.wfbundle | Bin 10087 -> 0 bytes
taverna-component-activity/pom.xml | 190 ++
.../src/main/catalog/XMLSchema.xsd | 2473 ++++++++++++++++++
.../src/main/catalog/catalog.xml | 7 +
.../src/main/catalog/xml.xsd | 287 ++
.../taverna/t2/component/ComponentActivity.java | 152 ++
.../ComponentActivityConfigurationBean.java | 145 +
.../t2/component/ComponentActivityFactory.java | 125 +
.../ComponentActivityLocalChecker.java | 52 +
.../ComponentActivityUpgradeChecker.java | 69 +
.../t2/component/ComponentExceptionFactory.java | 27 +
.../t2/component/ComponentHealthCheck.java | 24 +
.../ComponentImplementationException.java | 26 +
.../sf/taverna/t2/component/ProxyCallback.java | 250 ++
.../component/profile/ActivityProfileImpl.java | 54 +
.../component/profile/BaseProfileLocator.java | 145 +
.../component/profile/ComponentProfileImpl.java | 686 +++++
.../t2/component/profile/PortProfileImpl.java | 59 +
.../profile/SemanticAnnotationProfileImpl.java | 177 ++
.../t2/component/registry/ClientVersion.java | 33 +
.../t2/component/registry/Component.java | 161 ++
.../t2/component/registry/ComponentFamily.java | 162 ++
.../registry/ComponentImplementationCache.java | 65 +
.../component/registry/ComponentRegistry.java | 245 ++
.../t2/component/registry/ComponentUtil.java | 113 +
.../t2/component/registry/ComponentVersion.java | 65 +
.../ComponentVersionIdentification.java | 196 ++
.../registry/local/LocalComponent.java | 134 +
.../registry/local/LocalComponentFamily.java | 141 +
.../registry/local/LocalComponentRegistry.java | 205 ++
.../local/LocalComponentRegistryFactory.java | 45 +
.../registry/local/LocalComponentVersion.java | 94 +
.../t2/component/registry/standard/Client.java | 637 +++++
.../registry/standard/NewComponent.java | 220 ++
.../registry/standard/NewComponentFamily.java | 132 +
.../registry/standard/NewComponentLicense.java | 58 +
.../registry/standard/NewComponentProfile.java | 103 +
.../registry/standard/NewComponentRegistry.java | 469 ++++
.../standard/NewComponentRegistryFactory.java | 66 +
.../t2/component/registry/standard/Policy.java | 135 +
.../registry/standard/annotations/Unused.java | 25 +
.../standard/annotations/package-info.java | 6 +
.../registry/standard/package-info.java | 5 +
.../t2/component/utils/AnnotationUtils.java | 91 +
.../taverna/t2/component/utils/SystemUtils.java | 117 +
.../src/main/resources/BaseProfile.xml | 123 +
.../src/main/resources/EmptyProfile.xml | 12 +
.../spring/component-activity-context.xml | 70 +
.../main/resources/NewMyExperimentSchema.xsd | 454 ++++
.../t2/component/registry/version.properties | 1 +
.../src/main/resources/schema.json | 36 +
.../t2/component/ComponentActivityTest.java | 103 +
.../component/registry/ComponentFamilyTest.java | 125 +
.../registry/ComponentRegistryTest.java | 184 ++
.../t2/component/registry/ComponentTest.java | 114 +
.../registry/ComponentVersionTest.java | 97 +
.../taverna/t2/component/registry/Harness.java | 11 +
.../local/LocalComponentFamilyTest.java | 43 +
.../local/LocalComponentRegistryTest.java | 61 +
.../registry/local/LocalComponentTest.java | 43 +
.../local/LocalComponentVersionTest.java | 43 +
.../registry/local/RegistrySupport.java | 24 +
.../standard/NewComponentFamilyTest.java | 25 +
.../standard/NewComponentRegistryTest.java | 75 +
.../registry/standard/NewComponentTest.java | 25 +
.../standard/NewComponentVersionTest.java | 25 +
.../registry/standard/RegistrySupport.java | 33 +
.../net/sf/taverna/t2/util/AnnotationTest.java | 31 +
...rity.credentialmanager.CredentialProviderSPI | 1 +
.../src/test/resources/ValidationComponent.xml | 62 +
.../src/test/resources/beanshell_test.t2flow | 113 +
.../src/test/resources/hello_anyone.wfbundle | Bin 0 -> 10087 bytes
144 files changed, 10605 insertions(+), 10613 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index dff5f3a..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1 +0,0 @@
-language: java
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
deleted file mode 100644
index 4f059a0..0000000
--- a/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Taverna Workflow System
-====
-Component Activity: data model and execution implementation
-----
-This code was previously hosted at [Google Code](http://taverna.googlecode.com/svn/taverna/engine/net.sf.taverna.t2.activities/).
-
-See [this sibling repository](https://github.com/taverna/taverna-component-activity-ui) for the GUI for editing and working with Components.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 01d00ca..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>3.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>component-activity</artifactId>
- <version>${t2.activities.version}</version>
- <name>Taverna Component activity</name>
- <packaging>bundle</packaging>
- <properties>
- <jena.core.version>2.11.1</jena.core.version>
- </properties>
-
- <scm>
- <connection>scm:git:https://github.com/taverna/taverna-component-activity.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/taverna/taverna-component-activity.git</developerConnection>
- <url>https://github.com/taverna/taverna-component-activity/</url>
- <tag>HEAD</tag>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>net.sf.taverna.component</groupId>
- <artifactId>component-repository</artifactId>
- <version>${t2.activities.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-api</artifactId>
- <version>${t2.core.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-api</artifactId>
- <version>${t2.core.version}</version>
- </dependency>
- <dependency>
- <!-- FIXME: Avoid -->
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-impl</artifactId>
- <version>${t2.core.version}</version>
- </dependency>
- <dependency>
- <groupId>uk.org.taverna.platform</groupId>
- <artifactId>taverna-execution-api</artifactId>
- <version>${platform.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>dataflow-activity</artifactId>
- <version>${t2.activities.version}</version>
- </dependency>
- <dependency>
- <groupId>uk.org.taverna.configuration</groupId>
- <artifactId>taverna-app-configuration-api</artifactId>
- <version>${taverna.configuration.version}</version>
- </dependency>
- <dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-api</artifactId>
- <version>${scufl2.version}</version>
- </dependency>
- <dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-t2flow</artifactId>
- <version>${scufl2.version}</version>
- </dependency>
- <!--
- <dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-annotation</artifactId>
- <version>${scufl2.version}</version>
- </dependency>
- -->
-
- <dependency>
- <groupId>org.jdom</groupId>
- <artifactId>com.springsource.org.jdom</artifactId>
- <version>${jdom.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
- <!--
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>com.springsource.org.apache.httpcomponents.httpclient</artifactId>
- <version>${apache.httpclient.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>com.springsource.org.apache.httpcomponents.httpclient-cache</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>com.springsource.org.apache.httpcomponents.httpmime</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
- <version>${commons.httpclient.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.clerezza.ext</groupId>
- <artifactId>com.hp.hpl.jena</artifactId>
- <version>0.6-incubating</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.security</groupId>
- <artifactId>credential-manager</artifactId>
- <version>${t2.security.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>activity-test-utils</artifactId>
- <version>${t2.activities.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository</url>
- </repository>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- <id>mygrid-snapshot-repository</id>
- <name>myGrid Snapshot Repository</name>
- <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
- </repository>
- </repositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.8.3</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <catalog>${basedir}/src/main/catalog/catalog.xml</catalog>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
[41/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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
new file mode 100644
index 0000000..57eb466
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.panel;
+
+import org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..0e5b928
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
@@ -0,0 +1,204 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..7c69a42
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
@@ -0,0 +1,82 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.panel;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..a4a7910
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
@@ -0,0 +1,87 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..7af5969
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.panel;
+
+import org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..6df902f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
@@ -0,0 +1,123 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.Registry;
+import org.apache.taverna.component.ui.preference.ComponentPreference;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..2e53219
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
@@ -0,0 +1,243 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..2544f40
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (C) 2013 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..85a5e4f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
@@ -0,0 +1,39 @@
+package org.apache.taverna.component.ui.preference;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import uk.org.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/43334c1d/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
new file mode 100644
index 0000000..ff7bfe6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
@@ -0,0 +1,128 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.ComponentFactory;
+import org.apache.taverna.component.api.Registry;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.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/43334c1d/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
new file mode 100644
index 0000000..ff29d32
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
@@ -0,0 +1,282 @@
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.helper.Helper.showHelp;
+import static org.apache.log4j.Logger.getLogger;
+import static org.apache.taverna.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 net.sf.taverna.t2.lang.ui.DeselectingButton;
+import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
+
+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;
+
+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) {
+ 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/43334c1d/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
new file mode 100644
index 0000000..b314733
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
@@ -0,0 +1,46 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.preference;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.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/43334c1d/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
new file mode 100644
index 0000000..f9f78c0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
@@ -0,0 +1,117 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.ui.DeselectingButton;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..a523c44
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.apache.taverna.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 org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..a287d1e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+package org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..2f98978
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
@@ -0,0 +1,156 @@
+package org.apache.taverna.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 java.net.URI;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
+
+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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+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/43334c1d/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
new file mode 100644
index 0000000..1e30e7b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
@@ -0,0 +1,33 @@
+package org.apache.taverna.component.ui.serviceprovider;
+
+import static org.apache.taverna.component.ui.serviceprovider.Service.COMPONENT_ACTIVITY_URI;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..25ea0c1
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
@@ -0,0 +1,218 @@
+package org.apache.taverna.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 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 net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
+import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
+
+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 uk.org.taverna.scufl2.api.common.Visitor;
+import uk.org.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;
+
+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/43334c1d/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
new file mode 100644
index 0000000..9d8e82f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
@@ -0,0 +1,69 @@
+package org.apache.taverna.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 java.net.URL;
+
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+
+import uk.org.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/43334c1d/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
new file mode 100644
index 0000000..d363e6f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
@@ -0,0 +1,8 @@
+package org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..ee71e07
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
@@ -0,0 +1,32 @@
+package org.apache.taverna.component.ui.util;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..3743c79
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
@@ -0,0 +1,65 @@
+package org.apache.taverna.component.ui.util;
+
+import static org.apache.log4j.Logger.getLogger;
+
+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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.Visitor;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor;
+
+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/43334c1d/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
new file mode 100644
index 0000000..fc36f4a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
@@ -0,0 +1,126 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.util;
+
+import static org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.Named;
+import uk.org.taverna.scufl2.api.common.NamedSet;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+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;
+ }
+}
[30/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.api.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
index 003529e..e6077fa 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
@@ -25,13 +25,13 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
index fe4a3ce..f9a8fbb 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
@@ -10,9 +10,10 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Registry;
+import org.apache.taverna.component.api.Version;
+
import net.sf.taverna.t2.component.preference.ComponentPreference;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
index 5482b4e..8c81a1d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
@@ -13,13 +13,13 @@ import java.util.List;
import javax.swing.JPanel;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Registry;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
index 81519e2..d03a0b0 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
@@ -3,7 +3,7 @@
*/
package net.sf.taverna.t2.component.ui.panel;
-import net.sf.taverna.t2.component.api.Registry;
+import org.apache.taverna.component.api.Registry;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
index c864c20..0308d15 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
@@ -22,12 +22,12 @@ import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import net.sf.taverna.t2.component.api.Registry;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.Registry;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
index 8c35a2d..f68500e 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
@@ -24,13 +24,13 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
index 52264b2..1519798 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
@@ -38,13 +38,13 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.SharingPolicy;
import net.sf.taverna.t2.lang.observer.Observable;
import net.sf.taverna.t2.lang.observer.Observer;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
index 5228f5f..c0a278a 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
@@ -30,14 +30,14 @@ import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.lang.ui.DeselectingButton;
import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
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;
public class ComponentPreferencePanel extends JPanel {
private static final String BAD_URL_MESSAGE = "Invalid URL";
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
index 5458bfa..1aa6084 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
@@ -11,7 +11,7 @@ import java.util.TreeMap;
import javax.swing.table.DefaultTableModel;
-import net.sf.taverna.t2.component.api.Registry;
+import org.apache.taverna.component.api.Registry;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
index 25211c6..35a945d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
@@ -1,12 +1,12 @@
package net.sf.taverna.t2.component.ui.serviceprovider;
import static java.util.Arrays.asList;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
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 java.net.URI;
import java.net.URL;
@@ -15,14 +15,14 @@ import java.util.List;
import javax.swing.Icon;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.Version.ID;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
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 uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.configurations.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
index 932e747..60294cd 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
@@ -4,10 +4,10 @@ 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 net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
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 java.net.MalformedURLException;
import java.net.URI;
@@ -18,12 +18,6 @@ import java.util.SortedMap;
import javax.swing.Icon;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.panel.RegistryAndFamilyChooserPanel;
import net.sf.taverna.t2.component.ui.util.Utils;
@@ -32,6 +26,12 @@ import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
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 uk.org.taverna.scufl2.api.common.Visitor;
import uk.org.taverna.scufl2.api.configurations.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
index c72e8e2..9f6f52d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
@@ -1,14 +1,15 @@
package net.sf.taverna.t2.component.ui.serviceprovider;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import static net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider.providerId;
+import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import java.net.URL;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+
import uk.org.taverna.scufl2.api.configurations.Configuration;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Version;
public class ComponentServiceProviderConfig {
private URL registryBase;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
index 129332b..2a36fc3 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
@@ -5,12 +5,12 @@ import static org.apache.log4j.Logger.getLogger;
import java.util.ArrayList;
import java.util.List;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
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 uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.common.Visitor;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
index baecfbf..ebd7c36 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
@@ -8,13 +8,14 @@ import static net.sf.taverna.t2.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 uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.common.Named;
import uk.org.taverna.scufl2.api.common.NamedSet;
import uk.org.taverna.scufl2.api.configurations.Configuration;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.preference.ComponentPreference;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
index 37b4eb9..80b8640 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
@@ -1,6 +1,6 @@
package net.sf.taverna.t2.component.ui.view;
-import static net.sf.taverna.t2.component.api.config.ComponentConfig.URI;
+import static org.apache.taverna.component.api.config.ComponentConfig.URI;
import java.awt.Frame;
import java.net.MalformedURLException;
@@ -9,6 +9,8 @@ import java.util.List;
import javax.swing.Action;
+import org.apache.taverna.component.api.ComponentFactory;
+
import uk.org.taverna.commons.services.ServiceRegistry;
import uk.org.taverna.scufl2.api.activity.Activity;
import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
@@ -19,7 +21,6 @@ import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import net.sf.taverna.t2.component.api.ComponentFactory;
import net.sf.taverna.t2.component.ui.config.ComponentConfigureAction;
public class ComponentActivityContextViewFactory implements
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
index d739f3b..bf2942d 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
@@ -1,13 +1,16 @@
package net.sf.taverna.t2.component.ui.view;
-import static net.sf.taverna.t2.component.api.config.ComponentConfig.URI;
import static org.apache.log4j.Logger.getLogger;
+import static org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
import uk.org.taverna.scufl2.api.core.Workflow;
@@ -17,9 +20,6 @@ import uk.org.taverna.scufl2.api.port.OutputActivityPort;
import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
import uk.org.taverna.scufl2.api.port.Port;
import net.sf.taverna.t2.component.annotation.AbstractSemanticAnnotationContextualView;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
index 566053f..7ab8f04 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
@@ -23,7 +23,7 @@ import javax.swing.JTextArea;
import javax.swing.border.AbstractBorder;
import javax.swing.border.EmptyBorder;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.Statement;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
index 8ea5378..f81d608 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
@@ -1,11 +1,12 @@
package net.sf.taverna.t2.component.ui.view;
-import static net.sf.taverna.t2.component.api.config.ComponentConfig.URI;
+import static org.apache.taverna.component.api.config.ComponentConfig.URI;
import java.util.Arrays;
import java.util.List;
-import net.sf.taverna.t2.component.api.Version;
+import org.apache.taverna.component.api.Version;
+
import net.sf.taverna.t2.workbench.file.FileManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
index f9abc8b..acc1cc3 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
@@ -12,7 +12,8 @@ import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
-import net.sf.taverna.t2.component.api.Version;
+import org.apache.taverna.component.api.Version;
+
import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
index 025b9e1..7e87e7e 100644
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
+++ b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
@@ -10,13 +10,13 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.Set;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
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 uk.org.taverna.scufl2.api.configurations.Configuration;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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 4c08386..4c03aba 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
@@ -448,7 +448,7 @@
<osgi:service ref="componentActivityFactory"
interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
<osgi:service ref="componentUtil"
- interface="net.sf.taverna.t2.component.api.ComponentFactory" />
+ interface="org.apache.taverna.component.api.ComponentFactory" />
<osgi:reference id="app-config"
interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
@@ -461,7 +461,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="net.sf.taverna.t2.component.api.ComponentFactory" />
+ <osgi:reference id="componentFactory" interface="org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
index 7a68813..f845829 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
@@ -9,8 +9,6 @@ import java.util.Map;
import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.utils.AnnotationUtils;
@@ -27,6 +25,8 @@ import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationE
import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.profile.ExceptionHandling;
import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
index 7d04aac..e70e83f 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
@@ -1,10 +1,10 @@
package net.sf.taverna.t2.component;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
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 java.io.Serializable;
import java.net.MalformedURLException;
@@ -13,8 +13,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
@@ -23,6 +21,8 @@ import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputP
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
@@ -53,7 +53,7 @@ public class ComponentActivityConfigurationBean extends
this.cache = cache;
try {
getPorts();
- } catch (net.sf.taverna.t2.component.api.ComponentException e) {
+ } catch (org.apache.taverna.component.api.ComponentException e) {
logger.error("failed to get component realization", e);
}
}
@@ -102,7 +102,7 @@ public class ComponentActivityConfigurationBean extends
.getComponentProfile().getExceptionHandling();
if (eh != null)
outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (net.sf.taverna.t2.component.api.ComponentException e) {
+ } catch (org.apache.taverna.component.api.ComponentException e) {
logger.error("failed to get exception handling for family", e);
}
return result;
@@ -133,7 +133,7 @@ public class ComponentActivityConfigurationBean extends
/**
* @return the ports
*/
- public ActivityPortsDefinitionBean getPorts() throws net.sf.taverna.t2.component.api.ComponentException{
+ public ActivityPortsDefinitionBean getPorts() throws org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
index 670a0af..50d7ec7 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
@@ -6,8 +6,6 @@ import java.net.URI;
import java.util.HashSet;
import java.util.Set;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version.ID;
import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.utils.AnnotationUtils;
@@ -20,6 +18,8 @@ import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Version.ID;
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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
index 70fc303..fadfb4c 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
@@ -9,13 +9,13 @@ import static org.apache.log4j.Logger.getLogger;
import java.util.List;
-import net.sf.taverna.t2.component.api.ComponentException;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.visit.VisitKind;
import net.sf.taverna.t2.visit.VisitReport;
import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
import org.springframework.beans.factory.annotation.Required;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
index 75f5b21..9f3de98 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
@@ -18,9 +18,6 @@ import java.util.Set;
import javax.xml.ws.Holder;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-import net.sf.taverna.t2.component.api.profile.ExceptionReplacement;
-import net.sf.taverna.t2.component.api.profile.HandleException;
import net.sf.taverna.t2.invocation.InvocationContext;
import net.sf.taverna.t2.reference.ErrorDocument;
import net.sf.taverna.t2.reference.ErrorDocumentService;
@@ -32,6 +29,9 @@ import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCa
import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
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;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
index 92b4e51..c0f61f7 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
@@ -23,8 +23,9 @@ package net.sf.taverna.t2.component.profile;
import java.util.ArrayList;
import java.util.List;
-import net.sf.taverna.t2.component.api.profile.ActivityProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.ActivityProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
import net.sf.taverna.t2.component.api.profile.doc.Activity;
import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
index d39ee57..91786ae 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
@@ -17,8 +17,6 @@ import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import net.sf.taverna.t2.component.api.ComponentException;
-
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
@@ -26,6 +24,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 uk.org.taverna.configuration.app.ApplicationConfiguration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
index 2a37972..37bf692 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
@@ -52,15 +52,14 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.transform.stream.StreamSource;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.profile.ActivityProfile;
-import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
-import net.sf.taverna.t2.component.api.profile.PortProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
-
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 net.sf.taverna.t2.component.api.profile.doc.Activity;
import net.sf.taverna.t2.component.api.profile.doc.Ontology;
@@ -79,7 +78,7 @@ import com.hp.hpl.jena.ontology.OntProperty;
* @author David Withers
*/
public class ComponentProfileImpl implements
- net.sf.taverna.t2.component.api.profile.Profile {
+ org.apache.taverna.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;
@@ -93,7 +92,7 @@ public class ComponentProfileImpl implements
"Failed to initialize profile deserialization engine", e);
}
}
- private net.sf.taverna.t2.component.api.profile.Profile parent;
+ private org.apache.taverna.component.api.profile.Profile parent;
private Profile profileDoc;
private ExceptionHandling exceptionHandling;
private Registry parentRegistry = null;
@@ -292,7 +291,7 @@ public class ComponentProfileImpl implements
return o == null || o == this;
}
- private synchronized net.sf.taverna.t2.component.api.profile.Profile parent()
+ private synchronized org.apache.taverna.component.api.profile.Profile parent()
throws ComponentException {
if (parent == null) {
try {
@@ -462,8 +461,8 @@ public class ComponentProfileImpl implements
}
@Override
- public List<net.sf.taverna.t2.component.api.profile.ActivityProfile> getActivityProfiles() {
- List<net.sf.taverna.t2.component.api.profile.ActivityProfile> activityProfiles = new ArrayList<>();
+ public List<org.apache.taverna.component.api.profile.ActivityProfile> getActivityProfiles() {
+ List<org.apache.taverna.component.api.profile.ActivityProfile> activityProfiles = new ArrayList<>();
try {
for (Activity activity : getProfileDocument().getComponent()
.getActivity())
@@ -593,7 +592,7 @@ public class ComponentProfileImpl implements
* @author Donal Fellows
*/
final class EmptyProfile implements
- net.sf.taverna.t2.component.api.profile.Profile {
+ org.apache.taverna.component.api.profile.Profile {
@Override
public String getName() {
return "";
@@ -660,7 +659,7 @@ final class EmptyProfile implements
}
@Override
- public List<net.sf.taverna.t2.component.api.profile.ActivityProfile> getActivityProfiles() {
+ public List<org.apache.taverna.component.api.profile.ActivityProfile> getActivityProfiles() {
return emptyList();
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
index 31eb5f6..e8394f1 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
@@ -23,8 +23,9 @@ package net.sf.taverna.t2.component.profile;
import java.util.ArrayList;
import java.util.List;
-import net.sf.taverna.t2.component.api.profile.PortProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.api.profile.PortProfile;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
import net.sf.taverna.t2.component.api.profile.doc.Port;
import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
index 9961aa0..0dc2393 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
@@ -30,8 +30,8 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
import com.hp.hpl.jena.ontology.Individual;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
index 4e8ac52..e84e23d 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
@@ -28,8 +28,9 @@ import java.net.URL;
import java.util.SortedMap;
import java.util.TreeMap;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Version;
+
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
/**
@@ -39,7 +40,7 @@ import uk.org.taverna.scufl2.api.container.WorkflowBundle;
* @author David Withers
*/
public abstract class Component implements
- net.sf.taverna.t2.component.api.Component {
+ org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
index 7339b10..d37dd52 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
@@ -25,11 +25,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
/**
@@ -39,7 +40,7 @@ import uk.org.taverna.scufl2.api.container.WorkflowBundle;
* @author David Withers
*/
public abstract class ComponentFamily implements
- net.sf.taverna.t2.component.api.Family {
+ org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
index 2283295..11ab51c 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
@@ -9,10 +9,9 @@ import static org.apache.log4j.Logger.getLogger;
import java.util.Map;
import java.util.WeakHashMap;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Version;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
index 40d1346..8c24164 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
@@ -29,12 +29,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
+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;
/**
* A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
@@ -42,7 +42,7 @@ import net.sf.taverna.t2.component.api.profile.Profile;
* @author David Withers
*/
public abstract class ComponentRegistry implements
- net.sf.taverna.t2.component.api.Registry {
+ org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
index 4380d22..927d937 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
@@ -4,18 +4,18 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.ComponentFactory;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.profile.BaseProfileLocator;
import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
import net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory;
import net.sf.taverna.t2.component.registry.standard.NewComponentRegistryFactory;
+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.springframework.beans.factory.annotation.Required;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
index 8d6c443..52d7fa0 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
@@ -3,8 +3,9 @@
*/
package net.sf.taverna.t2.component.registry;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
+import org.apache.taverna.component.api.Component;
+import org.apache.taverna.component.api.ComponentException;
+
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
/**
@@ -12,7 +13,7 @@ import uk.org.taverna.scufl2.api.container.WorkflowBundle;
*
*/
public abstract class ComponentVersion implements
- net.sf.taverna.t2.component.api.Version {
+ org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
index 9115a32..68b55ac 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
@@ -5,17 +5,17 @@ package net.sf.taverna.t2.component.registry;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.Version.ID;
+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;
/**
* @author alanrw
*
*/
public class ComponentVersionIdentification implements
- net.sf.taverna.t2.component.api.Version.ID {
+ org.apache.taverna.component.api.Version.ID {
private static final long serialVersionUID = 1768548650702925916L;
private URL registryBase;
private String familyName;
@@ -32,7 +32,7 @@ public class ComponentVersionIdentification implements
}
public ComponentVersionIdentification(Registry registry, Family family,
- net.sf.taverna.t2.component.api.Component component, Integer version) {
+ org.apache.taverna.component.api.Component component, Integer version) {
this(registry.getRegistryBase(), family.getName(), component.getName(), version);
}
@@ -190,7 +190,7 @@ public class ComponentVersionIdentification implements
}
@Override
- public boolean mostlyEqualTo(net.sf.taverna.t2.component.api.Component c) {
+ public boolean mostlyEqualTo(org.apache.taverna.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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
index bfb1007..85d203d 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
@@ -12,14 +12,14 @@ import java.io.File;
import java.io.IOException;
import java.util.NoSuchElementException;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.registry.Component;
import net.sf.taverna.t2.component.utils.SystemUtils;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
index 96a32ab..fea0f88 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
@@ -12,15 +12,15 @@ import static org.apache.log4j.Logger.getLogger;
import java.io.File;
import java.io.IOException;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.registry.ComponentFamily;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.utils.SystemUtils;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
index 9fcc19a..102b448 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
@@ -13,18 +13,18 @@ import java.net.MalformedURLException;
import java.net.URI;
import java.util.Set;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
import net.sf.taverna.t2.component.registry.ComponentRegistry;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.utils.SystemUtils;
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;
/**
* 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/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
index c56fe52..0f61f48 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
@@ -6,11 +6,11 @@ import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Registry;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.utils.SystemUtils;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Registry;
import org.springframework.beans.factory.annotation.Required;
public class LocalComponentRegistryFactory {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
index 74a7389..874bc7f 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
@@ -12,11 +12,11 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
-import net.sf.taverna.t2.component.api.ComponentException;
import net.sf.taverna.t2.component.registry.ComponentVersion;
import net.sf.taverna.t2.component.utils.SystemUtils;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
import uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
index 61f9997..5b70a7d 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
@@ -38,7 +38,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import net.sf.taverna.t2.component.api.ComponentException;
import net.sf.taverna.t2.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
import net.sf.taverna.t2.component.registry.standard.annotations.Unused;
import net.sf.taverna.t2.security.credentialmanager.CMException;
@@ -47,6 +46,7 @@ import net.sf.taverna.t2.security.credentialmanager.UsernamePassword;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
index a3f9536..c33d610 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
@@ -11,11 +11,12 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.IllegalFormatException;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.SharingPolicy;
+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 net.sf.taverna.t2.component.registry.Component;
import net.sf.taverna.t2.component.registry.ComponentVersion;
import net.sf.taverna.t2.component.registry.api.ComponentType;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
index ce7107f..ab31ffd 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
@@ -4,10 +4,11 @@ import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
import java.util.List;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.profile.Profile;
+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 net.sf.taverna.t2.component.registry.ComponentFamily;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
index 02d2b3a..623d6e6 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
@@ -1,6 +1,7 @@
package net.sf.taverna.t2.component.registry.standard;
-import net.sf.taverna.t2.component.api.License;
+import org.apache.taverna.component.api.License;
+
import net.sf.taverna.t2.component.registry.api.LicenseType;
class NewComponentLicense implements License {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
index c442057..f4982db 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
@@ -5,7 +5,8 @@ import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
import java.net.MalformedURLException;
import java.net.URL;
-import net.sf.taverna.t2.component.api.ComponentException;
+import org.apache.taverna.component.api.ComponentException;
+
import net.sf.taverna.t2.component.profile.BaseProfileLocator;
import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
index 31d3e40..819383b 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
@@ -15,14 +15,6 @@ import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.License;
-import net.sf.taverna.t2.component.api.SharingPolicy;
-import net.sf.taverna.t2.component.api.Version;
-import net.sf.taverna.t2.component.api.Version.ID;
-import net.sf.taverna.t2.component.api.profile.Profile;
import net.sf.taverna.t2.component.registry.ComponentRegistry;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
@@ -44,6 +36,14 @@ import net.sf.taverna.t2.component.utils.SystemUtils;
import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
index 20a92f9..a441231 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
@@ -7,13 +7,13 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import net.sf.taverna.t2.component.api.ComponentException;
import net.sf.taverna.t2.component.registry.ComponentRegistry;
import net.sf.taverna.t2.component.registry.ComponentUtil;
import net.sf.taverna.t2.component.utils.AnnotationUtils;
import net.sf.taverna.t2.component.utils.SystemUtils;
import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+import org.apache.taverna.component.api.ComponentException;
import org.springframework.beans.factory.annotation.Required;
public class NewComponentRegistryFactory {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
index 1f99bc0..bbcecbb 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
@@ -3,7 +3,9 @@ package net.sf.taverna.t2.component.registry.standard;
import static java.lang.System.identityHashCode;
import static net.sf.taverna.t2.component.registry.api.Privilege.DOWNLOAD;
import static net.sf.taverna.t2.component.registry.api.Privilege.VIEW;
-import net.sf.taverna.t2.component.api.SharingPolicy;
+
+import org.apache.taverna.component.api.SharingPolicy;
+
import net.sf.taverna.t2.component.registry.api.Permissions;
import net.sf.taverna.t2.component.registry.api.Permissions.Permission;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
index 4fec684..4e7442a 100644
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
@@ -8,7 +8,8 @@ import java.util.List;
import javax.xml.bind.JAXBElement;
-import net.sf.taverna.t2.component.api.ComponentException;
+import org.apache.taverna.component.api.ComponentException;
+
import net.sf.taverna.t2.component.registry.api.Description;
import net.sf.taverna.t2.workflowmodel.Dataflow;
import uk.org.taverna.configuration.app.ApplicationConfiguration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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 a879865..4746ede 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
@@ -58,7 +58,7 @@
<osgi:service ref="componentActivityFactory"
interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
<osgi:service ref="componentUtil"
- interface="net.sf.taverna.t2.component.api.ComponentFactory" />
+ interface="org.apache.taverna.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/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
index c4f1076..0aba440 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
@@ -27,10 +27,9 @@ import static org.junit.Assert.assertTrue;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Version;
-
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.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/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
index c27185b..211c725 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
@@ -29,10 +29,9 @@ import static org.junit.Assert.assertTrue;
import java.net.URL;
import java.util.List;
-import net.sf.taverna.t2.component.api.ComponentException;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.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/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
index 08639eb..ac9fc47 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
@@ -26,11 +26,10 @@ import static org.junit.Assert.assertNull;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Version;
-
+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 org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
[18/58] [abbrv] incubator-taverna-plugin-component git commit: Merge
branch 'taverna-component-repository'
Posted by st...@apache.org.
Merge branch 'taverna-component-repository'
Conflicts:
.gitignore
>From https://github.com/taverna/taverna-component-repository master
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/a1b4ef73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/a1b4ef73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/a1b4ef73
Branch: refs/heads/master
Commit: a1b4ef73cb0618d0f69b8940246e6682dd0ce28f
Parents: d4685df 4ce7eea
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:22:39 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:22:39 2015 +0000
----------------------------------------------------------------------
.gitignore | 1 +
taverna-component-repository/pom.xml | 83 +
.../src/main/catalog/XMLSchema.xsd | 2473 ++++++++++++++++++
.../src/main/catalog/catalog.xml | 7 +
.../src/main/catalog/xml.xsd | 287 ++
.../sf/taverna/t2/component/api/Component.java | 71 +
.../t2/component/api/ComponentException.java | 50 +
.../t2/component/api/ComponentFactory.java | 27 +
.../net/sf/taverna/t2/component/api/Family.java | 99 +
.../sf/taverna/t2/component/api/License.java | 12 +
.../sf/taverna/t2/component/api/NamedItem.java | 8 +
.../sf/taverna/t2/component/api/Registry.java | 139 +
.../taverna/t2/component/api/SharingPolicy.java | 17 +
.../sf/taverna/t2/component/api/Version.java | 206 ++
.../component/api/config/ComponentConfig.java | 5 +
.../api/config/ComponentPropertyNames.java | 14 +
.../taverna/t2/component/api/package-info.java | 6 +
.../component/api/profile/ActivityProfile.java | 5 +
.../component/api/profile/AnnotatedElement.java | 10 +
.../api/profile/ExceptionHandling.java | 32 +
.../api/profile/ExceptionReplacement.java | 27 +
.../component/api/profile/HandleException.java | 39 +
.../t2/component/api/profile/PortProfile.java | 5 +
.../t2/component/api/profile/Profile.java | 47 +
.../api/profile/SemanticAnnotationProfile.java | 54 +
.../src/main/resources/ComponentProfile.xsd | 261 ++
26 files changed, 3985 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/a1b4ef73/.gitignore
----------------------------------------------------------------------
diff --cc .gitignore
index 14ee0f3,7266935..2255817
--- a/.gitignore
+++ b/.gitignore
@@@ -1,25 -1,4 +1,26 @@@
-/target/
-.settings
+# ignore project files #
+.classpath
.project
-.classpath
+.settings/
+catalog-v001.xml
+
+# ignore target files #
+target/
+bin/
+build/
+dist/
+apidoc/
+*.swp
+
+# ignore svn files if there
+.svn
+
+# ignore log files #
+*.log
+/logs/*
+*/logs/*
+
+
+
+/.springBeans
++
[27/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-plugin-component as parent
Posted by st...@apache.org.
taverna-plugin-component as parent
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/b3801edd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/b3801edd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/b3801edd
Branch: refs/heads/master
Commit: b3801eddada1f3fd37f1c09b1892be59c3291a02
Parents: 74b711e
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:28:10 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:28:10 2015 +0000
----------------------------------------------------------------------
taverna-component-repository-api/pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b3801edd/taverna-component-repository-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/pom.xml b/taverna-component-repository-api/pom.xml
index 72c9560..1dc342b 100644
--- a/taverna-component-repository-api/pom.xml
+++ b/taverna-component-repository-api/pom.xml
@@ -3,9 +3,9 @@
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.engine</groupId>
- <artifactId>taverna-engine</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <groupId>org.apache.taverna.component</groupId>
+ <artifactId>taverna-plugin-component</artifactId>
+ <version>2.1.0-incubating-SNAPSHOT</version>
</parent>
<artifactId>taverna-component-repository-api</artifactId>
<packaging>bundle</packaging>
[29/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.api.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
index 4d3e8e3..962f8dd 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
@@ -25,10 +25,9 @@ import static org.junit.Assert.assertNotNull;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
-import net.sf.taverna.t2.component.api.Version;
-
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.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/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
index 40a94de..3bad69b 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
@@ -2,7 +2,7 @@ package net.sf.taverna.t2.component.registry;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Registry;
+import org.apache.taverna.component.api.Registry;
public class Harness {
public static URL componentRegistryUrl;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
index 3dcefda..157edf7 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
@@ -21,9 +21,9 @@
package net.sf.taverna.t2.component.registry.local;
import static org.junit.Assert.assertSame;
-import net.sf.taverna.t2.component.api.Registry;
import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
+import org.apache.taverna.component.api.Registry;
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/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
index 54aab8a..188e2e1 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
@@ -25,9 +25,9 @@ import static org.junit.Assert.assertSame;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Version;
import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
+import org.apache.taverna.component.api.Version;
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/2421ba84/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
index e5ff86a..18902e1 100644
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
+++ b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
@@ -5,9 +5,9 @@ import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
import java.net.URL;
-import net.sf.taverna.t2.component.api.Component;
-import net.sf.taverna.t2.component.api.Family;
-import net.sf.taverna.t2.component.api.profile.Profile;
+import org.apache.taverna.component.api.Component;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.profile.Profile;
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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java
deleted file mode 100644
index 47bc7e9..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-import java.util.SortedMap;
-
-import uk.org.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
deleted file mode 100644
index 2b5d829..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.api;
-
-/**
- * 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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
deleted file mode 100644
index 8c7d533..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java
deleted file mode 100644
index f618af7..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.profile.Profile;
-import uk.org.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java
deleted file mode 100644
index 7e7594d..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api;
-
-/**
- * @author alson
- *
- */
-public interface License extends NamedItem {
- public String getAbbreviation();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
deleted file mode 100644
index a31ad4d..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java
deleted file mode 100644
index f7b5be4..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
deleted file mode 100644
index ba91276..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api;
-
-/**
- * @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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java
deleted file mode 100644
index 3f81739..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package net.sf.taverna.t2.component.api;
-
-import java.io.Serializable;
-import java.net.URL;
-
-import uk.org.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
deleted file mode 100644
index 172662d..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.config;
-
-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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
deleted file mode 100644
index baa8bb3..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package net.sf.taverna.t2.component.api.config;
-
-/**
- * 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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java
deleted file mode 100644
index 4af7984..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * An abstract API for working with components in a registry.
- * @author Donal Fellows
- * @author David Withers
- */
-package net.sf.taverna.t2.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
deleted file mode 100644
index f656dd0..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-public interface ActivityProfile extends AnnotatedElement {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
deleted file mode 100644
index dafec43..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.api.ComponentException;
-
-public interface AnnotatedElement {
- List<SemanticAnnotationProfile> getSemanticAnnotations()
- throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
deleted file mode 100644
index 5172f94..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-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(
- net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
- for (net.sf.taverna.t2.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
deleted file mode 100644
index e71c5ec..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-import net.sf.taverna.t2.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
deleted file mode 100644
index 1c3332b..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.api.profile;
-
-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(
- net.sf.taverna.t2.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
deleted file mode 100644
index 5d66de8..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-
-public interface PortProfile extends AnnotatedElement {
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
deleted file mode 100644
index c0899f8..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.api.NamedItem;
-import net.sf.taverna.t2.component.api.Registry;
-import net.sf.taverna.t2.component.api.ComponentException;
-
-import com.hp.hpl.jena.ontology.OntModel;
-
-public interface Profile extends NamedItem, AnnotatedElement {
-
- Registry getComponentRegistry();
-
- String getXML() throws ComponentException;
-
- net.sf.taverna.t2.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/2421ba84/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
deleted file mode 100644
index 3000576..0000000
--- a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.sf.taverna.t2.component.api.profile;
-
-import java.util.List;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.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/2421ba84/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
new file mode 100644
index 0000000..4b88d0a
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
@@ -0,0 +1,71 @@
+package org.apache.taverna.component.api;
+
+import java.net.URL;
+import java.util.SortedMap;
+
+import uk.org.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/2421ba84/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
new file mode 100644
index 0000000..3294cdd
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.api;
+
+/**
+ * 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/2421ba84/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
new file mode 100644
index 0000000..d88b36b
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
@@ -0,0 +1,27 @@
+package org.apache.taverna.component.api;
+
+import java.net.URL;
+
+import org.apache.taverna.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/2421ba84/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
new file mode 100644
index 0000000..d27260f
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
@@ -0,0 +1,100 @@
+package org.apache.taverna.component.api;
+
+import java.util.List;
+
+import org.apache.taverna.component.api.profile.Profile;
+
+import uk.org.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/2421ba84/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
new file mode 100644
index 0000000..84ca472
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.apache.taverna.component.api;
+
+/**
+ * @author alson
+ *
+ */
+public interface License extends NamedItem {
+ public String getAbbreviation();
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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
new file mode 100644
index 0000000..7cb62f1
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
@@ -0,0 +1,8 @@
+package org.apache.taverna.component.api;
+
+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/2421ba84/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
new file mode 100644
index 0000000..48fc8f6
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
@@ -0,0 +1,139 @@
+package org.apache.taverna.component.api;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.taverna.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/2421ba84/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
new file mode 100644
index 0000000..4f359b2
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.apache.taverna.component.api;
+
+/**
+ * @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/2421ba84/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
new file mode 100644
index 0000000..4c7f16b
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
@@ -0,0 +1,206 @@
+package org.apache.taverna.component.api;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import uk.org.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/2421ba84/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
new file mode 100644
index 0000000..3faebec
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
@@ -0,0 +1,5 @@
+package org.apache.taverna.component.api.config;
+
+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/2421ba84/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
new file mode 100644
index 0000000..8470cbf
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
@@ -0,0 +1,14 @@
+package org.apache.taverna.component.api.config;
+
+/**
+ * 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/2421ba84/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
new file mode 100644
index 0000000..bb74290
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * An abstract API for working with components in a registry.
+ * @author Donal Fellows
+ * @author David Withers
+ */
+package org.apache.taverna.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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
new file mode 100644
index 0000000..0eb023f
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
@@ -0,0 +1,5 @@
+package org.apache.taverna.component.api.profile;
+
+public interface ActivityProfile extends AnnotatedElement {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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
new file mode 100644
index 0000000..b961a3c
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
@@ -0,0 +1,10 @@
+package org.apache.taverna.component.api.profile;
+
+import java.util.List;
+
+import org.apache.taverna.component.api.ComponentException;
+
+public interface AnnotatedElement {
+ List<SemanticAnnotationProfile> getSemanticAnnotations()
+ throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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
new file mode 100644
index 0000000..1b07c53
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
@@ -0,0 +1,32 @@
+/**
+ *
+ */
+package org.apache.taverna.component.api.profile;
+
+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(
+ net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
+ for (net.sf.taverna.t2.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/2421ba84/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
new file mode 100644
index 0000000..2f4e6c4
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.apache.taverna.component.api.profile;
+
+import net.sf.taverna.t2.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/2421ba84/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
new file mode 100644
index 0000000..3795ec9
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package org.apache.taverna.component.api.profile;
+
+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(
+ net.sf.taverna.t2.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/2421ba84/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
new file mode 100644
index 0000000..9a7199d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
@@ -0,0 +1,5 @@
+package org.apache.taverna.component.api.profile;
+
+
+public interface PortProfile extends AnnotatedElement {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/2421ba84/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
new file mode 100644
index 0000000..eb8fc16
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
@@ -0,0 +1,47 @@
+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 com.hp.hpl.jena.ontology.OntModel;
+
+public interface Profile extends NamedItem, AnnotatedElement {
+
+ Registry getComponentRegistry();
+
+ String getXML() throws ComponentException;
+
+ net.sf.taverna.t2.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/2421ba84/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
new file mode 100644
index 0000000..6d5694b
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
@@ -0,0 +1,54 @@
+package org.apache.taverna.component.api.profile;
+
+import java.util.List;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.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/2421ba84/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 95b4405..b84e317 100644
--- a/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
+++ b/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
@@ -8,7 +8,7 @@
<xs:annotation>
<xs:appinfo>
<jxb:schemaBindings>
- <jxb:package name="net.sf.taverna.t2.component.api.profile.doc" />
+ <jxb:package name="org.apache.taverna.component.api.profile.doc" />
</jxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
[16/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/catalog/XMLSchema.xsd
----------------------------------------------------------------------
diff --git a/src/main/catalog/XMLSchema.xsd b/src/main/catalog/XMLSchema.xsd
deleted file mode 100644
index 575975b..0000000
--- a/src/main/catalog/XMLSchema.xsd
+++ /dev/null
@@ -1,2473 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
-<!-- Note this schema is NOT the normative structures schema. -->
-<!-- The prose copy in the structures REC is the normative -->
-<!-- version (which shouldn't differ from this one except for -->
-<!-- this comment and entity expansions, but just in case -->
-<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
- <xs:annotation>
- <xs:documentation>
- Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
- Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
- </xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
- The schema corresponding to this document is normative,
- with respect to the syntactic constraints it expresses in the
- XML Schema language. The documentation (within <documentation> elements)
- below, is not normative, but rather highlights important aspects of
- the W3C Recommendation of which this is a part</xs:documentation>
- </xs:annotation>
-
- <xs:annotation>
- <xs:documentation>
- The simpleType element and all of its members are defined
- towards the end of this schema document</xs:documentation>
- </xs:annotation>
-
- <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
- <xs:annotation>
- <xs:documentation>
- Get access to the xml: attribute groups for xml:lang
- as declared on 'schema' and 'documentation' below
- </xs:documentation>
- </xs:annotation>
- </xs:import>
-
- <xs:complexType name="openAttrs">
- <xs:annotation>
- <xs:documentation>
- This type is extended by almost all schema types
- to allow attributes from other namespaces to be
- added to user schemas.
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:anyType">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="annotated">
- <xs:annotation>
- <xs:documentation>
- This type is extended by all types which allow annotation
- other than <schema> itself
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="schemaTop">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which occur freely at the top level of schemas.
- All of their types are based on the "annotated" type by extension.</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:group ref="xs:redefinable"/>
- <xs:element ref="xs:element"/>
- <xs:element ref="xs:attribute"/>
- <xs:element ref="xs:notation"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="redefinable">
- <xs:annotation>
- <xs:documentation>
- This group is for the
- elements which can self-redefine (see <redefine> below).</xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:simpleType"/>
- <xs:element ref="xs:complexType"/>
- <xs:element ref="xs:group"/>
- <xs:element ref="xs:attributeGroup"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="formChoice">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="qualified"/>
- <xs:enumeration value="unqualified"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="reducedDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="derivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:reducedDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:simpleType name="typeDerivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="fullDerivationSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list itemType="xs:typeDerivationControl"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:element name="schema" id="schema">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:include"/>
- <xs:element ref="xs:import"/>
- <xs:element ref="xs:redefine"/>
- <xs:element ref="xs:annotation"/>
- </xs:choice>
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="xs:schemaTop"/>
- <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:sequence>
- <xs:attribute name="targetNamespace" type="xs:anyURI"/>
- <xs:attribute name="version" type="xs:token"/>
- <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
- <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
- <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
- <xs:attribute name="id" type="xs:ID"/>
- <xs:attribute ref="xml:lang"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:key name="element">
- <xs:selector xpath="xs:element"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="attribute">
- <xs:selector xpath="xs:attribute"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="type">
- <xs:selector xpath="xs:complexType|xs:simpleType"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="group">
- <xs:selector xpath="xs:group"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="attributeGroup">
- <xs:selector xpath="xs:attributeGroup"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="notation">
- <xs:selector xpath="xs:notation"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- <xs:key name="identityConstraint">
- <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
- <xs:field xpath="@name"/>
- </xs:key>
-
- </xs:element>
-
- <xs:simpleType name="allNNI">
- <xs:annotation><xs:documentation>
- for maxOccurs</xs:documentation></xs:annotation>
- <xs:union memberTypes="xs:nonNegativeInteger">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="unbounded"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:attributeGroup name="occurs">
- <xs:annotation><xs:documentation>
- for all particles</xs:documentation></xs:annotation>
- <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
- <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
- </xs:attributeGroup>
-
- <xs:attributeGroup name="defRef">
- <xs:annotation><xs:documentation>
- for element, group and attributeGroup,
- which both define and reference</xs:documentation></xs:annotation>
- <xs:attribute name="name" type="xs:NCName"/>
- <xs:attribute name="ref" type="xs:QName"/>
- </xs:attributeGroup>
-
- <xs:group name="typeDefParticle">
- <xs:annotation>
- <xs:documentation>
- 'complexType' uses this</xs:documentation></xs:annotation>
- <xs:choice>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:group>
-
-
-
- <xs:group name="nestedParticle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="particle">
- <xs:choice>
- <xs:element name="element" type="xs:localElement"/>
- <xs:element name="group" type="xs:groupRef"/>
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- <xs:element ref="xs:any"/>
- </xs:choice>
- </xs:group>
-
- <xs:complexType name="attribute">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="use" use="optional" default="optional">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="prohibited"/>
- <xs:enumeration value="optional"/>
- <xs:enumeration value="required"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelAttribute">
- <xs:complexContent>
- <xs:restriction base="xs:attribute">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="use" use="prohibited"/>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="attrDecls">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="attribute" type="xs:attribute"/>
- <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
- </xs:choice>
- <xs:element ref="xs:anyAttribute" minOccurs="0"/>
- </xs:sequence>
- </xs:group>
-
- <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
- </xs:annotation>
- </xs:element>
-
- <xs:group name="complexTypeModel">
- <xs:choice>
- <xs:element ref="xs:simpleContent"/>
- <xs:element ref="xs:complexContent"/>
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- This branch is short for
- <complexContent>
- <restriction base="xs:anyType">
- ...
- </restriction>
- </complexContent></xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- </xs:choice>
- </xs:group>
-
- <xs:complexType name="complexType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:complexTypeModel"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Will be restricted to required or forbidden</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
- <xs:annotation>
- <xs:documentation>
- Not allowed if simpleContent child is chosen.
- May be overriden by setting on complexContent child.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:derivationSet"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localComplexType">
- <xs:complexContent>
- <xs:restriction base="xs:complexType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:complexTypeModel"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="block" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="restrictionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:group ref="xs:typeDefParticle"/>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="complexRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:typeDefParticle"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="extensionType">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="base" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="complexContent" id="complexContent">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:complexRestrictionType"/>
- <xs:element name="extension" type="xs:extensionType"/>
- </xs:choice>
- <xs:attribute name="mixed" type="xs:boolean">
- <xs:annotation>
- <xs:documentation>
- Overrides any setting on complexType parent.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="simpleRestrictionType">
- <xs:complexContent>
- <xs:restriction base="xs:restrictionType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:annotation>
- <xs:documentation>This choice is added simply to
- make this a valid restriction per the REC</xs:documentation>
- </xs:annotation>
- <xs:group ref="xs:simpleRestrictionModel"/>
- </xs:choice>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="simpleExtensionType">
- <xs:complexContent>
- <xs:restriction base="xs:extensionType">
- <xs:sequence>
- <xs:annotation>
- <xs:documentation>
- No typeDefParticle group reference</xs:documentation>
- </xs:annotation>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="simpleContent" id="simpleContent">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:choice>
- <xs:element name="restriction" type="xs:simpleRestrictionType"/>
- <xs:element name="extension" type="xs:simpleExtensionType"/>
- </xs:choice>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
- </xs:annotation>
- </xs:element>
-
-
- <xs:simpleType name="blockSet">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- #all or (possibly empty) subset of {substitution, extension,
- restriction}</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="substitution"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:complexType name="element" abstract="true">
- <xs:annotation>
- <xs:documentation>
- The element element can be used either
- at the top level to define an element-type binding globally,
- or within a content model to either reference a globally-defined
- element or type or declare an element-type binding locally.
- The ref form is not allowed at the top level.</xs:documentation>
- </xs:annotation>
-
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attribute name="type" type="xs:QName"/>
- <xs:attribute name="substitutionGroup" type="xs:QName"/>
- <xs:attributeGroup ref="xs:occurs"/>
- <xs:attribute name="default" type="xs:string"/>
- <xs:attribute name="fixed" type="xs:string"/>
- <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="final" type="xs:derivationSet"/>
- <xs:attribute name="block" type="xs:blockSet"/>
- <xs:attribute name="form" type="xs:formChoice"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="form" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localElement">
- <xs:complexContent>
- <xs:restriction base="xs:element">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="substitutionGroup" use="prohibited"/>
- <xs:attribute name="final" use="prohibited"/>
- <xs:attribute name="abstract" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="element" type="xs:topLevelElement" id="element">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="group" abstract="true">
- <xs:annotation>
- <xs:documentation>
- group type for explicit groups, named top-level groups and
- group references</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
- <xs:attributeGroup ref="xs:defRef"/>
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="realGroup">
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:element ref="xs:all"/>
- <xs:element ref="xs:choice"/>
- <xs:element ref="xs:sequence"/>
- </xs:choice>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="namedGroup">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element name="all">
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:all">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="choice" type="xs:simpleExplicitGroup"/>
- <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="groupRef">
- <xs:complexContent>
- <xs:restriction base="xs:realGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="required" type="xs:QName"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="explicitGroup">
- <xs:annotation>
- <xs:documentation>
- group type for the three kinds of group</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:group">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
- <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="simpleExplicitGroup">
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="prohibited"/>
- <xs:attribute name="maxOccurs" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="allModel">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:annotation>
- <xs:documentation>This choice with min/max is here to
- avoid a pblm with the Elt:All/Choice/Seq
- Particle derivation constraint</xs:documentation>
- </xs:annotation>
- <xs:element name="element" type="xs:narrowMaxMin"/>
- </xs:choice>
- </xs:sequence>
- </xs:group>
-
-
- <xs:complexType name="narrowMaxMin">
- <xs:annotation>
- <xs:documentation>restricted max/min</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:localElement">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:choice minOccurs="0">
- <xs:element name="simpleType" type="xs:localSimpleType"/>
- <xs:element name="complexType" type="xs:localComplexType"/>
- </xs:choice>
- <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="all">
- <xs:annotation>
- <xs:documentation>
- Only elements allowed inside</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:restriction base="xs:explicitGroup">
- <xs:group ref="xs:allModel"/>
- <xs:attribute name="minOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:enumeration value="0"/>
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="maxOccurs" use="optional" default="1">
- <xs:simpleType>
- <xs:restriction base="xs:allNNI">
- <xs:enumeration value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="all" id="all" type="xs:all">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="choice" type="xs:explicitGroup" id="choice">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="group" type="xs:namedGroup" id="group">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="wildcard">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
- <xs:attribute name="processContents" use="optional" default="strict">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="skip"/>
- <xs:enumeration value="lax"/>
- <xs:enumeration value="strict"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="any" id="any">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:wildcard">
- <xs:attributeGroup ref="xs:occurs"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:annotation>
- <xs:documentation>
- simple type for the value of the 'namespace' attr of
- 'any' and 'anyAttribute'</xs:documentation>
- </xs:annotation>
- <xs:annotation>
- <xs:documentation>
- Value is
- ##any - - any non-conflicting WFXML/attribute at all
-
- ##other - - any non-conflicting WFXML/attribute from
- namespace other than targetNS
-
- ##local - - any unqualified non-conflicting WFXML/attribute
-
- one or - - any non-conflicting WFXML/attribute from
- more URI the listed namespaces
- references
- (space separated)
-
- ##targetNamespace or ##local may appear in the above list, to
- refer to the targetNamespace of the enclosing
- schema or an absent targetNamespace respectively</xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="namespaceList">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##any"/>
- <xs:enumeration value="##other"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:union memberTypes="xs:anyURI">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="##targetNamespace"/>
- <xs:enumeration value="##local"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="attributeGroup" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:attrDecls"/>
- <xs:attributeGroup ref="xs:defRef"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="namedAttributeGroup">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:attrDecls"/>
- </xs:sequence>
- <xs:attribute name="name" use="required" type="xs:NCName"/>
- <xs:attribute name="ref" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="attributeGroupRef">
- <xs:complexContent>
- <xs:restriction base="xs:attributeGroup">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="ref" use="required" type="xs:QName"/>
- <xs:attribute name="name" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="include" id="include">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="redefine" id="redefine">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:annotation"/>
- <xs:group ref="xs:redefinable"/>
- </xs:choice>
- <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="import" id="import">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="namespace" type="xs:anyURI"/>
- <xs:attribute name="schemaLocation" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="selector" id="selector">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in selectors</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:annotation>
- <xs:documentation>The following pattern is intended to allow XPath
- expressions per the following EBNF:
- Selector ::= Path ( '|' Path )*
- Path ::= ('.//')? Step ( '/' Step )*
- Step ::= '.' | NameTest
- NameTest ::= QName | '*' | NCName ':' '*'
- child:: is also allowed
- </xs:documentation>
- </xs:annotation>
- <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="field" id="field">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="xpath" use="required">
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation>A subset of XPath expressions for use
-in fields</xs:documentation>
- <xs:documentation>A utility type, not for public
-use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:annotation>
- <xs:documentation>The following pattern is intended to allow XPath
- expressions per the same EBNF as for selector,
- with the following change:
- Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
- </xs:documentation>
- </xs:annotation>
- <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="keybase">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element ref="xs:selector"/>
- <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:group name="identityConstraint">
- <xs:annotation>
- <xs:documentation>The three kinds of identity constraints, all with
- type of or derived from 'keybase'.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:unique"/>
- <xs:element ref="xs:key"/>
- <xs:element ref="xs:keyref"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="unique" type="xs:keybase" id="unique">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="key" type="xs:keybase" id="key">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="keyref" id="keyref">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:keybase">
- <xs:attribute name="refer" type="xs:QName" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="notation" id="notation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="name" type="xs:NCName" use="required"/>
- <xs:attribute name="public" type="xs:public"/>
- <xs:attribute name="system" type="xs:anyURI"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:simpleType name="public">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- <xs:documentation>
- A public identifier, per ISO 8879</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:token"/>
- </xs:simpleType>
-
- <xs:element name="appinfo" id="appinfo">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="documentation" id="documentation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:anyURI"/>
- <xs:attribute ref="xml:lang"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="annotation" id="annotation">
- <xs:annotation>
- <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="xs:openAttrs">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="xs:appinfo"/>
- <xs:element ref="xs:documentation"/>
- </xs:choice>
- <xs:attribute name="id" type="xs:ID"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:annotation>
- <xs:documentation>
- notations for use within XML Schema schemas</xs:documentation>
- </xs:annotation>
-
- <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
- <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
-
- <xs:complexType name="anyType" mixed="true">
- <xs:annotation>
- <xs:documentation>
- Not the real urType, but as close an approximation as we can
- get in the XML representation</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
- </xs:sequence>
- <xs:anyAttribute processContents="lax"/>
- </xs:complexType>
-
- <xs:annotation>
- <xs:documentation>
- First the built-in primitive datatypes. These definitions are for
- information only, the real built-in definitions are magic.
- </xs:documentation>
-
- <xs:documentation>
- For each built-in datatype in this schema (both primitive and
- derived) can be uniquely addressed via a URI constructed
- as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the datatype
-
- For example, to address the int datatype, the URI is:
-
- http://www.w3.org/2001/XMLSchema#int
-
- Additionally, each facet definition element can be uniquely
- addressed via a URI constructed as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the facet
-
- For example, to address the maxInclusive facet, the URI is:
-
- http://www.w3.org/2001/XMLSchema#maxInclusive
-
- Additionally, each facet usage in a built-in datatype definition
- can be uniquely addressed via a URI constructed as follows:
- 1) the base URI is the URI of the XML Schema namespace
- 2) the fragment identifier is the name of the datatype, followed
- by a period (".") followed by the name of the facet
-
- For example, to address the usage of the maxInclusive facet in
- the definition of int, the URI is:
-
- http://www.w3.org/2001/XMLSchema#int.maxInclusive
-
- </xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="string" id="string">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality" value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#string"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="preserve" id="string.preserve"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="boolean" id="boolean">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="boolean.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="float" id="float">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#float"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="float.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="double" id="double">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#double"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="double.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="decimal" id="decimal">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="totalDigits"/>
- <hfp:hasFacet name="fractionDigits"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="total"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="true"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="decimal.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="duration" id="duration">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#duration"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="duration.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="dateTime" id="dateTime">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="dateTime.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="time" id="time">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#time"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="time.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="date" id="date">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#date"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="date.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gYearMonth" id="gYearMonth">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gYearMonth.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gYear" id="gYear">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gYear.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gMonthDay" id="gMonthDay">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gMonthDay.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gDay" id="gDay">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gDay.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="gMonth" id="gMonth">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="maxInclusive"/>
- <hfp:hasFacet name="maxExclusive"/>
- <hfp:hasFacet name="minInclusive"/>
- <hfp:hasFacet name="minExclusive"/>
- <hfp:hasProperty name="ordered" value="partial"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="gMonth.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="hexBinary" id="hexBinary">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#binary"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="hexBinary.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="base64Binary" id="base64Binary">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="base64Binary.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="anyURI" id="anyURI">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="anyURI.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="QName" id="QName">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#QName"/>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="QName.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NOTATION" id="NOTATION">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
- <xs:documentation>
- NOTATION cannot be used directly in a schema; rather a type
- must be derived from it by specifying at least one enumeration
- facet whose value is the name of a NOTATION declared in the
- schema.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:anySimpleType">
- <xs:whiteSpace value="collapse" fixed="true"
- id="NOTATION.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:annotation>
- <xs:documentation>
- Now the derived primitive types
- </xs:documentation>
- </xs:annotation>
-
- <xs:simpleType name="normalizedString" id="normalizedString">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:whiteSpace value="replace"
- id="normalizedString.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="token" id="token">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#token"/>
- </xs:annotation>
- <xs:restriction base="xs:normalizedString">
- <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="language" id="language">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#language"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern
- value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
- id="language.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.ietf.org/rfc/rfc3066.txt">
- pattern specifies the content of section 2.12 of XML 1.0e2
- and RFC 3066 (Revised version of RFC 1766).
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="IDREFS" id="IDREFS">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:IDREF"/>
- </xs:simpleType>
- <xs:minLength value="1" id="IDREFS.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ENTITIES" id="ENTITIES">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:ENTITY"/>
- </xs:simpleType>
- <xs:minLength value="1" id="ENTITIES.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NMTOKEN" id="NMTOKEN">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern value="\c+" id="NMTOKEN.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
- pattern matches production 7 from the XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NMTOKENS" id="NMTOKENS">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasFacet name="length"/>
- <hfp:hasFacet name="minLength"/>
- <hfp:hasFacet name="maxLength"/>
- <hfp:hasFacet name="enumeration"/>
- <hfp:hasFacet name="whiteSpace"/>
- <hfp:hasFacet name="pattern"/>
- <hfp:hasProperty name="ordered" value="false"/>
- <hfp:hasProperty name="bounded" value="false"/>
- <hfp:hasProperty name="cardinality"
- value="countably infinite"/>
- <hfp:hasProperty name="numeric" value="false"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
- </xs:annotation>
- <xs:restriction>
- <xs:simpleType>
- <xs:list itemType="xs:NMTOKEN"/>
- </xs:simpleType>
- <xs:minLength value="1" id="NMTOKENS.minLength"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="Name" id="Name">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#Name"/>
- </xs:annotation>
- <xs:restriction base="xs:token">
- <xs:pattern value="\i\c*" id="Name.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml#NT-Name">
- pattern matches production 5 from the XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="NCName" id="NCName">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
- </xs:annotation>
- <xs:restriction base="xs:Name">
- <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
- pattern matches production 4 from the Namespaces in XML spec
- </xs:documentation>
- </xs:annotation>
- </xs:pattern>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="ID" id="ID">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ID"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="IDREF" id="IDREF">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="ENTITY" id="ENTITY">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
- </xs:annotation>
- <xs:restriction base="xs:NCName"/>
- </xs:simpleType>
-
- <xs:simpleType name="integer" id="integer">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#integer"/>
- </xs:annotation>
- <xs:restriction base="xs:decimal">
- <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
- <xs:pattern value="[\-+]?[0-9]+"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="negativeInteger" id="negativeInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:nonPositiveInteger">
- <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="long" id="long">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#long"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
- <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="int" id="int">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#int"/>
- </xs:annotation>
- <xs:restriction base="xs:long">
- <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
- <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="short" id="short">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#short"/>
- </xs:annotation>
- <xs:restriction base="xs:int">
- <xs:minInclusive value="-32768" id="short.minInclusive"/>
- <xs:maxInclusive value="32767" id="short.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="byte" id="byte">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#byte"/>
- </xs:annotation>
- <xs:restriction base="xs:short">
- <xs:minInclusive value="-128" id="byte.minInclusive"/>
- <xs:maxInclusive value="127" id="byte.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:integer">
- <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedLong" id="unsignedLong">
- <xs:annotation>
- <xs:appinfo>
- <hfp:hasProperty name="bounded" value="true"/>
- <hfp:hasProperty name="cardinality" value="finite"/>
- </xs:appinfo>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
- </xs:annotation>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:maxInclusive value="18446744073709551615"
- id="unsignedLong.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedInt" id="unsignedInt">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedLong">
- <xs:maxInclusive value="4294967295"
- id="unsignedInt.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedShort" id="unsignedShort">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedInt">
- <xs:maxInclusive value="65535"
- id="unsignedShort.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="unsignedByte" id="unsignedByte">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
- </xs:annotation>
- <xs:restriction base="xs:unsignedShort">
- <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="positiveInteger" id="positiveInteger">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
- </xs:annotation>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="derivationControl">
- <xs:annotation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="substitution"/>
- <xs:enumeration value="extension"/>
- <xs:enumeration value="restriction"/>
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:group name="simpleDerivation">
- <xs:choice>
- <xs:element ref="xs:restriction"/>
- <xs:element ref="xs:list"/>
- <xs:element ref="xs:union"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="simpleDerivationSet">
- <xs:annotation>
- <xs:documentation>
- #all or (possibly empty) subset of {restriction, union, list}
- </xs:documentation>
- <xs:documentation>
- A utility type, not for public use</xs:documentation>
- </xs:annotation>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="#all"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:list>
- <xs:simpleType>
- <xs:restriction base="xs:derivationControl">
- <xs:enumeration value="list"/>
- <xs:enumeration value="union"/>
- <xs:enumeration value="restriction"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:list>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:complexType name="simpleType" abstract="true">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleDerivation"/>
- <xs:attribute name="final" type="xs:simpleDerivationSet"/>
- <xs:attribute name="name" type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Can be restricted to required or forbidden
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="topLevelSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="required"
- type="xs:NCName">
- <xs:annotation>
- <xs:documentation>
- Required at the top level
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="localSimpleType">
- <xs:complexContent>
- <xs:restriction base="xs:simpleType">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- <xs:group ref="xs:simpleDerivation"/>
- </xs:sequence>
- <xs:attribute name="name" use="prohibited">
- <xs:annotation>
- <xs:documentation>
- Forbidden when nested
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="final" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
- </xs:annotation>
- </xs:element>
-
- <xs:group name="facets">
- <xs:annotation>
- <xs:documentation>
- We should use a substitution group for facets, but
- that's ruled out because it would allow users to
- add their own, which we're not ready for yet.
- </xs:documentation>
- </xs:annotation>
- <xs:choice>
- <xs:element ref="xs:minExclusive"/>
- <xs:element ref="xs:minInclusive"/>
- <xs:element ref="xs:maxExclusive"/>
- <xs:element ref="xs:maxInclusive"/>
- <xs:element ref="xs:totalDigits"/>
- <xs:element ref="xs:fractionDigits"/>
- <xs:element ref="xs:length"/>
- <xs:element ref="xs:minLength"/>
- <xs:element ref="xs:maxLength"/>
- <xs:element ref="xs:enumeration"/>
- <xs:element ref="xs:whiteSpace"/>
- <xs:element ref="xs:pattern"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="simpleRestrictionModel">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
- <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:group>
-
- <xs:element name="restriction" id="restriction">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
- base attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:group ref="xs:simpleRestrictionModel"/>
- <xs:attribute name="base" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="list" id="list">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-list">
- itemType attribute and simpleType child are mutually
- exclusive, but one or other is required
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType"
- minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="itemType" type="xs:QName" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="union" id="union">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-union">
- memberTypes attribute must be non-empty or there must be
- at least one simpleType child
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:sequence>
- <xs:element name="simpleType" type="xs:localSimpleType"
- minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="memberTypes" use="optional">
- <xs:simpleType>
- <xs:list itemType="xs:QName"/>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="facet">
- <xs:complexContent>
- <xs:extension base="xs:annotated">
- <xs:attribute name="value" use="required"/>
- <xs:attribute name="fixed" type="xs:boolean" use="optional"
- default="false"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="noFixedFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="fixed" use="prohibited"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="numFacet">
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="totalDigits" id="totalDigits">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:numFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="length" id="length" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="minLength" id="minLength" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
- </xs:annotation>
- </xs:element>
- <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="whiteSpace" id="whiteSpace">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:facet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="preserve"/>
- <xs:enumeration value="replace"/>
- <xs:enumeration value="collapse"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="pattern" id="pattern">
- <xs:annotation>
- <xs:documentation
- source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
- </xs:annotation>
- <xs:complexType>
- <xs:complexContent>
- <xs:restriction base="xs:noFixedFacet">
- <xs:sequence>
- <xs:element ref="xs:annotation" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="value" type="xs:string" use="required"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:restriction>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/src/main/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/src/main/catalog/catalog.xml b/src/main/catalog/catalog.xml
deleted file mode 100644
index e61eda5..0000000
--- a/src/main/catalog/catalog.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
- <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="XMLSchema.xsd" />
- <public publicId="http://www.w3.org/2001/XMLSchema" uri="XMLSchema.xsd" />
- <system systemId="http://www.w3.org/2001/xml.xsd" uri="xml.xsd" />
- <public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd" />
-</catalog>
\ No newline at end of file
[43/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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
new file mode 100644
index 0000000..83ad528
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
@@ -0,0 +1,88 @@
+/**
+ *
+ */
+package org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.core.Processor;
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..781a63a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
@@ -0,0 +1,261 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 uk.org.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 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 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.file.FileManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+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.RemoveActivityEdit;
+import net.sf.taverna.t2.workflow.edits.RenameEdit;
+//import net.sf.taverna.t2.workflowmodel.utils.Tools;
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputActivityPort;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..2cea6b0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Processor;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..ed1a650
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
@@ -0,0 +1,13 @@
+package org.apache.taverna.component.ui.menu.component;
+
+import static org.apache.taverna.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..857f9e8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
@@ -0,0 +1,58 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.component.ui.util.Utils;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..f1e6c3b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..0a37c21
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
@@ -0,0 +1,149 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..c034810
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
@@ -0,0 +1,45 @@
+/**
+ *
+ */
+package org.apache.taverna.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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..fb215c5
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
@@ -0,0 +1,241 @@
+package org.apache.taverna.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 static org.apache.taverna.component.ui.util.Utils.refreshComponentServiceProvider;
+
+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 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.ComponentFileType;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+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.file.FileManager;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
+import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+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.AddDataLinkEdit;
+import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
+import net.sf.taverna.t2.workflow.edits.AddWorkflowInputPortEdit;
+import net.sf.taverna.t2.workflow.edits.AddWorkflowOutputPortEdit;
+import net.sf.taverna.t2.workflow.edits.RemoveActivityEdit;
+import net.sf.taverna.t2.workflow.edits.RenameEdit;
+import static net.sf.taverna.t2.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);
+
+ 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 {
+ 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/43334c1d/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
new file mode 100644
index 0000000..10ef628
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
@@ -0,0 +1,128 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.file.FileManager;
+
+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 uk.org.taverna.scufl2.api.configurations.Configuration;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..99f0db9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..2c0c339
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
@@ -0,0 +1,38 @@
+package org.apache.taverna.component.ui.menu.component;
+
+import static org.apache.taverna.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..7168219
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.component;
+
+import static org.apache.taverna.component.ui.menu.ComponentMenu.COMPONENT;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..e320399
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
@@ -0,0 +1,120 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..483c121
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package org.apache.taverna.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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..ac89d3c
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.component.ui.util.Utils;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..82351f8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..57c72e2
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
@@ -0,0 +1,155 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView.importServiceDescription;
+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 net.sf.taverna.t2.ui.menu.MenuManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+
+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 uk.org.taverna.commons.services.ServiceRegistry;
+
+/**
+ * @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)
+ 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/43334c1d/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
new file mode 100644
index 0000000..772d5ce
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.apache.taverna.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 uk.org.taverna.commons.services.ServiceRegistry;
+import net.sf.taverna.t2.ui.menu.MenuManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..1e8900f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
@@ -0,0 +1,97 @@
+/**
+ *
+ */
+package org.apache.taverna.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 uk.org.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+
+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 com.fasterxml.jackson.databind.JsonNode;
+
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..1be55fb
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.core.Processor;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..c1ef1e4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
@@ -0,0 +1,69 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..be5606d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..c2bf615
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
@@ -0,0 +1,59 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.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);
+ }
+}
[48/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
deleted file mode 100644
index 8d46720..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.component.api.ComponentFactory;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
deleted file mode 100644
index 8e8806a..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentAction.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean.ignorableNames;
-import static net.sf.taverna.t2.component.ui.util.Utils.uniqueName;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static uk.org.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 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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
-import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-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.RemoveActivityEdit;
-import net.sf.taverna.t2.workflow.edits.RenameEdit;
-//import net.sf.taverna.t2.workflowmodel.utils.Tools;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
deleted file mode 100644
index f2d5fb0..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/ReplaceByComponentMenuAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.component.api.ComponentFactory;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import uk.org.taverna.scufl2.api.core.Processor;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/AbstractComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/AbstractComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/AbstractComponentMenuAction.java
deleted file mode 100644
index 86a401b..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/AbstractComponentMenuAction.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import static net.sf.taverna.t2.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseAction.java
deleted file mode 100644
index b53bc77..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseMenuAction.java
deleted file mode 100644
index eda5cad..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCloseMenuAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
deleted file mode 100644
index 696d53c..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.ComponentChoiceMessage;
-import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.ProfileChoiceMessage;
-import net.sf.taverna.t2.component.ui.panel.RegistryAndFamilyChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyMenuAction.java
deleted file mode 100644
index e694b40..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCopyMenuAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
deleted file mode 100644
index 7c715bf..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentCreatorSupport.java
+++ /dev/null
@@ -1,241 +0,0 @@
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.refreshComponentServiceProvider;
-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 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.jdom.Element;
-import org.jdom.JDOMException;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.core.DataLink;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
-import net.sf.taverna.t2.component.ui.panel.RegistryAndFamilyChooserComponentEntryPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import net.sf.taverna.t2.component.ui.util.ComponentFileType;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-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.AddDataLinkEdit;
-import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
-import net.sf.taverna.t2.workflow.edits.AddWorkflowInputPortEdit;
-import net.sf.taverna.t2.workflow.edits.AddWorkflowOutputPortEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveActivityEdit;
-import net.sf.taverna.t2.workflow.edits.RenameEdit;
-import static net.sf.taverna.t2.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);
-
- 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 {
- 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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
deleted file mode 100644
index b87eaba..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteAction.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-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 uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteMenuAction.java
deleted file mode 100644
index e348f8a..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentDeleteMenuAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuAction.java
deleted file mode 100644
index 2162f91..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import static net.sf.taverna.t2.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuSection.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuSection.java
deleted file mode 100644
index 3904dc2..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMenuSection.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import static net.sf.taverna.t2.component.ui.menu.ComponentMenu.COMPONENT;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
deleted file mode 100644
index 82f0b1e..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeAction.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.ComponentChoiceMessage;
-import net.sf.taverna.t2.component.ui.panel.ComponentChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.ProfileChoiceMessage;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeMenuAction.java
deleted file mode 100644
index 6f5b011..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentMergeMenuAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveAction.java
deleted file mode 100644
index d6bea1d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveMenuAction.java
deleted file mode 100644
index c6c79d9..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSaveMenuAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
deleted file mode 100644
index 5574edd..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchAction.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView.importServiceDescription;
-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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.PrefixPanel;
-import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.SearchChoicePanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceDesc;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-
-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 uk.org.taverna.commons.services.ServiceRegistry;
-
-/**
- * @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)
- 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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
deleted file mode 100644
index 9695cf8..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentSearchMenuAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.component.api.ComponentFactory;
-
-import uk.org.taverna.commons.services.ServiceRegistry;
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
deleted file mode 100644
index f5d0c87..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorAction.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 uk.org.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.component.ui.menu.component.ComponentCreatorSupport.CopiedProcessor;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Version;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.profiles.Profile;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
deleted file mode 100644
index 9be949c..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Processor;
-import net.sf.taverna.t2.component.ui.menu.AbstractContextComponentMenuAction;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
deleted file mode 100644
index e186c10..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.ComponentAction;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
deleted file mode 100644
index 8dac7ba..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/FileOpenFromComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/FileOpenFromComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/FileOpenFromComponentMenuAction.java
deleted file mode 100644
index 0d79699..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/FileOpenFromComponentMenuAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
deleted file mode 100644
index 41ac068..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/component/OpenWorkflowFromComponentAction.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.ComponentAction;
-import net.sf.taverna.t2.component.ui.panel.ComponentChoiceMessage;
-import net.sf.taverna.t2.component.ui.panel.ComponentVersionChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-
-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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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);
- }
- }
-}
[28/58] [abbrv] incubator-taverna-plugin-component git commit:
disable workbench activities
Posted by st...@apache.org.
disable workbench activities
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/8b8dbce4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/8b8dbce4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/8b8dbce4
Branch: refs/heads/master
Commit: 8b8dbce469c9a9db285f13dea72b34950e772af2
Parents: b3801ed
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 19:22:08 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 19:22:08 2015 +0000
----------------------------------------------------------------------
taverna-component-activity-ui/pom.xml | 104 +++++++++++------------------
1 file changed, 39 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/8b8dbce4/taverna-component-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/pom.xml b/taverna-component-activity-ui/pom.xml
index 74560fd..550d002 100644
--- a/taverna-component-activity-ui/pom.xml
+++ b/taverna-component-activity-ui/pom.xml
@@ -3,100 +3,74 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>net.sf.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>3.0.1-SNAPSHOT</version>
+ <groupId>org.apache.taverna.component</groupId>
+ <artifactId>taverna-plugin-component</artifactId>
+ <version>2.1.0-incubating-SNAPSHOT</version>
</parent>
- <groupId>net.sf.taverna.t2.ui-activities</groupId>
<artifactId>component-activity-ui</artifactId>
<name>Taverna 3 Component activity UI bindings</name>
- <version>2.0-SNAPSHOT</version>
<dependencies>
<dependency>
- <groupId>net.sf.taverna.component</groupId>
- <artifactId>component-repository</artifactId>
- <version>${t2.activities.version}</version>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-component-repository-api</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-palette-api</artifactId>
- <version>${t2.ui.api.version}</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>com.springsource.org.apache.commons.lang</artifactId>
+ <version>${commons.lang.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>menu-api</artifactId>
- <version>${t2.ui.api.version}</version>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-validation-structural</artifactId>
+ <version>${taverna.language.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>report-api</artifactId>
- <version>${t2.ui.api.version}</version>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-validation-correctness</artifactId>
+ <version>${taverna.language.version}</version>
</dependency>
+ <!--
<dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>contextual-views-api</artifactId>
- <version>${t2.ui.api.version}</version>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-activity-palette-api</artifactId>
+ <version>${taverna.workbench.version}</version>
</dependency>
<dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-validation-structural</artifactId>
- <version>${scufl2.version}</version>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-menu-api</artifactId>
+ <version>${taverna.workbench.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-components</groupId>
- <artifactId>graph-model</artifactId>
- <version>${t2.ui.components.version}</version>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-report-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-contextual-views-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-graph-model</artifactId>
+ <version>${taverna.workbench.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-components</groupId>
+ <groupId>org.apache.taverna.workbench</groupId>
<artifactId>graph-view</artifactId>
<version>${t2.ui.components.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-activities</groupId>
+ <groupId>org.apache.taverna.workbench</groupId>
<artifactId>dataflow-activity-ui</artifactId>
<version>${t2.ui.activities.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.lang</groupId>
+ <groupId>org.apache.taverna.workbench</groupId>
<artifactId>ui</artifactId>
<version>${t2.lang.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.lang</artifactId>
- <version>${commons.lang.version}</version>
- </dependency>
- <dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-validation-correctness</artifactId>
- <version>${scufl2.version}</version>
- </dependency>
+ -->
</dependencies>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository</url>
- </repository>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- <id>mygrid-snapshot-repository</id>
- <name>myGrid Snapshot Repository</name>
- <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
- </repository>
- </repositories>
- <scm>
- <connection>scm:git:https://github.com/taverna/taverna-component-activity-ui.git</connection>
- <developerConnection>scm:git:ssh://git@github.com:taverna/taverna-component-activity-ui.git</developerConnection>
- <url>https://github.com/taverna/taverna-component-activity-ui</url>
- <tag>HEAD</tag>
- </scm>
</project>
[17/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository/
Posted by st...@apache.org.
taverna-component-repository/
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/4ce7eea2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/4ce7eea2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/4ce7eea2
Branch: refs/heads/master
Commit: 4ce7eea2bdcd412b2d90f4ec7ff6d447e6b778d4
Parents: 2b103cc
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:22:03 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:22:03 2015 +0000
----------------------------------------------------------------------
pom.xml | 83 -
src/main/catalog/XMLSchema.xsd | 2473 ------------------
src/main/catalog/catalog.xml | 7 -
src/main/catalog/xml.xsd | 287 --
.../sf/taverna/t2/component/api/Component.java | 71 -
.../t2/component/api/ComponentException.java | 50 -
.../t2/component/api/ComponentFactory.java | 27 -
.../net/sf/taverna/t2/component/api/Family.java | 99 -
.../sf/taverna/t2/component/api/License.java | 12 -
.../sf/taverna/t2/component/api/NamedItem.java | 8 -
.../sf/taverna/t2/component/api/Registry.java | 139 -
.../taverna/t2/component/api/SharingPolicy.java | 17 -
.../sf/taverna/t2/component/api/Version.java | 206 --
.../component/api/config/ComponentConfig.java | 5 -
.../api/config/ComponentPropertyNames.java | 14 -
.../taverna/t2/component/api/package-info.java | 6 -
.../component/api/profile/ActivityProfile.java | 5 -
.../component/api/profile/AnnotatedElement.java | 10 -
.../api/profile/ExceptionHandling.java | 32 -
.../api/profile/ExceptionReplacement.java | 27 -
.../component/api/profile/HandleException.java | 39 -
.../t2/component/api/profile/PortProfile.java | 5 -
.../t2/component/api/profile/Profile.java | 47 -
.../api/profile/SemanticAnnotationProfile.java | 54 -
src/main/resources/ComponentProfile.xsd | 261 --
taverna-component-repository/pom.xml | 83 +
.../src/main/catalog/XMLSchema.xsd | 2473 ++++++++++++++++++
.../src/main/catalog/catalog.xml | 7 +
.../src/main/catalog/xml.xsd | 287 ++
.../sf/taverna/t2/component/api/Component.java | 71 +
.../t2/component/api/ComponentException.java | 50 +
.../t2/component/api/ComponentFactory.java | 27 +
.../net/sf/taverna/t2/component/api/Family.java | 99 +
.../sf/taverna/t2/component/api/License.java | 12 +
.../sf/taverna/t2/component/api/NamedItem.java | 8 +
.../sf/taverna/t2/component/api/Registry.java | 139 +
.../taverna/t2/component/api/SharingPolicy.java | 17 +
.../sf/taverna/t2/component/api/Version.java | 206 ++
.../component/api/config/ComponentConfig.java | 5 +
.../api/config/ComponentPropertyNames.java | 14 +
.../taverna/t2/component/api/package-info.java | 6 +
.../component/api/profile/ActivityProfile.java | 5 +
.../component/api/profile/AnnotatedElement.java | 10 +
.../api/profile/ExceptionHandling.java | 32 +
.../api/profile/ExceptionReplacement.java | 27 +
.../component/api/profile/HandleException.java | 39 +
.../t2/component/api/profile/PortProfile.java | 5 +
.../t2/component/api/profile/Profile.java | 47 +
.../api/profile/SemanticAnnotationProfile.java | 54 +
.../src/main/resources/ComponentProfile.xsd | 261 ++
50 files changed, 3984 insertions(+), 3984 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 771618d..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>3.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.component</groupId>
- <artifactId>component-repository</artifactId>
- <version>${t2.activities.version}</version>
- <name>Taverna Component Repository API</name>
- <packaging>bundle</packaging>
- <scm>
- <connection>scm:git:https://github.com/taverna/taverna-component-repository.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/taverna/taverna-component-repository.git</developerConnection>
- <url>https://github.com/taverna/taverna-component-repository/</url>
- <tag>HEAD</tag>
- </scm>
- <dependencies>
- <dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-api</artifactId>
- <version>${scufl2.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza.ext</groupId>
- <artifactId>com.hp.hpl.jena</artifactId>
- <version>0.6-incubating</version>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository</url>
- </repository>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- <id>mygrid-snapshot-repository</id>
- <name>myGrid Snapshot Repository</name>
- <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
- </repository>
- </repositories>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>net.sf.taverna.t2.component.api,net.sf.taverna.t2.component.api.profile,net.sf.taverna.t2.component.api.profile.doc</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.8.3</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <catalog>${basedir}/src/main/catalog/catalog.xml</catalog>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <inceptionYear>2014</inceptionYear>
-</project>
\ No newline at end of file
[45/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
deleted file mode 100644
index bf2942d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package net.sf.taverna.t2.component.ui.view;
-
-import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.Port;
-import net.sf.taverna.t2.component.annotation.AbstractSemanticAnnotationContextualView;
-import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
deleted file mode 100644
index 7ab8f04..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.annotation.SemanticAnnotationUtils.getDisplayName;
-import static net.sf.taverna.t2.component.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
deleted file mode 100644
index f81d608..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextViewFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package net.sf.taverna.t2.component.ui.view;
-
-import static org.apache.taverna.component.api.config.ComponentConfig.URI;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.taverna.component.api.Version;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
deleted file mode 100644
index acc1cc3..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentContextualView.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package net.sf.taverna.t2.component.ui.view;
-
-import static java.lang.String.format;
-//import static net.sf.taverna.t2.component.ui.view.ViewUtil.getRawTablesHtml;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.buildTableOpeningTag;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.createEditorPane;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.getHtmlHead;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.panelForHtml;
-
-import java.awt.Color;
-
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-
-import org.apache.taverna.component.api.Version;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.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 = createEditorPane(buildHtml());
- return panelForHtml(editorPane);
- }
-
- private String buildHtml() {
- StringBuilder html = new StringBuilder(getHtmlHead(getBackgroundColour()));
- html.append(buildTableOpeningTag());
- viewUtils.getRawTablesHtml(component, html);
- return html.append("</table></body></html>").toString();
- }
-
- public String getBackgroundColour() {
- Color colour = colourManager.getPreferredColour(
- "net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
deleted file mode 100644
index 7e87e7e..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ViewUtil.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
-
-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 uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.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/43334c1d/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
new file mode 100644
index 0000000..0996620
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
@@ -0,0 +1,48 @@
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.models.graph.GraphController;
+import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraph;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+@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/43334c1d/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
new file mode 100644
index 0000000..f0adfd5
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
@@ -0,0 +1,165 @@
+package org.apache.taverna.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 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 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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.InputActivityPort;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+import uk.org.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 (org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..4053489
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
@@ -0,0 +1,9 @@
+package org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..48f75f0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
@@ -0,0 +1,281 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import uk.org.taverna.scufl2.api.common.AbstractNamed;
+import uk.org.taverna.scufl2.api.common.Named;
+
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.Statement;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..6249239
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
@@ -0,0 +1,101 @@
+/**
+ *
+ */
+package org.apache.taverna.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 org.apache.taverna.component.api.ComponentFactory;
+import org.apache.taverna.component.api.Version;
+
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.AbstractNamed;
+import uk.org.taverna.scufl2.api.port.ActivityPort;
+import net.sf.taverna.t2.lang.ui.DeselectingButton;
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..a0ba024
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.ui.annotation;
+
+import static com.hp.hpl.jena.rdf.model.ResourceFactory.createTypedLiteral;
+import static java.lang.Integer.MIN_VALUE;
+import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..903e538
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.ui.annotation;
+
+import static com.hp.hpl.jena.rdf.model.ResourceFactory.createTypedLiteral;
+import static java.lang.Integer.MIN_VALUE;
+import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..78cd3b1
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.ui.annotation;
+
+import static com.hp.hpl.jena.datatypes.xsd.XSDDatatype.XSDdateTime;
+import static com.hp.hpl.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import com.hp.hpl.jena.datatypes.xsd.XSDDateTime;
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..6078ba3
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.annotation;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+
+import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..0f143d2
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
@@ -0,0 +1,17 @@
+package org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..9f8e9a6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.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 org.apache.taverna.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import org.apache.taverna.component.ui.localworld.LocalWorld;
+
+import net.sf.taverna.t2.lang.ui.DeselectingButton;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Statement;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..2768b02
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.ui.annotation;
+
+import static java.awt.Color.WHITE;
+import static org.apache.taverna.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 com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..b32ac69
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.file.FileManager;
+
+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 uk.org.taverna.scufl2.api.common.AbstractNamed;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..6652dc4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.AbstractNamed;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.ActivityPort;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..c2d2fb9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
@@ -0,0 +1,253 @@
+package org.apache.taverna.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 org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static org.apache.taverna.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import net.sf.taverna.t2.lang.ui.DeselectingButton;
+
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Statement;
+
+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;
+ }
+}
[26/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-plugin-component pom
Posted by st...@apache.org.
taverna-plugin-component pom
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/74b711e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/74b711e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/74b711e7
Branch: refs/heads/master
Commit: 74b711e747ce8cef430a8783641dfc68a6fac9ff
Parents: c70b61e
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:27:32 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:27:32 2015 +0000
----------------------------------------------------------------------
taverna-component-activity/pom.xml | 192 +++++++++++++++++---------------
1 file changed, 101 insertions(+), 91 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/74b711e7/taverna-component-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/pom.xml b/taverna-component-activity/pom.xml
index 01d00ca..9edfc35 100644
--- a/taverna-component-activity/pom.xml
+++ b/taverna-component-activity/pom.xml
@@ -3,80 +3,85 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>net.sf.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>3.0.1-SNAPSHOT</version>
+ <groupId>org.apache.taverna.component</groupId>
+ <artifactId>taverna-plugin-component</artifactId>
+ <version>2.1.0-incubating-SNAPSHOT</version>
</parent>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>component-activity</artifactId>
- <version>${t2.activities.version}</version>
- <name>Taverna Component activity</name>
+ <artifactId>taverna-component-activity</artifactId>
<packaging>bundle</packaging>
- <properties>
- <jena.core.version>2.11.1</jena.core.version>
- </properties>
-
- <scm>
- <connection>scm:git:https://github.com/taverna/taverna-component-activity.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/taverna/taverna-component-activity.git</developerConnection>
- <url>https://github.com/taverna/taverna-component-activity/</url>
- <tag>HEAD</tag>
- </scm>
+ <name>Apache Taverna Component Repository implementation</name>
<dependencies>
<dependency>
- <groupId>net.sf.taverna.component</groupId>
- <artifactId>component-repository</artifactId>
- <version>${t2.activities.version}</version>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-component-repository-api</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-api</artifactId>
- <version>${t2.core.version}</version>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-reference-api</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-api</artifactId>
- <version>${t2.core.version}</version>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-workflowmodel-api</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
- <!-- FIXME: Avoid -->
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-impl</artifactId>
- <version>${t2.core.version}</version>
+ <!-- FIXME: Remove -->
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-workflowmodel-impl</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>uk.org.taverna.platform</groupId>
+ <groupId>${project.parent.groupId}</groupId>
<artifactId>taverna-execution-api</artifactId>
- <version>${platform.version}</version>
+ <version>${project.parent.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-cache</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>dataflow-activity</artifactId>
- <version>${t2.activities.version}</version>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-dataflow-activity</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>uk.org.taverna.configuration</groupId>
+ <groupId>org.apache.taverna.osgi</groupId>
<artifactId>taverna-app-configuration-api</artifactId>
- <version>${taverna.configuration.version}</version>
+ <version>${taverna.osgi.version}</version>
</dependency>
<dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-api</artifactId>
- <version>${scufl2.version}</version>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-api</artifactId>
+ <version>${taverna.language.version}</version>
</dependency>
<dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-t2flow</artifactId>
- <version>${scufl2.version}</version>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-validation-structural</artifactId>
+ <version>${taverna.language.version}</version>
</dependency>
- <!--
<dependency>
- <groupId>uk.org.taverna.scufl2</groupId>
- <artifactId>scufl2-annotation</artifactId>
- <version>${scufl2.version}</version>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-t2flow</artifactId>
+ <version>${taverna.language.version}</version>
+ <scope>test</scope>
+ <!-- Or is this always needed? -->
+ </dependency>
+ <!-- <dependency> <groupId>org.apache.taverna.language</groupId> <artifactId>taverna-scufl2-annotation</artifactId>
+ <version>${taverna.language.version}</version> </dependency> -->
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-credential-manager</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
- -->
<dependency>
<groupId>org.jdom</groupId>
@@ -91,29 +96,54 @@
<!--
<dependency>
<groupId>org.apache.httpcomponents</groupId>
- <artifactId>com.springsource.org.apache.httpcomponents.httpclient</artifactId>
- <version>${apache.httpclient.version}</version>
+ <artifactId>httpcore-osgi</artifactId>
+ <version>${apache.httpcore.version}</version>
<exclusions>
<exclusion>
+ <artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
- <artifactId>com.springsource.org.apache.httpcomponents.httpclient-cache</artifactId>
</exclusion>
<exclusion>
+ <artifactId>httpcore-nio</artifactId>
<groupId>org.apache.httpcomponents</groupId>
- <artifactId>com.springsource.org.apache.httpcomponents.httpmime</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
- <dependency>
+ <!--
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-osgi</artifactId>
+ <version>${apache.httpclient.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>fluent-hc</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>httpclient-cache</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>httpmime</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
- <version>${commons.httpclient.version}</version>
+ <version>${commons.httpclient.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
@@ -121,11 +151,12 @@
<groupId>org.apache.clerezza.ext</groupId>
<artifactId>com.hp.hpl.jena</artifactId>
<version>0.6-incubating</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.security</groupId>
- <artifactId>credential-manager</artifactId>
- <version>${t2.security.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -135,42 +166,21 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>activity-test-utils</artifactId>
- <version>${t2.activities.version}</version>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-activity-test-utils</artifactId>
+ <version>${project.parent.version}</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
-
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository</url>
- </repository>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- <id>mygrid-snapshot-repository</id>
- <name>myGrid Snapshot Repository</name>
- <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
- </repository>
- </repositories>
-
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- <plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.3</version>
[55/58] [abbrv] incubator-taverna-plugin-component git commit:
imports of scufl2
Posted by st...@apache.org.
imports of scufl2
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/52379d45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/52379d45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/52379d45
Branch: refs/heads/master
Commit: 52379d4539de3dfd1fafd79b2bff1acc484e25e4
Parents: be59a4f
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 23:16:26 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 23:16:26 2015 +0000
----------------------------------------------------------------------
.../java/org/apache/taverna/component/utils/SystemUtils.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/52379d45/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 61fecbc..91fc8f9 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
@@ -8,15 +8,16 @@ import java.util.List;
import javax.xml.bind.JAXBElement;
+import net.sf.taverna.t2.workflowmodel.Dataflow;
+
import org.apache.taverna.component.api.ComponentException;
import org.apache.taverna.component.registry.api.Description;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
import uk.org.taverna.configuration.app.ApplicationConfiguration;
import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
import uk.org.taverna.platform.execution.api.WorkflowCompiler;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
public class SystemUtils {
private static final String T2FLOW_TYPE = "application/vnd.taverna.t2flow+xml";
[47/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
deleted file mode 100644
index f2f421c..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateAction.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.LicenseChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.SharingPolicyChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
deleted file mode 100644
index 21de032..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.family;
-
-import static net.sf.taverna.t2.component.ui.menu.family.ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
deleted file mode 100644
index 58ff4ce..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteAction.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.FamilyChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-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 uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
deleted file mode 100644
index d3e5ad1..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.family;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyMenuSection.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyMenuSection.java
deleted file mode 100644
index 40f6420..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/family/ComponentFamilyMenuSection.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.family;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.component.ui.menu.ComponentMenu;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
deleted file mode 100644
index a7acd82..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyAction.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.LicenseChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.SharingPolicyChooserPanel;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
deleted file mode 100644
index 6b30b00..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.profile;
-
-import static net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
deleted file mode 100644
index b5e7ed9..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.ProfileChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.Profile;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
deleted file mode 100644
index 846fbce..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.profile;
-
-import static net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
deleted file mode 100644
index dfc5d99..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportAction.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.LicenseChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.RegistryChooserPanel;
-import net.sf.taverna.t2.component.ui.panel.SharingPolicyChooserPanel;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
deleted file mode 100644
index 160c70d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileImportMenuAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.profile;
-
-import static net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.component.api.ComponentFactory;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileMenuSection.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileMenuSection.java
deleted file mode 100644
index b1b42ce..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/profile/ComponentProfileMenuSection.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.profile;
-
-import static net.sf.taverna.t2.component.ui.menu.ComponentMenu.COMPONENT;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageAction.java
deleted file mode 100644
index 81256ed..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.registry;
-
-import static net.sf.taverna.t2.component.ui.preference.ComponentPreferenceUIFactory.DISPLAY_NAME;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageMenuAction.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
deleted file mode 100644
index b9d17eb..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.registry;
-
-import static net.sf.taverna.t2.component.ui.menu.registry.ComponentRegistryMenuSection.COMPONENT_REGISTRY_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryMenuSection.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryMenuSection.java
deleted file mode 100644
index e74c4a2..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/menu/registry/ComponentRegistryMenuSection.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.menu.registry;
-
-import static net.sf.taverna.t2.component.ui.menu.ComponentMenu.COMPONENT;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
deleted file mode 100644
index e74c362..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChoiceMessage.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
deleted file mode 100644
index 344962f..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentChooserPanel.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
deleted file mode 100644
index a4c2121..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentListCellRenderer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
deleted file mode 100644
index 58f42fd..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ComponentVersionChooserPanel.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.SHORT_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
deleted file mode 100644
index 75ce6c0..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChoiceMessage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import org.apache.taverna.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
deleted file mode 100644
index 262bb5c..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/FamilyChooserPanel.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
deleted file mode 100644
index cdec8b9..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/LicenseChooserPanel.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
deleted file mode 100644
index 34b3485..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/PrefixPanel.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.Profile;
-
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
deleted file mode 100644
index eabad3b..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChoiceMessage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import org.apache.taverna.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;
- }
-}
[46/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
deleted file mode 100644
index e6077fa..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/ProfileChooserPanel.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
deleted file mode 100644
index f9a8fbb..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-
-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 net.sf.taverna.t2.component.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
deleted file mode 100644
index 8c81a1d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryAndFamilyChooserPanel.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
deleted file mode 100644
index d03a0b0..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChoiceMessage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import org.apache.taverna.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
deleted file mode 100644
index 0308d15..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/RegistryChooserPanel.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Registry;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
deleted file mode 100644
index f68500e..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SearchChoicePanel.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.preference.ComponentPreference;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
deleted file mode 100644
index 1519798..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/panel/SharingPolicyChooserPanel.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static net.sf.taverna.t2.component.ui.util.Utils.LONG_STRING;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-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;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
deleted file mode 100644
index c0a278a..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferencePanel.java
+++ /dev/null
@@ -1,283 +0,0 @@
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.util.Utils.URL_PATTERN;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-
-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;
-
-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) {
- 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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferenceUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferenceUIFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferenceUIFactory.java
deleted file mode 100644
index 8b7bf19..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/ComponentPreferenceUIFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.preference;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/LocalRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/LocalRegistryPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/LocalRegistryPanel.java
deleted file mode 100644
index 8f86786..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/LocalRegistryPanel.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-import org.apache.log4j.Logger;
-
-/**
- * @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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
deleted file mode 100644
index 1aa6084..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RegistryTableModel.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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 org.apache.taverna.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RemoteRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RemoteRegistryPanel.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RemoteRegistryPanel.java
deleted file mode 100644
index 58962cc..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/preference/RemoteRegistryPanel.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
deleted file mode 100644
index 35a945d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceDesc.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package net.sf.taverna.t2.component.ui.serviceprovider;
-
-import static java.util.Arrays.asList;
-import static net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
-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 java.net.URI;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-
-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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceIcon.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceIcon.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceIcon.java
deleted file mode 100644
index 5b796b2..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceIcon.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.sf.taverna.t2.component.ui.serviceprovider;
-
-import static net.sf.taverna.t2.component.ui.serviceprovider.Service.COMPONENT_ACTIVITY_URI;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
deleted file mode 100644
index 60294cd..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProvider.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.ui.ComponentConstants.ACTIVITY_URI;
-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 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 net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.panel.RegistryAndFamilyChooserPanel;
-import net.sf.taverna.t2.component.ui.util.Utils;
-import net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-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 uk.org.taverna.scufl2.api.common.Visitor;
-import uk.org.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;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
deleted file mode 100644
index 9f6f52d..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/ComponentServiceProviderConfig.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.sf.taverna.t2.component.ui.serviceprovider;
-
-import static net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider.providerId;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/Service.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/Service.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/Service.java
deleted file mode 100644
index af8ddb6..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/serviceprovider/Service.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentFileType.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentFileType.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentFileType.java
deleted file mode 100644
index b03296a..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentFileType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.sf.taverna.t2.component.ui.util;
-
-import net.sf.taverna.t2.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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
deleted file mode 100644
index 2a36fc3..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/ComponentHealthCheck.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package net.sf.taverna.t2.component.ui.util;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.component.ui.ComponentActivityConfigurationBean;
-
-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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Visitor;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor;
-
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
deleted file mode 100644
index ebd7c36..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/util/Utils.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.ui.util;
-
-import static net.sf.taverna.t2.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 uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Named;
-import uk.org.taverna.scufl2.api.common.NamedSet;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import net.sf.taverna.t2.component.preference.ComponentPreference;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon;
-import net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider;
-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/43334c1d/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java b/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
deleted file mode 100644
index 80b8640..0000000
--- a/taverna-component-activity-ui/src/main/java/net/sf/taverna/t2/component/ui/view/ComponentActivityContextViewFactory.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package net.sf.taverna.t2.component.ui.view;
-
-import static org.apache.taverna.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 org.apache.taverna.component.api.ComponentFactory;
-
-import uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import net.sf.taverna.t2.component.ui.config.ComponentConfigureAction;
-
-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>";
- }
- }
- }
-}
[33/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
deleted file mode 100644
index d2c6213..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package net.sf.taverna.t2.component;
-
-
-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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
deleted file mode 100644
index 0aba440..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
deleted file mode 100644
index 211c725..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
deleted file mode 100644
index ac9fc47..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-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 org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
deleted file mode 100644
index 962f8dd..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-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 org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
deleted file mode 100644
index 3bad69b..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Registry;
-
-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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
deleted file mode 100644
index a6ed62e..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
deleted file mode 100644
index 157edf7..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import static org.junit.Assert.assertSame;
-import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
-
-import org.apache.taverna.component.api.Registry;
-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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
deleted file mode 100644
index a65a416..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
deleted file mode 100644
index 8262ebc..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
deleted file mode 100644
index c015a96..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.component.registry.local;
-
-import static java.lang.System.getProperty;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-
-import java.io.File;
-
-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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
deleted file mode 100644
index 7874fa4..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
deleted file mode 100644
index 188e2e1..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.standard;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
-
-import org.apache.taverna.component.api.Version;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
deleted file mode 100644
index 6ea1cc0..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
deleted file mode 100644
index 4e428c7..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
deleted file mode 100644
index 18902e1..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
-import static net.sf.taverna.t2.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;
-
-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/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
deleted file mode 100644
index 930bc0c..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.sf.taverna.t2.util;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.ReaderException;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class AnnotationTest {
- //uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..aa711fb
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
@@ -0,0 +1,30 @@
+package org.apache.taverna.component;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.apache.taverna.component.utils.AnnotationUtils;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.ReaderException;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class AnnotationTest {
+ //uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..322b848
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
@@ -0,0 +1,107 @@
+package org.apache.taverna.component;
+
+import org.apache.taverna.component.ComponentActivity;
+import org.apache.taverna.component.ComponentActivityConfigurationBean;
+import org.apache.taverna.component.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/fb982e2f/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
new file mode 100644
index 0000000..f4fea1f
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+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 org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..6aa0591
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..71549df
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+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 org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..fdff6b6
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import static org.junit.Assert.assertEquals;
+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 org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.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/fb982e2f/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
new file mode 100644
index 0000000..a1b6576
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
@@ -0,0 +1,12 @@
+package org.apache.taverna.component.registry;
+
+import java.net.URL;
+
+import org.apache.taverna.component.api.Registry;
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..a0e710c
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..f36ccc3
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package 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 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/fb982e2f/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
new file mode 100644
index 0000000..f359675
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import org.apache.taverna.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/fb982e2f/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
new file mode 100644
index 0000000..6671daa
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import org.apache.taverna.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();
+ }
+}
[37/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
deleted file mode 100644
index e84e23d..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/Component.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.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
- org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
deleted file mode 100644
index d37dd52..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentFamily.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import java.util.ArrayList;
-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 uk.org.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
- org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
deleted file mode 100644
index 11ab51c..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentImplementationCache.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry;
-
-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 org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
deleted file mode 100644
index 8c24164..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentRegistry.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-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 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;
-
-/**
- * A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
- *
- * @author David Withers
- */
-public abstract class ComponentRegistry implements
- org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
deleted file mode 100644
index 927d937..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentUtil.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.profile.BaseProfileLocator;
-import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
-import net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory;
-import net.sf.taverna.t2.component.registry.standard.NewComponentRegistryFactory;
-
-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.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
deleted file mode 100644
index 52d7fa0..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersion.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry;
-
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-public abstract class ComponentVersion implements
- org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
deleted file mode 100644
index 68b55ac..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ComponentVersionIdentification.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.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;
-
-/**
- * @author alanrw
- *
- */
-public class ComponentVersionIdentification implements
- org.apache.taverna.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,
- org.apache.taverna.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(org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
deleted file mode 100644
index 85d203d..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponent.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-import static net.sf.taverna.t2.component.registry.local.LocalComponentRegistry.ENC;
-import static org.apache.commons.io.FileUtils.readFileToString;
-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.util.NoSuchElementException;
-
-import net.sf.taverna.t2.component.registry.Component;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-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 uk.org.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
deleted file mode 100644
index fea0f88..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamily.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-import static net.sf.taverna.t2.component.registry.local.LocalComponentRegistry.ENC;
-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 java.io.File;
-import java.io.IOException;
-
-import net.sf.taverna.t2.component.registry.ComponentFamily;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-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 uk.org.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);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
deleted file mode 100644
index 102b448..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistry.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-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 net.sf.taverna.t2.component.profile.ComponentProfileImpl;
-import net.sf.taverna.t2.component.registry.ComponentRegistry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-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;
-
-/**
- * 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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
deleted file mode 100644
index 0f61f48..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.sf.taverna.t2.component.registry.local;
-
-import java.io.File;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Registry;
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
deleted file mode 100644
index 874bc7f..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersion.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.registry.local;
-
-import static java.lang.Integer.parseInt;
-import static net.sf.taverna.t2.component.registry.local.LocalComponent.COMPONENT_FILENAME;
-import static org.apache.commons.io.FileUtils.readFileToString;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import net.sf.taverna.t2.component.registry.ComponentVersion;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-
-import uk.org.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
deleted file mode 100644
index 5b70a7d..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Client.java
+++ /dev/null
@@ -1,637 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-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 net.sf.taverna.t2.component.registry.ClientVersion.VERSION;
-import static org.apache.commons.io.IOUtils.copy;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
-import net.sf.taverna.t2.component.registry.standard.annotations.Unused;
-import net.sf.taverna.t2.security.credentialmanager.CMException;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.security.credentialmanager.UsernamePassword;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
deleted file mode 100644
index c33d610..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponent.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static java.lang.String.format;
-import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.logger;
-import static net.sf.taverna.t2.component.registry.standard.Policy.getPolicy;
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-import static net.sf.taverna.t2.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 net.sf.taverna.t2.component.registry.Component;
-import net.sf.taverna.t2.component.registry.ComponentVersion;
-import net.sf.taverna.t2.component.registry.api.ComponentType;
-import net.sf.taverna.t2.component.registry.api.Description;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import uk.org.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;
- }
-}
[36/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
deleted file mode 100644
index ab31ffd..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamily.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.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 net.sf.taverna.t2.component.registry.ComponentFamily;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
-import net.sf.taverna.t2.component.registry.api.Description;
-import uk.org.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
deleted file mode 100644
index 623d6e6..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentLicense.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import org.apache.taverna.component.api.License;
-
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
deleted file mode 100644
index f4982db..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentProfile.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.taverna.component.api.ComponentException;
-
-import net.sf.taverna.t2.component.profile.BaseProfileLocator;
-import net.sf.taverna.t2.component.profile.ComponentProfileImpl;
-import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
deleted file mode 100644
index 819383b..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistry.java
+++ /dev/null
@@ -1,469 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.standard.Policy.PRIVATE;
-import static net.sf.taverna.t2.component.utils.SystemUtils.getElementString;
-import static org.apache.log4j.Logger.getLogger;
-
-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 net.sf.taverna.t2.component.registry.ComponentRegistry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
-import net.sf.taverna.t2.component.registry.api.ComponentDescriptionList;
-import net.sf.taverna.t2.component.registry.api.ComponentFamilyList;
-import net.sf.taverna.t2.component.registry.api.ComponentFamilyType;
-import net.sf.taverna.t2.component.registry.api.ComponentProfileList;
-import net.sf.taverna.t2.component.registry.api.ComponentProfileType;
-import net.sf.taverna.t2.component.registry.api.ComponentType;
-import net.sf.taverna.t2.component.registry.api.Content;
-import net.sf.taverna.t2.component.registry.api.Description;
-import net.sf.taverna.t2.component.registry.api.LicenseList;
-import net.sf.taverna.t2.component.registry.api.LicenseType;
-import net.sf.taverna.t2.component.registry.api.ObjectFactory;
-import net.sf.taverna.t2.component.registry.api.Permissions;
-import net.sf.taverna.t2.component.registry.api.PolicyList;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-
-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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
deleted file mode 100644
index a441231..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.jaxbContext;
-import static net.sf.taverna.t2.component.registry.standard.NewComponentRegistry.logger;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.component.registry.ComponentRegistry;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-
-import org.apache.taverna.component.api.ComponentException;
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
deleted file mode 100644
index bbcecbb..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/Policy.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static java.lang.System.identityHashCode;
-import static net.sf.taverna.t2.component.registry.api.Privilege.DOWNLOAD;
-import static net.sf.taverna.t2.component.registry.api.Privilege.VIEW;
-
-import org.apache.taverna.component.api.SharingPolicy;
-
-import net.sf.taverna.t2.component.registry.api.Permissions;
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
deleted file mode 100644
index 7c6e061..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/Unused.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard.annotations;
-
-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 {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
deleted file mode 100644
index fd48b0b..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/annotations/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Miscellaneous annotations on other parts of the component engine.
- *
- * @author Donal Fellows
- */
-package net.sf.taverna.t2.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
deleted file mode 100644
index 1889391..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/standard/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * This is the new interface to the myExperiment registry, a.k.a. μExperiment.
- * @author Donal Fellows
- */
-package net.sf.taverna.t2.component.registry.standard;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
deleted file mode 100644
index 51185d5..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/AnnotationUtils.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package net.sf.taverna.t2.component.utils;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.WeakHashMap;
-
-import uk.org.taverna.scufl2.api.annotation.Annotation;
-import uk.org.taverna.scufl2.api.common.Child;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.common.URITools;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.rdf.model.Property;
-import com.hp.hpl.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
deleted file mode 100644
index 4e7442a..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/utils/SystemUtils.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package net.sf.taverna.t2.component.utils;
-
-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 org.apache.taverna.component.api.ComponentException;
-
-import net.sf.taverna.t2.component.registry.api.Description;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-import uk.org.taverna.platform.execution.api.WorkflowCompiler;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-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();
- }
-
- 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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java
new file mode 100644
index 0000000..db10175
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java
@@ -0,0 +1,152 @@
+package org.apache.taverna.component;
+
+import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.getAnnotationString;
+import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.setAnnotationString;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
+import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
+import net.sf.taverna.t2.invocation.InvocationContext;
+import net.sf.taverna.t2.invocation.impl.InvocationContextImpl;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.Dataflow;
+import net.sf.taverna.t2.workflowmodel.EditException;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+
+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 uk.org.taverna.platform.execution.api.InvalidWorkflowException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+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 = getAnnotationString(realizingDataflow,
+ SemanticAnnotation.class, null);
+ if (annotationValue != null)
+ 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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java
new file mode 100644
index 0000000..45448b5
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java
@@ -0,0 +1,145 @@
+package org.apache.taverna.component;
+
+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 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 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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * 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 (org.apache.taverna.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));
+ for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
+ outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
+
+ try {
+ eh = util.getFamily(getRegistryBase(), getFamilyName())
+ .getComponentProfile().getExceptionHandling();
+ if (eh != null)
+ outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
+ } catch (org.apache.taverna.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 org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java
new file mode 100644
index 0000000..59e893d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java
@@ -0,0 +1,125 @@
+package org.apache.taverna.component;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
+import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+
+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 org.springframework.beans.factory.annotation.Required;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java
new file mode 100644
index 0000000..32baaf6
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java
@@ -0,0 +1,52 @@
+package org.apache.taverna.component;
+
+import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
+import static org.apache.taverna.component.ComponentHealthCheck.NON_SHAREABLE;
+
+import java.util.List;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java
new file mode 100644
index 0000000..3304cc4
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java
@@ -0,0 +1,69 @@
+/**
+ *
+ */
+package org.apache.taverna.component;
+
+import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
+import static org.apache.log4j.Logger.getLogger;
+import static org.apache.taverna.component.ComponentHealthCheck.OUT_OF_DATE;
+
+import java.util.List;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.registry.ComponentUtil;
+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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java
new file mode 100644
index 0000000..7f100dc
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.apache.taverna.component;
+
+/**
+ * @author alanrw
+ *
+ */
+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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java
new file mode 100644
index 0000000..dee1052
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java
new file mode 100644
index 0000000..f443f6d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package org.apache.taverna.component;
+
+/**
+ * @author alanrw
+ *
+ */
+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/fb982e2f/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java
new file mode 100644
index 0000000..3e7d2cd
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java
@@ -0,0 +1,250 @@
+/**
+ *
+ */
+package org.apache.taverna.component;
+
+import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
+import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
+import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
+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 net.sf.taverna.t2.invocation.InvocationContext;
+import net.sf.taverna.t2.reference.ErrorDocument;
+import net.sf.taverna.t2.reference.ErrorDocumentService;
+import net.sf.taverna.t2.reference.IdentifiedList;
+import net.sf.taverna.t2.reference.ListService;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
+
+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;
+
+/**
+ * @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/fb982e2f/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
new file mode 100644
index 0000000..fb3029a
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package 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 net.sf.taverna.t2.component.api.profile.doc.Activity;
+import net.sf.taverna.t2.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;
+ }
+}
[40/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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
new file mode 100644
index 0000000..1c3bb2a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
@@ -0,0 +1,121 @@
+package org.apache.taverna.component.ui.view;
+
+import static org.apache.taverna.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 org.apache.taverna.component.api.ComponentFactory;
+import org.apache.taverna.component.ui.config.ComponentConfigureAction;
+
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..7151c7f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
@@ -0,0 +1,135 @@
+package org.apache.taverna.component.ui.view;
+
+import static org.apache.log4j.Logger.getLogger;
+import static org.apache.taverna.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 uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputActivityPort;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.Port;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+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/43334c1d/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
new file mode 100644
index 0000000..6e45c84
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
@@ -0,0 +1,93 @@
+package org.apache.taverna.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 org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static org.apache.taverna.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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.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/43334c1d/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
new file mode 100644
index 0000000..349e298
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
@@ -0,0 +1,42 @@
+package org.apache.taverna.component.ui.view;
+
+import static org.apache.taverna.component.api.config.ComponentConfig.URI;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.component.api.Version;
+
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+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/43334c1d/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
new file mode 100644
index 0000000..adca544
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
@@ -0,0 +1,75 @@
+package org.apache.taverna.component.ui.view;
+
+import static java.lang.String.format;
+//import static org.apache.taverna.component.ui.view.ViewUtil.getRawTablesHtml;
+import static net.sf.taverna.t2.lang.ui.HtmlUtils.buildTableOpeningTag;
+import static net.sf.taverna.t2.lang.ui.HtmlUtils.createEditorPane;
+import static net.sf.taverna.t2.lang.ui.HtmlUtils.getHtmlHead;
+import static net.sf.taverna.t2.lang.ui.HtmlUtils.panelForHtml;
+
+import java.awt.Color;
+
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+
+import org.apache.taverna.component.api.Version;
+
+import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
+import net.sf.taverna.t2.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 = createEditorPane(buildHtml());
+ return panelForHtml(editorPane);
+ }
+
+ private String buildHtml() {
+ StringBuilder html = new StringBuilder(getHtmlHead(getBackgroundColour()));
+ html.append(buildTableOpeningTag());
+ viewUtils.getRawTablesHtml(component, html);
+ return html.append("</table></body></html>").toString();
+ }
+
+ public String getBackgroundColour() {
+ Color colour = colourManager.getPreferredColour(
+ "org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..b6f6800
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
@@ -0,0 +1,162 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 uk.org.taverna.scufl2.api.configurations.Configuration;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.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/43334c1d/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.component.annotation.PropertyPanelFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.component.annotation.PropertyPanelFactorySPI b/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.component.annotation.PropertyPanelFactorySPI
index 920dcd1..c025707 100644
--- a/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.component.annotation.PropertyPanelFactorySPI
+++ b/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.component.annotation.PropertyPanelFactorySPI
@@ -1,5 +1,5 @@
-net.sf.taverna.t2.component.annotation.AnnotationPropertyPanelFactory
-net.sf.taverna.t2.component.annotation.DatatypePropertyPanelFactory
-net.sf.taverna.t2.component.annotation.ObjectPropertyWithIndividualsPanelFactory
-net.sf.taverna.t2.component.annotation.DateTimePropertyPanelFactory
-net.sf.taverna.t2.component.annotation.FallbackPropertyPanelFactory
\ No newline at end of file
+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
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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 72e27be..829fdbc 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 @@
-net.sf.taverna.t2.component.ui.file.ComponentDataflowHealthCheckExplainer
+org.apache.taverna.component.ui.file.ComponentDataflowHealthCheckExplainer
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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 4c03aba..18444d4 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
@@ -10,16 +10,16 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/beans/spring-util.xsd">
<context:annotation-config />
- <bean id="prefs" class="net.sf.taverna.t2.component.preference.ComponentPreference">
+ <bean id="prefs" class="org.apache.taverna.component.ui.preference.ComponentPreference">
<constructor-arg name="cm" ref="configManager" />
<constructor-arg name="factory" ref="componentFactory" />
</bean>
- <bean id="preferencePanel" class="net.sf.taverna.t2.component.ui.preference.ComponentPreferencePanel">
+ <bean id="preferencePanel" class="org.apache.taverna.component.ui.preference.ComponentPreferencePanel">
<constructor-arg name="componentFactory" ref="componentFactory" />
<constructor-arg name="preferences" ref="prefs" />
</bean>
<bean id="componentSupport"
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentCreatorSupport">
+ class="org.apache.taverna.component.ui.menu.component.ComponentCreatorSupport">
<property name="componentFactory" ref="componentFactory" />
<property name="preferences" ref="prefs" />
<property name="fileManager" ref="fileManager" />
@@ -27,9 +27,9 @@
<property name="fileType" ref="fileType" />
<property name="selectionManager" ref="selectionManager" />
</bean>
- <bean id="fileType" class="net.sf.taverna.t2.component.ui.util.ComponentFileType" />
- <bean id="icon" class="net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceIcon" />
- <bean id="utils" class="net.sf.taverna.t2.component.ui.util.Utils">
+ <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">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
@@ -43,7 +43,7 @@
<entry key="name" value="componentServiceProvider" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.serviceprovider.ComponentServiceProvider">
+ class="org.apache.taverna.component.ui.serviceprovider.ComponentServiceProvider">
<constructor-arg ref="componentFactory" index="0" />
<constructor-arg ref="prefs" index="1" />
<constructor-arg ref="icon" index="2" />
@@ -56,7 +56,7 @@
<!-- === Startup === -->
<osgi:service interface="net.sf.taverna.t2.workbench.StartupSPI">
- <bean class="net.sf.taverna.t2.component.ui.file.FileManagerObserver">
+ <bean class="org.apache.taverna.component.ui.file.FileManagerObserver">
<property name="colourManager" ref="colourManager" />
<property name="fileManager" ref="fileManager" />
<property name="graphView" ref="graphView" />
@@ -66,13 +66,13 @@
<!-- === Dataflow persistence handlers === -->
<osgi:service interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler">
- <bean class="net.sf.taverna.t2.component.ui.file.ComponentOpener">
+ <bean class="org.apache.taverna.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="net.sf.taverna.t2.component.ui.file.ComponentSaver">
+ <bean class="org.apache.taverna.component.ui.file.ComponentSaver">
<property name="componentFactory" ref="componentFactory" />
<property name="fileType" ref="fileType" />
</bean>
@@ -80,7 +80,7 @@
<!-- === Health checkers === -->
<osgi:service interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker">
- <bean class="net.sf.taverna.t2.component.ui.file.ComponentDataflowHealthChecker">
+ <bean class="org.apache.taverna.component.ui.file.ComponentDataflowHealthChecker">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -92,7 +92,7 @@
<entry key="name" value="componentConfigurationUI" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.preference.ComponentPreferenceUIFactory">
+ class="org.apache.taverna.component.ui.preference.ComponentPreferenceUIFactory">
<property name="configPanel" ref="preferencePanel" />
<property name="preferences" ref="prefs" />
</bean>
@@ -105,7 +105,7 @@
<entry key="name" value="componentActivityContextView" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.view.ComponentActivityContextViewFactory">
+ class="org.apache.taverna.component.ui.view.ComponentActivityContextViewFactory">
<property name="colourManager" ref="colourManager" />
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
@@ -121,7 +121,7 @@
<osgi:service-properties>
<entry key="name" value="componentContextView" />
</osgi:service-properties>
- <bean class="net.sf.taverna.t2.component.ui.view.ComponentContextViewFactory">
+ <bean class="org.apache.taverna.component.ui.view.ComponentContextViewFactory">
<property name="fileManager" ref="fileManager" />
</bean>
</osgi:service>
@@ -131,7 +131,7 @@
<entry key="name" value="componentActivitySemanticAnnotationContextView" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.view.ComponentActivitySemanticAnnotationContextViewFactory">
+ class="org.apache.taverna.component.ui.view.ComponentActivitySemanticAnnotationContextViewFactory">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -142,7 +142,7 @@
<entry key="name" value="semanticAnnotationContextView" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.annotation.SemanticAnnotationContextualViewFactory">
+ class="org.apache.taverna.component.ui.annotation.SemanticAnnotationContextualViewFactory">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -154,7 +154,7 @@
<entry key="name" value="componentConfigureAction" />
</osgi:service-properties>
<bean id="componentConfigureMenuAction"
- class="net.sf.taverna.t2.component.ui.menu.ComponentConfigureMenuAction">
+ class="org.apache.taverna.component.ui.menu.ComponentConfigureMenuAction">
<property name="activityIconManager" ref="iconManager" />
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
@@ -164,7 +164,7 @@
</bean>
</osgi:service>
<bean id="componentServiceCreatorMenuAction"
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentServiceCreatorMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.ComponentServiceCreatorMenuAction">
<description>Don't publish this bean yet.</description>
<property name="icon" ref="icon" />
<property name="selectionManager" ref="selectionManager" />
@@ -175,7 +175,7 @@
<entry key="name" value="nestedWorkflowCreatorAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.NestedWorkflowCreatorMenuAction">
+ class="org.apache.taverna.component.ui.menu.NestedWorkflowCreatorMenuAction">
<property name="editManager" ref="editManager" />
<property name="graphView" ref="graphView" />
<property name="selectionManager" ref="selectionManager" />
@@ -186,7 +186,7 @@
<entry key="name" value="componentReplaceAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.ReplaceByComponentMenuAction">
+ class="org.apache.taverna.component.ui.menu.ReplaceByComponentMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
<property name="icon" ref="icon" />
@@ -199,7 +199,7 @@
<entry key="name" value="componentOpenAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.OpenComponentFromComponentActivityMenuAction">
+ class="org.apache.taverna.component.ui.menu.OpenComponentFromComponentActivityMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
<property name="graphView" ref="graphView" />
@@ -209,19 +209,19 @@
</bean>
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
- <bean class="net.sf.taverna.t2.component.ui.menu.ComponentMenu" />
+ <bean class="org.apache.taverna.component.ui.menu.ComponentMenu" />
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="net.sf.taverna.t2.component.ui.menu.registry.ComponentRegistryMenuSection" />
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.ui.menu.registry.ComponentRegistryManageMenuAction">
+ class="org.apache.taverna.component.ui.menu.registry.ComponentRegistryManageMenuAction">
<property name="configurationFrame"><!-- FIXME --></property>
<property name="icon" ref="icon" />
</bean>
@@ -229,14 +229,14 @@
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileMenuSection" />
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileImportMenuAction">
+ class="org.apache.taverna.component.ui.menu.profile.ComponentProfileImportMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
@@ -247,27 +247,27 @@
<entry key="name" value="componentProfileCopyAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileCopyMenuAction">
+ class="org.apache.taverna.component.ui.menu.profile.ComponentProfileCopyMenuAction">
<property name="preferences" ref="prefs" />
<property name="icon" ref="icon" />
</bean>
</osgi:service>
<bean id="componentProfileDeleteMenuAction"
- class="net.sf.taverna.t2.component.ui.menu.profile.ComponentProfileDeleteMenuAction">
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.ui.menu.family.ComponentFamilyMenuSection" />
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.ui.menu.family.ComponentFamilyCreateMenuAction">
+ class="org.apache.taverna.component.ui.menu.family.ComponentFamilyCreateMenuAction">
<property name="preferences" ref="prefs" />
<property name="icon" ref="icon" />
</bean>
@@ -277,7 +277,7 @@
<entry key="name" value="componentFamilyDeleteAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.family.ComponentFamilyDeleteMenuAction">
+ class="org.apache.taverna.component.ui.menu.family.ComponentFamilyDeleteMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
@@ -287,14 +287,14 @@
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentMenuSection" />
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.ui.menu.component.ComponentWorkflowCreatorMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.ComponentWorkflowCreatorMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="graphView" ref="graphView" />
<property name="icon" ref="icon" />
@@ -307,7 +307,7 @@
<entry key="name" value="componentOpenAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.FileOpenFromComponentMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.FileOpenFromComponentMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="fileType" ref="fileType" />
<property name="graphView" ref="graphView" />
@@ -320,7 +320,7 @@
<entry key="name" value="componentCopyAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentCopyMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.ComponentCopyMenuAction">
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
<property name="utils" ref="utils" />
@@ -331,7 +331,7 @@
<entry key="name" value="componentDeleteAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentDeleteMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.ComponentDeleteMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
@@ -343,7 +343,7 @@
<entry key="name" value="componentMergeAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentMergeMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.ComponentMergeMenuAction">
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
</bean>
@@ -353,7 +353,7 @@
<entry key="name" value="componentCloseAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentCloseMenuAction">
+ class="org.apache.taverna.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" />
@@ -365,7 +365,7 @@
<entry key="name" value="componentSaveAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentSaveMenuAction">
+ class="org.apache.taverna.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" />
@@ -373,7 +373,7 @@
</bean>
</osgi:service>
<bean id="componentSearchMenuAction"
- class="net.sf.taverna.t2.component.ui.menu.component.ComponentSearchMenuAction">
+ class="org.apache.taverna.component.ui.menu.component.ComponentSearchMenuAction">
<description>Don't publish this bean yet.</description>
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
@@ -389,7 +389,7 @@
<entry key="name" value="annotateSemanticsAction" />
</osgi:service-properties>
<bean
- class="net.sf.taverna.t2.component.annotation.AnnotateSemanticsMenuAction">
+ class="org.apache.taverna.component.ui.annotation.AnnotateSemanticsMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -397,16 +397,16 @@
<!--
<bean id="ComponentLocalHealthChecker"
- class="net.sf.taverna.t2.component.ComponentActivityLocalChecker" />
+ class="org.apache.taverna.component.ComponentActivityLocalChecker" />
<bean id="ComponentUpgradeHealthChecker"
- class="net.sf.taverna.t2.component.ComponentActivityUpgradeChecker">
+ class="org.apache.taverna.component.ComponentActivityUpgradeChecker">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="baseProfileLocator" class="net.sf.taverna.t2.component.profile.BaseProfileLocator">
+ <bean id="baseProfileLocator" class="org.apache.taverna.component.profile.BaseProfileLocator">
<property name="appConfig" ref="app-config" />
</bean>
- <bean id="componentActivityFactory" class="net.sf.taverna.t2.component.ComponentActivityFactory">
+ <bean id="componentActivityFactory" class="org.apache.taverna.component.ComponentActivityFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="dataflowCache" ref="cache" />
<property name="edits" ref="edits" />
@@ -414,32 +414,32 @@
</bean>
<bean id="networkRegistry"
- class="net.sf.taverna.t2.component.registry.standard.NewComponentRegistryFactory">
+ class="org.apache.taverna.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="net.sf.taverna.t2.component.registry.local.LocalComponentRegistryFactory">
+ class="org.apache.taverna.component.registry.local.LocalComponentRegistryFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="systemUtils" ref="systemUtil" />
</bean>
- <bean id="componentUtil" class="net.sf.taverna.t2.component.registry.ComponentUtil">
+ <bean id="componentUtil" class="org.apache.taverna.component.registry.ComponentUtil">
<property name="networkLocator" ref="networkRegistry" />
<property name="fileLocator" ref="fileRegistry" />
<property name="baseLocator" ref="baseProfileLocator" />
</bean>
- <bean id="cache" class="net.sf.taverna.t2.component.registry.ComponentImplementationCache">
+ <bean id="cache" class="org.apache.taverna.component.registry.ComponentImplementationCache">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="systemUtil" class="net.sf.taverna.t2.component.utils.SystemUtils">
+ <bean id="systemUtil" class="org.apache.taverna.component.utils.SystemUtils">
<property name="appConfig" ref="app-config" />
<property name="workflowBundler" ref="workflowBundleIO" />
<property name="compilers" ref="compilers" />
</bean>
- <bean id="annotationUtil" class="net.sf.taverna.t2.component.utils.AnnotationUtils" />
+ <bean id="annotationUtil" class="org.apache.taverna.component.utils.AnnotationUtils" />
<osgi:service ref="ComponentLocalHealthChecker"
interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
[23/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository -> taverna-component-repository-api
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/catalog/xml.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/catalog/xml.xsd b/taverna-component-repository-api/src/main/catalog/xml.xsd
new file mode 100644
index 0000000..aea7d0d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/catalog/xml.xsd
@@ -0,0 +1,287 @@
+<?xml version='1.0'?>
+<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns ="http://www.w3.org/1999/xhtml"
+ xml:lang="en">
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+ <h1>About the XML namespace</h1>
+
+ <div class="bodytext">
+ <p>
+ This schema document describes the XML namespace, in a form
+ suitable for import by other schema documents.
+ </p>
+ <p>
+ See <a href="http://www.w3.org/XML/1998/namespace.html">
+ http://www.w3.org/XML/1998/namespace.html</a> and
+ <a href="http://www.w3.org/TR/REC-xml">
+ http://www.w3.org/TR/REC-xml</a> for information
+ about this namespace.
+ </p>
+ <p>
+ Note that local names in this namespace are intended to be
+ defined only by the World Wide Web Consortium or its subgroups.
+ The names currently defined in this namespace are listed below.
+ They should not be used with conflicting semantics by any Working
+ Group, specification, or document instance.
+ </p>
+ <p>
+ See further below in this document for more information about <a
+ href="#usage">how to refer to this schema document from your own
+ XSD schema documents</a> and about <a href="#nsversioning">the
+ namespace-versioning policy governing this schema document</a>.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>lang (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ is a language code for the natural language of the content of
+ any element; its value is inherited. This name is reserved
+ by virtue of its definition in the XML specification.</p>
+
+ </div>
+ <div>
+ <h4>Notes</h4>
+ <p>
+ Attempting to install the relevant ISO 2- and 3-letter
+ codes as the enumerated possible values is probably never
+ going to be a realistic possibility.
+ </p>
+ <p>
+ See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
+ http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
+ and the IANA language subtag registry at
+ <a href="http://www.iana.org/assignments/language-subtag-registry">
+ http://www.iana.org/assignments/language-subtag-registry</a>
+ for further information.
+ </p>
+ <p>
+ The union allows for the 'un-declaration' of xml:lang with
+ the empty string.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:language">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="space">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>space (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose
+ value is a keyword indicating what whitespace processing
+ discipline is intended for the content of the element; its
+ value is inherited. This name is reserved by virtue of its
+ definition in the XML specification.</p>
+
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>base (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ provides a URI to be used as the base for interpreting any
+ relative URIs in the scope of the element on which it
+ appears; its value is inherited. This name is reserved
+ by virtue of its definition in the XML Base specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="id" type="xs:ID">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>id (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ should be interpreted as if declared to be of type ID.
+ This name is reserved by virtue of its definition in the
+ xml:id specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+ <xs:attribute ref="xml:base"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute ref="xml:space"/>
+ <xs:attribute ref="xml:id"/>
+ </xs:attributeGroup>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>Father (in any context at all)</h3>
+
+ <div class="bodytext">
+ <p>
+ denotes Jon Bosak, the chair of
+ the original XML Working Group. This name is reserved by
+ the following decision of the W3C XML Plenary and
+ XML Coordination groups:
+ </p>
+ <blockquote>
+ <p>
+ In appreciation for his vision, leadership and
+ dedication the W3C XML Plenary on this 10th day of
+ February, 2000, reserves for Jon Bosak in perpetuity
+ the XML name "xml:Father".
+ </p>
+ </blockquote>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div xml:id="usage" id="usage">
+ <h2><a name="usage">About this schema document</a></h2>
+
+ <div class="bodytext">
+ <p>
+ This schema defines attributes and an attribute group suitable
+ for use by schemas wishing to allow <code>xml:base</code>,
+ <code>xml:lang</code>, <code>xml:space</code> or
+ <code>xml:id</code> attributes on elements they define.
+ </p>
+ <p>
+ To enable this, such a schema must import this schema for
+ the XML namespace, e.g. as follows:
+ </p>
+ <pre>
+ <schema . . .>
+ . . .
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ </pre>
+ <p>
+ or
+ </p>
+ <pre>
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+ </pre>
+ <p>
+ Subsequently, qualified reference to any of the attributes or the
+ group defined below will have the desired effect, e.g.
+ </p>
+ <pre>
+ <type . . .>
+ . . .
+ <attributeGroup ref="xml:specialAttrs"/>
+ </pre>
+ <p>
+ will define a type which will schema-validate an instance element
+ with any of those attributes.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div id="nsversioning" xml:id="nsversioning">
+ <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
+ <div class="bodytext">
+ <p>
+ In keeping with the XML Schema WG's standard versioning
+ policy, this schema document will persist at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a>.
+ </p>
+ <p>
+ At the date of issue it can also be found at
+ <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd</a>.
+ </p>
+ <p>
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XML
+ Schema itself, or with the XML namespace itself. In other words,
+ if the XML Schema or XML namespaces change, the version of this
+ document at <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd
+ </a>
+ will change accordingly; the version at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd
+ </a>
+ will not change.
+ </p>
+ <p>
+ Previous dated (and unchanging) versions of this schema
+ document are at:
+ </p>
+ <ul>
+ <li><a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2007/08/xml.xsd">
+ http://www.w3.org/2007/08/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2004/10/xml.xsd">
+ http://www.w3.org/2004/10/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2001/03/xml.xsd">
+ http://www.w3.org/2001/03/xml.xsd</a></li>
+ </ul>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+</xs:schema>
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java
new file mode 100644
index 0000000..47bc7e9
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Component.java
@@ -0,0 +1,71 @@
+package net.sf.taverna.t2.component.api;
+
+import java.net.URL;
+import java.util.SortedMap;
+
+import uk.org.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
new file mode 100644
index 0000000..2b5d829
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.api;
+
+/**
+ * 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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
new file mode 100644
index 0000000..8c7d533
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
@@ -0,0 +1,27 @@
+package net.sf.taverna.t2.component.api;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java
new file mode 100644
index 0000000..f618af7
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Family.java
@@ -0,0 +1,99 @@
+package net.sf.taverna.t2.component.api;
+
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.profile.Profile;
+import uk.org.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java
new file mode 100644
index 0000000..7e7594d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/License.java
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api;
+
+/**
+ * @author alson
+ *
+ */
+public interface License extends NamedItem {
+ public String getAbbreviation();
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
new file mode 100644
index 0000000..a31ad4d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
@@ -0,0 +1,8 @@
+package net.sf.taverna.t2.component.api;
+
+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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java
new file mode 100644
index 0000000..f7b5be4
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Registry.java
@@ -0,0 +1,139 @@
+package net.sf.taverna.t2.component.api;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import net.sf.taverna.t2.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
new file mode 100644
index 0000000..ba91276
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api;
+
+/**
+ * @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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java
new file mode 100644
index 0000000..3f81739
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/Version.java
@@ -0,0 +1,206 @@
+package net.sf.taverna.t2.component.api;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import uk.org.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
new file mode 100644
index 0000000..172662d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
@@ -0,0 +1,5 @@
+package net.sf.taverna.t2.component.api.config;
+
+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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
new file mode 100644
index 0000000..baa8bb3
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
@@ -0,0 +1,14 @@
+package net.sf.taverna.t2.component.api.config;
+
+/**
+ * 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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java
new file mode 100644
index 0000000..4af7984
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * An abstract API for working with components in a registry.
+ * @author Donal Fellows
+ * @author David Withers
+ */
+package net.sf.taverna.t2.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
new file mode 100644
index 0000000..f656dd0
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
@@ -0,0 +1,5 @@
+package net.sf.taverna.t2.component.api.profile;
+
+public interface ActivityProfile extends AnnotatedElement {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
new file mode 100644
index 0000000..dafec43
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
@@ -0,0 +1,10 @@
+package net.sf.taverna.t2.component.api.profile;
+
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+
+public interface AnnotatedElement {
+ List<SemanticAnnotationProfile> getSemanticAnnotations()
+ throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
new file mode 100644
index 0000000..5172f94
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
@@ -0,0 +1,32 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api.profile;
+
+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(
+ net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
+ for (net.sf.taverna.t2.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
new file mode 100644
index 0000000..e71c5ec
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api.profile;
+
+import net.sf.taverna.t2.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
new file mode 100644
index 0000000..1c3332b
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api.profile;
+
+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(
+ net.sf.taverna.t2.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
new file mode 100644
index 0000000..5d66de8
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
@@ -0,0 +1,5 @@
+package net.sf.taverna.t2.component.api.profile;
+
+
+public interface PortProfile extends AnnotatedElement {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
new file mode 100644
index 0000000..c0899f8
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
@@ -0,0 +1,47 @@
+package net.sf.taverna.t2.component.api.profile;
+
+import java.util.List;
+import java.util.Map;
+
+import net.sf.taverna.t2.component.api.NamedItem;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.ComponentException;
+
+import com.hp.hpl.jena.ontology.OntModel;
+
+public interface Profile extends NamedItem, AnnotatedElement {
+
+ Registry getComponentRegistry();
+
+ String getXML() throws ComponentException;
+
+ net.sf.taverna.t2.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/c70b61ee/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
new file mode 100644
index 0000000..3000576
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
@@ -0,0 +1,54 @@
+package net.sf.taverna.t2.component.api.profile;
+
+import java.util.List;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.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/c70b61ee/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
new file mode 100644
index 0000000..95b4405
--- /dev/null
+++ b/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
@@ -0,0 +1,261 @@
+<?xml version="1.0"?>
+<xs:schema targetNamespace="http://ns.taverna.org.uk/2012/component/profile"
+ elementFormDefault="qualified" xmlns="http://ns.taverna.org.uk/2012/component/profile"
+ xmlns:cp="http://ns.taverna.org.uk/2012/component/profile" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
+ jxb:version="2.1">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:schemaBindings>
+ <jxb:package name="net.sf.taverna.t2.component.api.profile.doc" />
+ </jxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/2001/XMLSchema"
+ schemaLocation="http://www.w3.org/2001/XMLSchema.xsd" />
+
+ <xs:simpleType name="name">
+ <xs:annotation>
+ <xs:documentation>A valid name for a port or activity in a Taverna
+ workflow.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="([a-zA_Z0-9_])+" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="componentElements">
+ <xs:annotation>
+ <xs:documentation>
+ The component elements that can be annotated.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="InputPort"></xs:enumeration>
+ <xs:enumeration value="OutputPort"></xs:enumeration>
+ <xs:enumeration value="Activity"></xs:enumeration>
+ <xs:enumeration value="Component"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="basicAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ The basic annotations available in a Taverna
+ workflow.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Description"></xs:enumeration>
+ <xs:enumeration value="Author"></xs:enumeration>
+ <xs:enumeration value="Example"></xs:enumeration>
+ <xs:enumeration value="Title"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="componentAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ Annotations applicable to components.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="basicAnnotations">
+ <xs:enumeration value="Description"></xs:enumeration>
+ <xs:enumeration value="Author"></xs:enumeration>
+ <xs:enumeration value="Title"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="portAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ Annotations applicable to ports.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="basicAnnotations">
+ <xs:enumeration value="Description"></xs:enumeration>
+ <xs:enumeration value="Example"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="activityAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ Annotations applicable to activities.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="basicAnnotations">
+ <xs:enumeration value="Description"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="componentAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="componentAnnotations">
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="portAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="portAnnotations">
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="activityAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="activityAnnotations">
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="semanticAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="ontology" type="xs:string" use="required" />
+ <xs:attribute name="predicate" type="xs:string" use="required" />
+ <xs:attribute name="class" type="xs:string" use="optional" />
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="ontology">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="id" type="xs:string" use="required" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="port">
+ <xs:sequence>
+ <xs:element name="annotation" type="portAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="semanticAnnotation" type="semanticAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="name" type="name" />
+ <xs:attribute name="minDepth" type="xs:nonNegativeInteger"
+ default="0" />
+ <xs:attribute name="maxDepth" type="xs:allNNI" default="unbounded" />
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:complexType>
+
+ <xs:complexType name="activity">
+ <xs:sequence>
+ <xs:element name="annotation" type="activityAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="semanticAnnotation" type="semanticAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="type" type="xs:string" />
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:complexType>
+
+ <xs:complexType name="replacement">
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:attribute name="replacementId" type="xs:string" use="required"/>
+ <xs:attribute name="replacementMessage" type="xs:string" use="required"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:simpleType name="pattern">
+ <xs:restriction base="xs:string">
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="pruneStack">
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType"/>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="handleException">
+ <xs:sequence>
+ <xs:element name="pattern" type="pattern" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="pruneStack" type="pruneStack" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="replacement" type="replacement" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="failLists">
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType"/>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="exceptionHandling">
+ <xs:sequence>
+ <xs:element name="failLists" type="failLists" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="handleException" type="handleException" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="component">
+ <xs:sequence>
+ <xs:element name="inputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="outputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="activity" type="activity" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="annotation" type="componentAnnotation" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="semanticAnnotation" type="semanticAnnotation" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="exceptionHandling" type="exceptionHandling" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="extends">
+ <xs:attribute name="profileId" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:element name="profile">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" />
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="description" type="xs:string" />
+ <xs:element name="extends" type="extends" minOccurs = "0" />
+ <xs:element name="ontology" type="ontology" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="component" type="component" >
+ <xs:unique name="inputPortUnique">
+ <xs:selector xpath="cp:inputPort"></xs:selector>
+ <xs:field xpath="@name"></xs:field>
+ </xs:unique>
+ <xs:unique name="outputPortUnique">
+ <xs:selector xpath="cp:outputPort" />
+ <xs:field xpath="@name" />
+ </xs:unique>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:key name="ontologyKey">
+ <xs:selector xpath="cp:ontology" />
+ <xs:field xpath="@id" />
+ </xs:key>
+ <xs:keyref name="componentKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ <xs:keyref name="inputKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:inputPorts/cp:inputPort/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ <xs:keyref name="outputKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:outputPorts/cp:outputPort/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ <xs:keyref name="activityKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:activities/cp:activity/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ </xs:element>
+
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/c70b61ee/taverna-component-repository/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository/pom.xml b/taverna-component-repository/pom.xml
deleted file mode 100644
index 72c9560..0000000
--- a/taverna-component-repository/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.engine</groupId>
- <artifactId>taverna-engine</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-component-repository-api</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Component Repository API</name>
- <inceptionYear>2014</inceptionYear>
- <dependencies>
- <dependency>
- <groupId>org.apache.taverna.language</groupId>
- <artifactId>taverna-scufl2-api</artifactId>
- <version>${taverna.language.version}</version>
- </dependency>
- <dependency>
- <!-- FIXME: Use jena-osgi bundle -->
- <groupId>org.apache.clerezza.ext</groupId>
- <artifactId>com.hp.hpl.jena</artifactId>
- <version>0.6-incubating</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <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>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.8.3</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <catalog>${basedir}/src/main/catalog/catalog.xml</catalog>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
[54/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.engine etc.
Posted by st...@apache.org.
org.apache.taverna.engine etc.
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/be59a4f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/be59a4f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/be59a4f3
Branch: refs/heads/master
Commit: be59a4f3ab2ab059ceb1a952a0cf03f68112af5c
Parents: b870cad
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 23:09:59 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 23:09:59 2015 +0000
----------------------------------------------------------------------
taverna-component-activity/pom.xml | 37 +++++++++++++--------------------
1 file changed, 15 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/be59a4f3/taverna-component-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/pom.xml b/taverna-component-activity/pom.xml
index 9edfc35..fa957f7 100644
--- a/taverna-component-activity/pom.xml
+++ b/taverna-component-activity/pom.xml
@@ -18,25 +18,25 @@
<version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-reference-api</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
</dependency>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-workflowmodel-api</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
</dependency>
<dependency>
<!-- FIXME: Remove -->
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-workflowmodel-impl</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
</dependency>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-execution-api</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
@@ -49,9 +49,9 @@
</exclusions>
</dependency>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-dataflow-activity</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
</dependency>
<dependency>
<groupId>org.apache.taverna.osgi</groupId>
@@ -78,9 +78,9 @@
<!-- <dependency> <groupId>org.apache.taverna.language</groupId> <artifactId>taverna-scufl2-annotation</artifactId>
<version>${taverna.language.version}</version> </dependency> -->
<dependency>
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-credential-manager</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
</dependency>
<dependency>
@@ -158,17 +158,10 @@
</exclusion>
</exclusions>
</dependency>
-
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
+ <groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-activity-test-utils</artifactId>
- <version>${project.parent.version}</version>
+ <version>${taverna.engine.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
@@ -183,7 +176,7 @@
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.8.3</version>
+ <version>0.12.3</version>
<executions>
<execution>
<goals>
[13/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/catalog/xml.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/catalog/xml.xsd b/taverna-component-repository/src/main/catalog/xml.xsd
new file mode 100644
index 0000000..aea7d0d
--- /dev/null
+++ b/taverna-component-repository/src/main/catalog/xml.xsd
@@ -0,0 +1,287 @@
+<?xml version='1.0'?>
+<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns ="http://www.w3.org/1999/xhtml"
+ xml:lang="en">
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+ <h1>About the XML namespace</h1>
+
+ <div class="bodytext">
+ <p>
+ This schema document describes the XML namespace, in a form
+ suitable for import by other schema documents.
+ </p>
+ <p>
+ See <a href="http://www.w3.org/XML/1998/namespace.html">
+ http://www.w3.org/XML/1998/namespace.html</a> and
+ <a href="http://www.w3.org/TR/REC-xml">
+ http://www.w3.org/TR/REC-xml</a> for information
+ about this namespace.
+ </p>
+ <p>
+ Note that local names in this namespace are intended to be
+ defined only by the World Wide Web Consortium or its subgroups.
+ The names currently defined in this namespace are listed below.
+ They should not be used with conflicting semantics by any Working
+ Group, specification, or document instance.
+ </p>
+ <p>
+ See further below in this document for more information about <a
+ href="#usage">how to refer to this schema document from your own
+ XSD schema documents</a> and about <a href="#nsversioning">the
+ namespace-versioning policy governing this schema document</a>.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>lang (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ is a language code for the natural language of the content of
+ any element; its value is inherited. This name is reserved
+ by virtue of its definition in the XML specification.</p>
+
+ </div>
+ <div>
+ <h4>Notes</h4>
+ <p>
+ Attempting to install the relevant ISO 2- and 3-letter
+ codes as the enumerated possible values is probably never
+ going to be a realistic possibility.
+ </p>
+ <p>
+ See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
+ http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
+ and the IANA language subtag registry at
+ <a href="http://www.iana.org/assignments/language-subtag-registry">
+ http://www.iana.org/assignments/language-subtag-registry</a>
+ for further information.
+ </p>
+ <p>
+ The union allows for the 'un-declaration' of xml:lang with
+ the empty string.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:language">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="space">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>space (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose
+ value is a keyword indicating what whitespace processing
+ discipline is intended for the content of the element; its
+ value is inherited. This name is reserved by virtue of its
+ definition in the XML specification.</p>
+
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>base (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ provides a URI to be used as the base for interpreting any
+ relative URIs in the scope of the element on which it
+ appears; its value is inherited. This name is reserved
+ by virtue of its definition in the XML Base specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="id" type="xs:ID">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>id (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ should be interpreted as if declared to be of type ID.
+ This name is reserved by virtue of its definition in the
+ xml:id specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+ <xs:attribute ref="xml:base"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute ref="xml:space"/>
+ <xs:attribute ref="xml:id"/>
+ </xs:attributeGroup>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>Father (in any context at all)</h3>
+
+ <div class="bodytext">
+ <p>
+ denotes Jon Bosak, the chair of
+ the original XML Working Group. This name is reserved by
+ the following decision of the W3C XML Plenary and
+ XML Coordination groups:
+ </p>
+ <blockquote>
+ <p>
+ In appreciation for his vision, leadership and
+ dedication the W3C XML Plenary on this 10th day of
+ February, 2000, reserves for Jon Bosak in perpetuity
+ the XML name "xml:Father".
+ </p>
+ </blockquote>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div xml:id="usage" id="usage">
+ <h2><a name="usage">About this schema document</a></h2>
+
+ <div class="bodytext">
+ <p>
+ This schema defines attributes and an attribute group suitable
+ for use by schemas wishing to allow <code>xml:base</code>,
+ <code>xml:lang</code>, <code>xml:space</code> or
+ <code>xml:id</code> attributes on elements they define.
+ </p>
+ <p>
+ To enable this, such a schema must import this schema for
+ the XML namespace, e.g. as follows:
+ </p>
+ <pre>
+ <schema . . .>
+ . . .
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ </pre>
+ <p>
+ or
+ </p>
+ <pre>
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+ </pre>
+ <p>
+ Subsequently, qualified reference to any of the attributes or the
+ group defined below will have the desired effect, e.g.
+ </p>
+ <pre>
+ <type . . .>
+ . . .
+ <attributeGroup ref="xml:specialAttrs"/>
+ </pre>
+ <p>
+ will define a type which will schema-validate an instance element
+ with any of those attributes.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div id="nsversioning" xml:id="nsversioning">
+ <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
+ <div class="bodytext">
+ <p>
+ In keeping with the XML Schema WG's standard versioning
+ policy, this schema document will persist at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a>.
+ </p>
+ <p>
+ At the date of issue it can also be found at
+ <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd</a>.
+ </p>
+ <p>
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XML
+ Schema itself, or with the XML namespace itself. In other words,
+ if the XML Schema or XML namespaces change, the version of this
+ document at <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd
+ </a>
+ will change accordingly; the version at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd
+ </a>
+ will not change.
+ </p>
+ <p>
+ Previous dated (and unchanging) versions of this schema
+ document are at:
+ </p>
+ <ul>
+ <li><a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2007/08/xml.xsd">
+ http://www.w3.org/2007/08/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2004/10/xml.xsd">
+ http://www.w3.org/2004/10/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2001/03/xml.xsd">
+ http://www.w3.org/2001/03/xml.xsd</a></li>
+ </ul>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+</xs:schema>
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java
new file mode 100644
index 0000000..47bc7e9
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Component.java
@@ -0,0 +1,71 @@
+package net.sf.taverna.t2.component.api;
+
+import java.net.URL;
+import java.util.SortedMap;
+
+import uk.org.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
new file mode 100644
index 0000000..2b5d829
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentException.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.api;
+
+/**
+ * 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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
new file mode 100644
index 0000000..8c7d533
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/ComponentFactory.java
@@ -0,0 +1,27 @@
+package net.sf.taverna.t2.component.api;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java
new file mode 100644
index 0000000..f618af7
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Family.java
@@ -0,0 +1,99 @@
+package net.sf.taverna.t2.component.api;
+
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.profile.Profile;
+import uk.org.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java
new file mode 100644
index 0000000..7e7594d
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/License.java
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api;
+
+/**
+ * @author alson
+ *
+ */
+public interface License extends NamedItem {
+ public String getAbbreviation();
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
new file mode 100644
index 0000000..a31ad4d
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/NamedItem.java
@@ -0,0 +1,8 @@
+package net.sf.taverna.t2.component.api;
+
+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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java
new file mode 100644
index 0000000..f7b5be4
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Registry.java
@@ -0,0 +1,139 @@
+package net.sf.taverna.t2.component.api;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import net.sf.taverna.t2.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
new file mode 100644
index 0000000..ba91276
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/SharingPolicy.java
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api;
+
+/**
+ * @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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java
new file mode 100644
index 0000000..3f81739
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/Version.java
@@ -0,0 +1,206 @@
+package net.sf.taverna.t2.component.api;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import uk.org.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
new file mode 100644
index 0000000..172662d
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentConfig.java
@@ -0,0 +1,5 @@
+package net.sf.taverna.t2.component.api.config;
+
+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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
new file mode 100644
index 0000000..baa8bb3
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/config/ComponentPropertyNames.java
@@ -0,0 +1,14 @@
+package net.sf.taverna.t2.component.api.config;
+
+/**
+ * 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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java
new file mode 100644
index 0000000..4af7984
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * An abstract API for working with components in a registry.
+ * @author Donal Fellows
+ * @author David Withers
+ */
+package net.sf.taverna.t2.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
new file mode 100644
index 0000000..f656dd0
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ActivityProfile.java
@@ -0,0 +1,5 @@
+package net.sf.taverna.t2.component.api.profile;
+
+public interface ActivityProfile extends AnnotatedElement {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
new file mode 100644
index 0000000..dafec43
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/AnnotatedElement.java
@@ -0,0 +1,10 @@
+package net.sf.taverna.t2.component.api.profile;
+
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+
+public interface AnnotatedElement {
+ List<SemanticAnnotationProfile> getSemanticAnnotations()
+ throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
new file mode 100644
index 0000000..5172f94
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionHandling.java
@@ -0,0 +1,32 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api.profile;
+
+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(
+ net.sf.taverna.t2.component.api.profile.doc.ExceptionHandling proxied) {
+ for (net.sf.taverna.t2.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
new file mode 100644
index 0000000..e71c5ec
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/ExceptionReplacement.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api.profile;
+
+import net.sf.taverna.t2.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
new file mode 100644
index 0000000..1c3332b
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/HandleException.java
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.api.profile;
+
+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(
+ net.sf.taverna.t2.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
new file mode 100644
index 0000000..5d66de8
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/PortProfile.java
@@ -0,0 +1,5 @@
+package net.sf.taverna.t2.component.api.profile;
+
+
+public interface PortProfile extends AnnotatedElement {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
new file mode 100644
index 0000000..c0899f8
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/Profile.java
@@ -0,0 +1,47 @@
+package net.sf.taverna.t2.component.api.profile;
+
+import java.util.List;
+import java.util.Map;
+
+import net.sf.taverna.t2.component.api.NamedItem;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.ComponentException;
+
+import com.hp.hpl.jena.ontology.OntModel;
+
+public interface Profile extends NamedItem, AnnotatedElement {
+
+ Registry getComponentRegistry();
+
+ String getXML() throws ComponentException;
+
+ net.sf.taverna.t2.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/4ce7eea2/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
new file mode 100644
index 0000000..3000576
--- /dev/null
+++ b/taverna-component-repository/src/main/java/net/sf/taverna/t2/component/api/profile/SemanticAnnotationProfile.java
@@ -0,0 +1,54 @@
+package net.sf.taverna.t2.component.api.profile;
+
+import java.util.List;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.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/4ce7eea2/taverna-component-repository/src/main/resources/ComponentProfile.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/resources/ComponentProfile.xsd b/taverna-component-repository/src/main/resources/ComponentProfile.xsd
new file mode 100644
index 0000000..95b4405
--- /dev/null
+++ b/taverna-component-repository/src/main/resources/ComponentProfile.xsd
@@ -0,0 +1,261 @@
+<?xml version="1.0"?>
+<xs:schema targetNamespace="http://ns.taverna.org.uk/2012/component/profile"
+ elementFormDefault="qualified" xmlns="http://ns.taverna.org.uk/2012/component/profile"
+ xmlns:cp="http://ns.taverna.org.uk/2012/component/profile" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
+ jxb:version="2.1">
+ <xs:annotation>
+ <xs:appinfo>
+ <jxb:schemaBindings>
+ <jxb:package name="net.sf.taverna.t2.component.api.profile.doc" />
+ </jxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/2001/XMLSchema"
+ schemaLocation="http://www.w3.org/2001/XMLSchema.xsd" />
+
+ <xs:simpleType name="name">
+ <xs:annotation>
+ <xs:documentation>A valid name for a port or activity in a Taverna
+ workflow.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="([a-zA_Z0-9_])+" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="componentElements">
+ <xs:annotation>
+ <xs:documentation>
+ The component elements that can be annotated.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="InputPort"></xs:enumeration>
+ <xs:enumeration value="OutputPort"></xs:enumeration>
+ <xs:enumeration value="Activity"></xs:enumeration>
+ <xs:enumeration value="Component"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="basicAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ The basic annotations available in a Taverna
+ workflow.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Description"></xs:enumeration>
+ <xs:enumeration value="Author"></xs:enumeration>
+ <xs:enumeration value="Example"></xs:enumeration>
+ <xs:enumeration value="Title"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="componentAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ Annotations applicable to components.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="basicAnnotations">
+ <xs:enumeration value="Description"></xs:enumeration>
+ <xs:enumeration value="Author"></xs:enumeration>
+ <xs:enumeration value="Title"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="portAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ Annotations applicable to ports.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="basicAnnotations">
+ <xs:enumeration value="Description"></xs:enumeration>
+ <xs:enumeration value="Example"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="activityAnnotations">
+ <xs:annotation>
+ <xs:documentation>
+ Annotations applicable to activities.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="basicAnnotations">
+ <xs:enumeration value="Description"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="componentAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="componentAnnotations">
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="portAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="portAnnotations">
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="activityAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="activityAnnotations">
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="semanticAnnotation">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="ontology" type="xs:string" use="required" />
+ <xs:attribute name="predicate" type="xs:string" use="required" />
+ <xs:attribute name="class" type="xs:string" use="optional" />
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="ontology">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="id" type="xs:string" use="required" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="port">
+ <xs:sequence>
+ <xs:element name="annotation" type="portAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="semanticAnnotation" type="semanticAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="name" type="name" />
+ <xs:attribute name="minDepth" type="xs:nonNegativeInteger"
+ default="0" />
+ <xs:attribute name="maxDepth" type="xs:allNNI" default="unbounded" />
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:complexType>
+
+ <xs:complexType name="activity">
+ <xs:sequence>
+ <xs:element name="annotation" type="activityAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="semanticAnnotation" type="semanticAnnotation"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="type" type="xs:string" />
+ <xs:attributeGroup ref="xs:occurs" />
+ </xs:complexType>
+
+ <xs:complexType name="replacement">
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:attribute name="replacementId" type="xs:string" use="required"/>
+ <xs:attribute name="replacementMessage" type="xs:string" use="required"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:simpleType name="pattern">
+ <xs:restriction base="xs:string">
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="pruneStack">
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType"/>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="handleException">
+ <xs:sequence>
+ <xs:element name="pattern" type="pattern" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="pruneStack" type="pruneStack" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="replacement" type="replacement" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="failLists">
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType"/>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="exceptionHandling">
+ <xs:sequence>
+ <xs:element name="failLists" type="failLists" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="handleException" type="handleException" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="component">
+ <xs:sequence>
+ <xs:element name="inputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="outputPort" type="port" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="activity" type="activity" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="annotation" type="componentAnnotation" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="semanticAnnotation" type="semanticAnnotation" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="exceptionHandling" type="exceptionHandling" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="extends">
+ <xs:attribute name="profileId" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:element name="profile">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" />
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="description" type="xs:string" />
+ <xs:element name="extends" type="extends" minOccurs = "0" />
+ <xs:element name="ontology" type="ontology" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="component" type="component" >
+ <xs:unique name="inputPortUnique">
+ <xs:selector xpath="cp:inputPort"></xs:selector>
+ <xs:field xpath="@name"></xs:field>
+ </xs:unique>
+ <xs:unique name="outputPortUnique">
+ <xs:selector xpath="cp:outputPort" />
+ <xs:field xpath="@name" />
+ </xs:unique>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:key name="ontologyKey">
+ <xs:selector xpath="cp:ontology" />
+ <xs:field xpath="@id" />
+ </xs:key>
+ <xs:keyref name="componentKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ <xs:keyref name="inputKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:inputPorts/cp:inputPort/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ <xs:keyref name="outputKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:outputPorts/cp:outputPort/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ <xs:keyref name="activityKeyRef" refer="ontologyKey">
+ <xs:selector xpath="cp:component/cp:activities/cp:activity/cp:semanticAnnotation" />
+ <xs:field xpath="@ontology" />
+ </xs:keyref>
+ </xs:element>
+
+</xs:schema>
[14/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-repository/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/catalog/XMLSchema.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/catalog/XMLSchema.xsd b/taverna-component-repository/src/main/catalog/XMLSchema.xsd
new file mode 100644
index 0000000..575975b
--- /dev/null
+++ b/taverna-component-repository/src/main/catalog/XMLSchema.xsd
@@ -0,0 +1,2473 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+<!-- The prose copy in the structures REC is the normative -->
+<!-- version (which shouldn't differ from this one except for -->
+<!-- this comment and entity expansions, but just in case -->
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+ <xs:documentation>
+ Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within <documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ The simpleType element and all of its members are defined
+ towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+ <xs:annotation>
+ <xs:documentation>
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+ </xs:documentation>
+ </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:group ref="xs:redefinable"/>
+ <xs:element ref="xs:element"/>
+ <xs:element ref="xs:attribute"/>
+ <xs:element ref="xs:notation"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="redefinable">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which can self-redefine (see <redefine> below).</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:simpleType"/>
+ <xs:element ref="xs:complexType"/>
+ <xs:element ref="xs:group"/>
+ <xs:element ref="xs:attributeGroup"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="qualified"/>
+ <xs:enumeration value="unqualified"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:reducedDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="typeDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="fullDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:typeDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:include"/>
+ <xs:element ref="xs:import"/>
+ <xs:element ref="xs:redefine"/>
+ <xs:element ref="xs:annotation"/>
+ </xs:choice>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="xs:schemaTop"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="version" type="xs:token"/>
+ <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
+ <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+ <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:key name="element">
+ <xs:selector xpath="xs:element"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attribute">
+ <xs:selector xpath="xs:attribute"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="type">
+ <xs:selector xpath="xs:complexType|xs:simpleType"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="group">
+ <xs:selector xpath="xs:group"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attributeGroup">
+ <xs:selector xpath="xs:attributeGroup"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="notation">
+ <xs:selector xpath="xs:notation"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="identityConstraint">
+ <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+ <xs:annotation><xs:documentation>
+ for maxOccurs</xs:documentation></xs:annotation>
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+ <xs:annotation><xs:documentation>
+ for all particles</xs:documentation></xs:annotation>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+ <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+ <xs:annotation><xs:documentation>
+ for element, group and attributeGroup,
+ which both define and reference</xs:documentation></xs:annotation>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+ <xs:annotation>
+ <xs:documentation>
+ 'complexType' uses this</xs:documentation></xs:annotation>
+ <xs:choice>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:group>
+
+
+
+ <xs:group name="nestedParticle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="particle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="attribute">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="use" use="optional" default="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="prohibited"/>
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelAttribute">
+ <xs:complexContent>
+ <xs:restriction base="xs:attribute">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="use" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="attribute" type="xs:attribute"/>
+ <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ </xs:choice>
+ <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+ <xs:choice>
+ <xs:element ref="xs:simpleContent"/>
+ <xs:element ref="xs:complexContent"/>
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent></xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:complexTypeModel"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Will be restricted to required or forbidden</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:derivationSet"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="block" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="restrictionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:group ref="xs:typeDefParticle"/>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:complexRestrictionType"/>
+ <xs:element name="extension" type="xs:extensionType"/>
+ </xs:choice>
+ <xs:attribute name="mixed" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Overrides any setting on complexType parent.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:extensionType">
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ No typeDefParticle group reference</xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+ <xs:element name="extension" type="xs:simpleExtensionType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+ </xs:annotation>
+ </xs:element>
+
+
+ <xs:simpleType name="blockSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="substitution"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.</xs:documentation>
+ </xs:annotation>
+
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="substitutionGroup" type="xs:QName"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:blockSet"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="substitutionGroup" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ group type for explicit groups, named top-level groups and
+ group references</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="realGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="all">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:all">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+ <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+ <xs:annotation>
+ <xs:documentation>
+ group type for the three kinds of group</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExplicitGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="allModel">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint</xs:documentation>
+ </xs:annotation>
+ <xs:element name="element" type="xs:narrowMaxMin"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+
+ <xs:complexType name="narrowMaxMin">
+ <xs:annotation>
+ <xs:documentation>restricted max/min</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:localElement">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="all">
+ <xs:annotation>
+ <xs:documentation>
+ Only elements allowed inside</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+ <xs:attribute name="processContents" use="optional" default="strict">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="lax"/>
+ <xs:enumeration value="strict"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'</xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively</xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ <xs:enumeration value="##other"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:attrDecls"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedAttributeGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:annotation"/>
+ <xs:group ref="xs:redefinable"/>
+ </xs:choice>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:anyURI"/>
+ <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element ref="xs:selector"/>
+ <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+ <xs:annotation>
+ <xs:documentation>The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:unique"/>
+ <xs:element ref="xs:key"/>
+ <xs:element ref="xs:keyref"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:keybase">
+ <xs:attribute name="refer" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="public" type="xs:public"/>
+ <xs:attribute name="system" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ A public identifier, per ISO 8879</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:appinfo"/>
+ <xs:element ref="xs:documentation"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+
+ <xs:complexType name="anyType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+ </xs:documentation>
+
+ <xs:documentation>
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="string" id="string">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#string"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="preserve" id="string.preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="boolean" id="boolean">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="boolean.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="float" id="float">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#float"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="float.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="double" id="double">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#double"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="double.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="decimal" id="decimal">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="totalDigits"/>
+ <hfp:hasFacet name="fractionDigits"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="decimal.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="duration" id="duration">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="duration.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="dateTime.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="time" id="time">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#time"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="time.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="date" id="date">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#date"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="date.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYearMonth" id="gYearMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYearMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYear" id="gYear">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYear.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonthDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gDay" id="gDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="hexBinary" id="hexBinary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="hexBinary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="base64Binary" id="base64Binary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="base64Binary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="anyURI" id="anyURI">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="anyURI.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="QName" id="QName">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="QName.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NOTATION" id="NOTATION">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+ <xs:documentation>
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="NOTATION.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ Now the derived primitive types
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="normalizedString" id="normalizedString">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:whiteSpace value="replace"
+ id="normalizedString.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="token" id="token">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#token"/>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="language" id="language">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#language"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern
+ value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
+ id="language.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.ietf.org/rfc/rfc3066.txt">
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREFS" id="IDREFS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:IDREF"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="IDREFS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITIES" id="ENTITIES">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:ENTITY"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="ENTITIES.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\c+" id="NMTOKEN.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+ pattern matches production 7 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:NMTOKEN"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="NMTOKENS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Name" id="Name">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\i\c*" id="Name.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Name">
+ pattern matches production 5 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NCName" id="NCName">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:Name">
+ <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+ pattern matches production 4 from the Namespaces in XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ID" id="ID">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREF" id="IDREF">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITY" id="ENTITY">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="integer" id="integer">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+ </xs:annotation>
+ <xs:restriction base="xs:decimal">
+ <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+ <xs:pattern value="[\-+]?[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="negativeInteger" id="negativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonPositiveInteger">
+ <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="long" id="long">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#long"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+ <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="int" id="int">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#int"/>
+ </xs:annotation>
+ <xs:restriction base="xs:long">
+ <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+ <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="short" id="short">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#short"/>
+ </xs:annotation>
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="-32768" id="short.minInclusive"/>
+ <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="byte" id="byte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="-128" id="byte.minInclusive"/>
+ <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedLong" id="unsignedLong">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:maxInclusive value="18446744073709551615"
+ id="unsignedLong.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedInt" id="unsignedInt">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedLong">
+ <xs:maxInclusive value="4294967295"
+ id="unsignedInt.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedShort" id="unsignedShort">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedInt">
+ <xs:maxInclusive value="65535"
+ id="unsignedShort.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedByte" id="unsignedByte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger" id="positiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="substitution"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+ <xs:choice>
+ <xs:element ref="xs:restriction"/>
+ <xs:element ref="xs:list"/>
+ <xs:element ref="xs:union"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {restriction, union, list}
+ </xs:documentation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="simpleType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleDerivation"/>
+ <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Can be restricted to required or forbidden
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required"
+ type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Required at the top level
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited">
+ <xs:annotation>
+ <xs:documentation>
+ Forbidden when nested
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="facets">
+ <xs:annotation>
+ <xs:documentation>
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:minExclusive"/>
+ <xs:element ref="xs:minInclusive"/>
+ <xs:element ref="xs:maxExclusive"/>
+ <xs:element ref="xs:maxInclusive"/>
+ <xs:element ref="xs:totalDigits"/>
+ <xs:element ref="xs:fractionDigits"/>
+ <xs:element ref="xs:length"/>
+ <xs:element ref="xs:minLength"/>
+ <xs:element ref="xs:maxLength"/>
+ <xs:element ref="xs:enumeration"/>
+ <xs:element ref="xs:whiteSpace"/>
+ <xs:element ref="xs:pattern"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="simpleRestrictionModel">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="restriction" id="restriction">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ <xs:attribute name="base" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="list" id="list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-list">
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="union" id="union">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-union">
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="memberTypes" use="optional">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="facet">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="value" use="required"/>
+ <xs:attribute name="fixed" type="xs:boolean" use="optional"
+ default="false"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="noFixedFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="fixed" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="numFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="totalDigits" id="totalDigits">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:numFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="length" id="length" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minLength" id="minLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="whiteSpace" id="whiteSpace">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="preserve"/>
+ <xs:enumeration value="replace"/>
+ <xs:enumeration value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="pattern" id="pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:noFixedFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/4ce7eea2/taverna-component-repository/src/main/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository/src/main/catalog/catalog.xml b/taverna-component-repository/src/main/catalog/catalog.xml
new file mode 100644
index 0000000..e61eda5
--- /dev/null
+++ b/taverna-component-repository/src/main/catalog/catalog.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="XMLSchema.xsd" />
+ <public publicId="http://www.w3.org/2001/XMLSchema" uri="XMLSchema.xsd" />
+ <system systemId="http://www.w3.org/2001/xml.xsd" uri="xml.xsd" />
+ <public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd" />
+</catalog>
\ No newline at end of file
[38/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
Posted by st...@apache.org.
org.apache.taverna.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/fb982e2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/fb982e2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/fb982e2f
Branch: refs/heads/master
Commit: fb982e2fc1bb0a02feb005c4ef8ba681f1e47059
Parents: 2421ba8
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 19:29:07 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 19:29:07 2015 +0000
----------------------------------------------------------------------
.../taverna/t2/component/ComponentActivity.java | 152 ----
.../ComponentActivityConfigurationBean.java | 145 ----
.../t2/component/ComponentActivityFactory.java | 125 ----
.../ComponentActivityLocalChecker.java | 52 --
.../ComponentActivityUpgradeChecker.java | 69 --
.../t2/component/ComponentExceptionFactory.java | 27 -
.../t2/component/ComponentHealthCheck.java | 24 -
.../ComponentImplementationException.java | 26 -
.../sf/taverna/t2/component/ProxyCallback.java | 250 -------
.../component/profile/ActivityProfileImpl.java | 55 --
.../component/profile/BaseProfileLocator.java | 144 ----
.../component/profile/ComponentProfileImpl.java | 685 -------------------
.../t2/component/profile/PortProfileImpl.java | 60 --
.../profile/SemanticAnnotationProfileImpl.java | 177 -----
.../t2/component/registry/ClientVersion.java | 33 -
.../t2/component/registry/Component.java | 162 -----
.../t2/component/registry/ComponentFamily.java | 163 -----
.../registry/ComponentImplementationCache.java | 64 --
.../component/registry/ComponentRegistry.java | 245 -------
.../t2/component/registry/ComponentUtil.java | 113 ---
.../t2/component/registry/ComponentVersion.java | 66 --
.../ComponentVersionIdentification.java | 196 ------
.../registry/local/LocalComponent.java | 134 ----
.../registry/local/LocalComponentFamily.java | 141 ----
.../registry/local/LocalComponentRegistry.java | 205 ------
.../local/LocalComponentRegistryFactory.java | 45 --
.../registry/local/LocalComponentVersion.java | 94 ---
.../t2/component/registry/standard/Client.java | 637 -----------------
.../registry/standard/NewComponent.java | 221 ------
.../registry/standard/NewComponentFamily.java | 133 ----
.../registry/standard/NewComponentLicense.java | 59 --
.../registry/standard/NewComponentProfile.java | 104 ---
.../registry/standard/NewComponentRegistry.java | 469 -------------
.../standard/NewComponentRegistryFactory.java | 66 --
.../t2/component/registry/standard/Policy.java | 137 ----
.../registry/standard/annotations/Unused.java | 25 -
.../standard/annotations/package-info.java | 6 -
.../registry/standard/package-info.java | 5 -
.../t2/component/utils/AnnotationUtils.java | 91 ---
.../taverna/t2/component/utils/SystemUtils.java | 118 ----
.../taverna/component/ComponentActivity.java | 152 ++++
.../ComponentActivityConfigurationBean.java | 145 ++++
.../component/ComponentActivityFactory.java | 125 ++++
.../ComponentActivityLocalChecker.java | 52 ++
.../ComponentActivityUpgradeChecker.java | 69 ++
.../component/ComponentExceptionFactory.java | 27 +
.../taverna/component/ComponentHealthCheck.java | 24 +
.../ComponentImplementationException.java | 26 +
.../apache/taverna/component/ProxyCallback.java | 250 +++++++
.../component/profile/ActivityProfileImpl.java | 55 ++
.../component/profile/BaseProfileLocator.java | 144 ++++
.../component/profile/ComponentProfileImpl.java | 685 +++++++++++++++++++
.../component/profile/PortProfileImpl.java | 60 ++
.../profile/SemanticAnnotationProfileImpl.java | 177 +++++
.../component/registry/ClientVersion.java | 33 +
.../taverna/component/registry/Component.java | 162 +++++
.../component/registry/ComponentFamily.java | 163 +++++
.../registry/ComponentImplementationCache.java | 64 ++
.../component/registry/ComponentRegistry.java | 245 +++++++
.../component/registry/ComponentUtil.java | 112 +++
.../component/registry/ComponentVersion.java | 66 ++
.../ComponentVersionIdentification.java | 196 ++++++
.../registry/local/LocalComponent.java | 133 ++++
.../registry/local/LocalComponentFamily.java | 140 ++++
.../registry/local/LocalComponentRegistry.java | 204 ++++++
.../local/LocalComponentRegistryFactory.java | 44 ++
.../registry/local/LocalComponentVersion.java | 93 +++
.../component/registry/standard/Client.java | 637 +++++++++++++++++
.../registry/standard/NewComponent.java | 221 ++++++
.../registry/standard/NewComponentFamily.java | 133 ++++
.../registry/standard/NewComponentLicense.java | 58 ++
.../registry/standard/NewComponentProfile.java | 103 +++
.../registry/standard/NewComponentRegistry.java | 469 +++++++++++++
.../standard/NewComponentRegistryFactory.java | 66 ++
.../component/registry/standard/Policy.java | 136 ++++
.../registry/standard/annotations/Unused.java | 25 +
.../standard/annotations/package-info.java | 6 +
.../registry/standard/package-info.java | 5 +
.../component/utils/AnnotationUtils.java | 91 +++
.../taverna/component/utils/SystemUtils.java | 118 ++++
.../src/main/resources/EmptyProfile.xml | 2 +-
.../spring/component-activity-context.xml | 22 +-
.../main/resources/NewMyExperimentSchema.xsd | 2 +-
.../t2/component/ComponentActivityTest.java | 103 ---
.../component/registry/ComponentFamilyTest.java | 124 ----
.../registry/ComponentRegistryTest.java | 183 -----
.../t2/component/registry/ComponentTest.java | 113 ---
.../registry/ComponentVersionTest.java | 96 ---
.../taverna/t2/component/registry/Harness.java | 11 -
.../local/LocalComponentFamilyTest.java | 43 --
.../local/LocalComponentRegistryTest.java | 61 --
.../registry/local/LocalComponentTest.java | 43 --
.../local/LocalComponentVersionTest.java | 43 --
.../registry/local/RegistrySupport.java | 24 -
.../standard/NewComponentFamilyTest.java | 25 -
.../standard/NewComponentRegistryTest.java | 75 --
.../registry/standard/NewComponentTest.java | 25 -
.../standard/NewComponentVersionTest.java | 25 -
.../registry/standard/RegistrySupport.java | 33 -
.../net/sf/taverna/t2/util/AnnotationTest.java | 31 -
.../taverna/component/AnnotationTest.java | 30 +
.../component/ComponentActivityTest.java | 107 +++
.../component/registry/ComponentFamilyTest.java | 124 ++++
.../registry/ComponentRegistryTest.java | 183 +++++
.../component/registry/ComponentTest.java | 113 +++
.../registry/ComponentVersionTest.java | 96 +++
.../taverna/component/registry/Harness.java | 12 +
.../local/LocalComponentFamilyTest.java | 42 ++
.../local/LocalComponentRegistryTest.java | 61 ++
.../registry/local/LocalComponentTest.java | 42 ++
.../local/LocalComponentVersionTest.java | 42 ++
.../registry/local/RegistrySupport.java | 26 +
.../standard/NewComponentFamilyTest.java | 24 +
.../standard/NewComponentRegistryTest.java | 77 +++
.../registry/standard/NewComponentTest.java | 24 +
.../standard/NewComponentVersionTest.java | 24 +
.../registry/standard/RegistrySupport.java | 37 +
...rity.credentialmanager.CredentialProviderSPI | 2 +-
118 files changed, 6792 insertions(+), 6795 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
deleted file mode 100644
index f845829..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.getAnnotationString;
-import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.setAnnotationString;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
-import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
-import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.impl.InvocationContextImpl;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
-
-import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-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 = getAnnotationString(realizingDataflow,
- SemanticAnnotation.class, null);
- if (annotationValue != null)
- 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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
deleted file mode 100644
index e70e83f..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package net.sf.taverna.t2.component;
-
-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 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.component.registry.ComponentImplementationCache;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
-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 org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * 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 (org.apache.taverna.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));
- for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
- outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
-
- try {
- eh = util.getFamily(getRegistryBase(), getFamilyName())
- .getComponentProfile().getExceptionHandling();
- if (eh != null)
- outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (org.apache.taverna.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 org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
deleted file mode 100644
index 50d7ec7..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-import net.sf.taverna.t2.component.utils.SystemUtils;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version.ID;
-import org.springframework.beans.factory.annotation.Required;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
deleted file mode 100644
index 846c36f..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.component.ComponentHealthCheck.NON_SHAREABLE;
-import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
-
-import java.util.List;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
deleted file mode 100644
index fadfb4c..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.component.ComponentHealthCheck.OUT_OF_DATE;
-import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.List;
-
-import net.sf.taverna.t2.component.registry.ComponentUtil;
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
deleted file mode 100644
index f37e567..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-/**
- * @author alanrw
- *
- */
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
deleted file mode 100644
index 7d4c906..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.component;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
deleted file mode 100644
index 11a8fde..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-/**
- * @author alanrw
- *
- */
-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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
deleted file mode 100644
index 9f3de98..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component;
-
-import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
-import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
-import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
-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 net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
-
-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;
-
-/**
- * @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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
deleted file mode 100644
index c0f61f7..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.api.profile.doc.Activity;
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
deleted file mode 100644
index 91786ae..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.component.profile;
-
-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 org.apache.taverna.component.api.ComponentException;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * @author alanrw
- *
- */
-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(), "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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
deleted file mode 100644
index 37bf692..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
+++ /dev/null
@@ -1,685 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.profile;
-
-import static com.hp.hpl.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 net.sf.taverna.t2.workflowmodel.health.HealthCheck.NO_PROBLEM;
-import static net.sf.taverna.t2.workflowmodel.health.RemoteHealthChecker.contactEndpoint;
-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 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 net.sf.taverna.t2.component.api.profile.doc.Activity;
-import net.sf.taverna.t2.component.api.profile.doc.Ontology;
-import net.sf.taverna.t2.component.api.profile.doc.Port;
-import net.sf.taverna.t2.component.api.profile.doc.Profile;
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
-
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.ontology.OntProperty;
-
-/**
- * A ComponentProfile specifies the inputs, outputs and semantic annotations
- * that a Component must contain.
- *
- * @author David Withers
- */
-public class ComponentProfileImpl implements
- org.apache.taverna.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 org.apache.taverna.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 org.apache.taverna.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 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<org.apache.taverna.component.api.profile.ActivityProfile> getActivityProfiles() {
- List<org.apache.taverna.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
- org.apache.taverna.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<org.apache.taverna.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
deleted file mode 100644
index e8394f1..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.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 net.sf.taverna.t2.component.api.profile.doc.Port;
-import net.sf.taverna.t2.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
deleted file mode 100644
index 0dc2393..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.profile;
-
-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 org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
-
-import com.hp.hpl.jena.ontology.Individual;
-import com.hp.hpl.jena.ontology.OntClass;
-import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.ontology.OntProperty;
-import com.hp.hpl.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/fb982e2f/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
deleted file mode 100644
index b06ae67..0000000
--- a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-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;
- }
-
-}
[42/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.ui
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/43334c1d/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
new file mode 100644
index 0000000..94e7fdb
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
@@ -0,0 +1,122 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.FileType;
+import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..33dbbd3
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
@@ -0,0 +1,160 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..b0cb699
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.family;
+
+import static org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..9bd39b8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
@@ -0,0 +1,186 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.workbench.file.FileManager;
+
+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 uk.org.taverna.scufl2.api.configurations.Configuration;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..3e63cac
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..21b954b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.family;
+
+import java.net.URI;
+
+import org.apache.taverna.component.ui.menu.ComponentMenu;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..97ab164
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
@@ -0,0 +1,161 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..00d1ceb
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.profile;
+
+import static org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..f7f5a71
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
@@ -0,0 +1,97 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..3544eec
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.profile;
+
+import static org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..0ab10fc
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
@@ -0,0 +1,166 @@
+/**
+ *
+ */
+package org.apache.taverna.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 net.sf.taverna.t2.lang.ui.DeselectingButton;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..2aca696
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
@@ -0,0 +1,49 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.profile;
+
+import static org.apache.taverna.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 net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..f6c137c
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
@@ -0,0 +1,25 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.profile;
+
+import static org.apache.taverna.component.ui.menu.ComponentMenu.COMPONENT;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..efb7ed6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.registry;
+
+import static org.apache.taverna.component.ui.preference.ComponentPreferenceUIFactory.DISPLAY_NAME;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+
+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/43334c1d/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
new file mode 100644
index 0000000..d8151d9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
@@ -0,0 +1,48 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.registry;
+
+import static org.apache.taverna.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 net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..096dcfd
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.menu.registry;
+
+import static org.apache.taverna.component.ui.menu.ComponentMenu.COMPONENT;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.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/43334c1d/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
new file mode 100644
index 0000000..ee15b5d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
@@ -0,0 +1,34 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.panel;
+
+import org.apache.taverna.component.api.Component;
+import org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..a71c906
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
@@ -0,0 +1,218 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..9dd7d26
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
@@ -0,0 +1,46 @@
+/**
+ *
+ */
+package org.apache.taverna.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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..a2c6b42
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
@@ -0,0 +1,171 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..5443000
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.apache.taverna.component.ui.panel;
+
+import org.apache.taverna.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/43334c1d/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
new file mode 100644
index 0000000..945cff2
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
@@ -0,0 +1,220 @@
+/**
+ *
+ */
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..941f887
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (C) 2013 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.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 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 net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+
+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;
+
+/**
+ * @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/43334c1d/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
new file mode 100644
index 0000000..e8d8945
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
@@ -0,0 +1,81 @@
+/**
+ *
+ */
+package org.apache.taverna.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 org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.profile.Profile;
+
+import net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.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();
+ }
+}
[12/58] [abbrv] incubator-taverna-plugin-component git commit: Merge
branch 'taverna-component-activity'
Posted by st...@apache.org.
Merge branch 'taverna-component-activity'
>From https://github.com/taverna/taverna-component-activity master
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/d4685dfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/d4685dfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/d4685dfa
Branch: refs/heads/master
Commit: d4685dfa17514031c2731a8f3d156d3d955efdb1
Parents: 91474e1 e15f9c8
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 17:19:28 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 17:19:28 2015 +0000
----------------------------------------------------------------------
.gitignore | 25 +
taverna-component-activity/pom.xml | 190 ++
.../src/main/catalog/XMLSchema.xsd | 2473 ++++++++++++++++++
.../src/main/catalog/catalog.xml | 7 +
.../src/main/catalog/xml.xsd | 287 ++
.../taverna/t2/component/ComponentActivity.java | 152 ++
.../ComponentActivityConfigurationBean.java | 145 +
.../t2/component/ComponentActivityFactory.java | 125 +
.../ComponentActivityLocalChecker.java | 52 +
.../ComponentActivityUpgradeChecker.java | 69 +
.../t2/component/ComponentExceptionFactory.java | 27 +
.../t2/component/ComponentHealthCheck.java | 24 +
.../ComponentImplementationException.java | 26 +
.../sf/taverna/t2/component/ProxyCallback.java | 250 ++
.../component/profile/ActivityProfileImpl.java | 54 +
.../component/profile/BaseProfileLocator.java | 145 +
.../component/profile/ComponentProfileImpl.java | 686 +++++
.../t2/component/profile/PortProfileImpl.java | 59 +
.../profile/SemanticAnnotationProfileImpl.java | 177 ++
.../t2/component/registry/ClientVersion.java | 33 +
.../t2/component/registry/Component.java | 161 ++
.../t2/component/registry/ComponentFamily.java | 162 ++
.../registry/ComponentImplementationCache.java | 65 +
.../component/registry/ComponentRegistry.java | 245 ++
.../t2/component/registry/ComponentUtil.java | 113 +
.../t2/component/registry/ComponentVersion.java | 65 +
.../ComponentVersionIdentification.java | 196 ++
.../registry/local/LocalComponent.java | 134 +
.../registry/local/LocalComponentFamily.java | 141 +
.../registry/local/LocalComponentRegistry.java | 205 ++
.../local/LocalComponentRegistryFactory.java | 45 +
.../registry/local/LocalComponentVersion.java | 94 +
.../t2/component/registry/standard/Client.java | 637 +++++
.../registry/standard/NewComponent.java | 220 ++
.../registry/standard/NewComponentFamily.java | 132 +
.../registry/standard/NewComponentLicense.java | 58 +
.../registry/standard/NewComponentProfile.java | 103 +
.../registry/standard/NewComponentRegistry.java | 469 ++++
.../standard/NewComponentRegistryFactory.java | 66 +
.../t2/component/registry/standard/Policy.java | 135 +
.../registry/standard/annotations/Unused.java | 25 +
.../standard/annotations/package-info.java | 6 +
.../registry/standard/package-info.java | 5 +
.../t2/component/utils/AnnotationUtils.java | 91 +
.../taverna/t2/component/utils/SystemUtils.java | 117 +
.../src/main/resources/BaseProfile.xml | 123 +
.../src/main/resources/EmptyProfile.xml | 12 +
.../spring/component-activity-context.xml | 70 +
.../main/resources/NewMyExperimentSchema.xsd | 454 ++++
.../t2/component/registry/version.properties | 1 +
.../src/main/resources/schema.json | 36 +
.../t2/component/ComponentActivityTest.java | 103 +
.../component/registry/ComponentFamilyTest.java | 125 +
.../registry/ComponentRegistryTest.java | 184 ++
.../t2/component/registry/ComponentTest.java | 114 +
.../registry/ComponentVersionTest.java | 97 +
.../taverna/t2/component/registry/Harness.java | 11 +
.../local/LocalComponentFamilyTest.java | 43 +
.../local/LocalComponentRegistryTest.java | 61 +
.../registry/local/LocalComponentTest.java | 43 +
.../local/LocalComponentVersionTest.java | 43 +
.../registry/local/RegistrySupport.java | 24 +
.../standard/NewComponentFamilyTest.java | 25 +
.../standard/NewComponentRegistryTest.java | 75 +
.../registry/standard/NewComponentTest.java | 25 +
.../standard/NewComponentVersionTest.java | 25 +
.../registry/standard/RegistrySupport.java | 33 +
.../net/sf/taverna/t2/util/AnnotationTest.java | 31 +
...rity.credentialmanager.CredentialProviderSPI | 1 +
.../src/test/resources/ValidationComponent.xml | 62 +
.../src/test/resources/beanshell_test.t2flow | 113 +
.../src/test/resources/hello_anyone.wfbundle | Bin 0 -> 10087 bytes
72 files changed, 10630 insertions(+)
----------------------------------------------------------------------
[39/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.activity
Posted by st...@apache.org.
org.apache.taverna.component.activity
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/40c404c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/40c404c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/40c404c1
Branch: refs/heads/master
Commit: 40c404c1d8423d186db2374b675b5669fbc2dd25
Parents: fb982e2
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Sat Feb 21 19:30:27 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Sat Feb 21 19:30:27 2015 +0000
----------------------------------------------------------------------
.../taverna/component/ComponentActivity.java | 152 -----------
.../ComponentActivityConfigurationBean.java | 145 -----------
.../component/ComponentActivityFactory.java | 125 ----------
.../ComponentActivityLocalChecker.java | 52 ----
.../ComponentActivityUpgradeChecker.java | 69 -----
.../component/ComponentExceptionFactory.java | 27 --
.../taverna/component/ComponentHealthCheck.java | 24 --
.../ComponentImplementationException.java | 26 --
.../apache/taverna/component/ProxyCallback.java | 250 -------------------
.../component/activity/ComponentActivity.java | 152 +++++++++++
.../ComponentActivityConfigurationBean.java | 145 +++++++++++
.../activity/ComponentActivityFactory.java | 125 ++++++++++
.../activity/ComponentActivityLocalChecker.java | 52 ++++
.../ComponentActivityUpgradeChecker.java | 69 +++++
.../activity/ComponentExceptionFactory.java | 27 ++
.../activity/ComponentHealthCheck.java | 24 ++
.../ComponentImplementationException.java | 26 ++
.../component/activity/ProxyCallback.java | 250 +++++++++++++++++++
.../component/activity/package-info.java | 8 +
.../spring/component-activity-context.xml | 6 +-
.../component/ComponentActivityTest.java | 6 +-
21 files changed, 884 insertions(+), 876 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java
deleted file mode 100644
index db10175..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivity.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.apache.taverna.component;
-
-import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.getAnnotationString;
-import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.setAnnotationString;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
-import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.impl.InvocationContextImpl;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-
-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 uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-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 = getAnnotationString(realizingDataflow,
- SemanticAnnotation.class, null);
- if (annotationValue != null)
- 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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java
deleted file mode 100644
index 45448b5..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityConfigurationBean.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.taverna.component;
-
-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 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 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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
-import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * 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 (org.apache.taverna.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));
- for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
- outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
-
- try {
- eh = util.getFamily(getRegistryBase(), getFamilyName())
- .getComponentProfile().getExceptionHandling();
- if (eh != null)
- outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (org.apache.taverna.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 org.apache.taverna.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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java
deleted file mode 100644
index 59e893d..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityFactory.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.apache.taverna.component;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-
-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 org.springframework.beans.factory.annotation.Required;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java
deleted file mode 100644
index 32baaf6..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityLocalChecker.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.taverna.component;
-
-import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
-import static org.apache.taverna.component.ComponentHealthCheck.NON_SHAREABLE;
-
-import java.util.List;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java
deleted file mode 100644
index 3304cc4..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentActivityUpgradeChecker.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.component;
-
-import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
-import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ComponentHealthCheck.OUT_OF_DATE;
-
-import java.util.List;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.visit.VisitReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.registry.ComponentUtil;
-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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java
deleted file mode 100644
index 7f100dc..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentExceptionFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.component;
-
-/**
- * @author alanrw
- *
- */
-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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java
deleted file mode 100644
index dee1052..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentHealthCheck.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.apache.taverna.component;
-
-import net.sf.taverna.t2.visit.VisitKind;
-import net.sf.taverna.t2.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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java
deleted file mode 100644
index f443f6d..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ComponentImplementationException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.component;
-
-/**
- * @author alanrw
- *
- */
-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/40c404c1/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java
deleted file mode 100644
index 3e7d2cd..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/ProxyCallback.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.component;
-
-import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
-import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
-import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
-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 net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
-
-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;
-
-/**
- * @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/40c404c1/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
new file mode 100644
index 0000000..aa5550c
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
@@ -0,0 +1,152 @@
+package org.apache.taverna.component.activity;
+
+import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.getAnnotationString;
+import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.setAnnotationString;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
+import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
+import net.sf.taverna.t2.invocation.InvocationContext;
+import net.sf.taverna.t2.invocation.impl.InvocationContextImpl;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.Dataflow;
+import net.sf.taverna.t2.workflowmodel.EditException;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+
+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 uk.org.taverna.platform.execution.api.InvalidWorkflowException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+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 = getAnnotationString(realizingDataflow,
+ SemanticAnnotation.class, null);
+ if (annotationValue != null)
+ 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/40c404c1/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
new file mode 100644
index 0000000..66429cb
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
@@ -0,0 +1,145 @@
+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 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 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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * 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 (org.apache.taverna.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));
+ for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
+ outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
+
+ try {
+ eh = util.getFamily(getRegistryBase(), getFamilyName())
+ .getComponentProfile().getExceptionHandling();
+ if (eh != null)
+ outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
+ } catch (org.apache.taverna.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 org.apache.taverna.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/40c404c1/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
new file mode 100644
index 0000000..4c1b4f4
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
@@ -0,0 +1,125 @@
+package org.apache.taverna.component.activity;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
+import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+
+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 org.springframework.beans.factory.annotation.Required;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+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/40c404c1/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
new file mode 100644
index 0000000..a1223c2
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
@@ -0,0 +1,52 @@
+package org.apache.taverna.component.activity;
+
+import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
+import static org.apache.taverna.component.activity.ComponentHealthCheck.NON_SHAREABLE;
+
+import java.util.List;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.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/40c404c1/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
new file mode 100644
index 0000000..1d57df3
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
@@ -0,0 +1,69 @@
+/**
+ *
+ */
+package org.apache.taverna.component.activity;
+
+import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
+import static org.apache.log4j.Logger.getLogger;
+import static org.apache.taverna.component.activity.ComponentHealthCheck.OUT_OF_DATE;
+
+import java.util.List;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.registry.ComponentUtil;
+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/40c404c1/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
new file mode 100644
index 0000000..ac4b73d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.apache.taverna.component.activity;
+
+/**
+ * @author alanrw
+ *
+ */
+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/40c404c1/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
new file mode 100644
index 0000000..af480da
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.activity;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.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/40c404c1/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
new file mode 100644
index 0000000..a4e7246
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package org.apache.taverna.component.activity;
+
+/**
+ * @author alanrw
+ *
+ */
+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/40c404c1/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
new file mode 100644
index 0000000..927d63d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
@@ -0,0 +1,250 @@
+/**
+ *
+ */
+package org.apache.taverna.component.activity;
+
+import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
+import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
+import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
+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 net.sf.taverna.t2.invocation.InvocationContext;
+import net.sf.taverna.t2.reference.ErrorDocument;
+import net.sf.taverna.t2.reference.ErrorDocumentService;
+import net.sf.taverna.t2.reference.IdentifiedList;
+import net.sf.taverna.t2.reference.ListService;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
+
+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;
+
+/**
+ * @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/40c404c1/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
new file mode 100644
index 0000000..7953ef5
--- /dev/null
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
@@ -0,0 +1,8 @@
+/**
+ *
+ */
+/**
+ * @author stain
+ *
+ */
+package org.apache.taverna.component.activity;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/40c404c1/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 f1f47a6..c736675 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
@@ -7,16 +7,16 @@
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
<bean id="ComponentLocalHealthChecker"
- class="org.apache.taverna.component.ComponentActivityLocalChecker" />
+ class="org.apache.taverna.component.activity.ComponentActivityLocalChecker" />
<bean id="ComponentUpgradeHealthChecker"
- class="org.apache.taverna.component.ComponentActivityUpgradeChecker">
+ class="org.apache.taverna.component.activity.ComponentActivityUpgradeChecker">
<property name="componentUtil" ref="componentUtil" />
</bean>
<bean id="baseProfileLocator" class="org.apache.taverna.component.profile.BaseProfileLocator">
<property name="appConfig" ref="app-config" />
</bean>
- <bean id="componentActivityFactory" class="org.apache.taverna.component.ComponentActivityFactory">
+ <bean id="componentActivityFactory" class="org.apache.taverna.component.activity.ComponentActivityFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="dataflowCache" ref="cache" />
<property name="edits" ref="edits" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/40c404c1/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 322b848..7ada533 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,8 +1,8 @@
package org.apache.taverna.component;
-import org.apache.taverna.component.ComponentActivity;
-import org.apache.taverna.component.ComponentActivityConfigurationBean;
-import org.apache.taverna.component.ComponentActivityFactory;
+import org.apache.taverna.component.activity.ComponentActivity;
+import org.apache.taverna.component.activity.ComponentActivityConfigurationBean;
+import org.apache.taverna.component.activity.ComponentActivityFactory;
public class ComponentActivityTest {
[04/58] [abbrv] incubator-taverna-plugin-component git commit:
taverna-component-activity/
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/catalog/xml.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/catalog/xml.xsd b/taverna-component-activity/src/main/catalog/xml.xsd
new file mode 100644
index 0000000..aea7d0d
--- /dev/null
+++ b/taverna-component-activity/src/main/catalog/xml.xsd
@@ -0,0 +1,287 @@
+<?xml version='1.0'?>
+<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns ="http://www.w3.org/1999/xhtml"
+ xml:lang="en">
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+ <h1>About the XML namespace</h1>
+
+ <div class="bodytext">
+ <p>
+ This schema document describes the XML namespace, in a form
+ suitable for import by other schema documents.
+ </p>
+ <p>
+ See <a href="http://www.w3.org/XML/1998/namespace.html">
+ http://www.w3.org/XML/1998/namespace.html</a> and
+ <a href="http://www.w3.org/TR/REC-xml">
+ http://www.w3.org/TR/REC-xml</a> for information
+ about this namespace.
+ </p>
+ <p>
+ Note that local names in this namespace are intended to be
+ defined only by the World Wide Web Consortium or its subgroups.
+ The names currently defined in this namespace are listed below.
+ They should not be used with conflicting semantics by any Working
+ Group, specification, or document instance.
+ </p>
+ <p>
+ See further below in this document for more information about <a
+ href="#usage">how to refer to this schema document from your own
+ XSD schema documents</a> and about <a href="#nsversioning">the
+ namespace-versioning policy governing this schema document</a>.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>lang (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ is a language code for the natural language of the content of
+ any element; its value is inherited. This name is reserved
+ by virtue of its definition in the XML specification.</p>
+
+ </div>
+ <div>
+ <h4>Notes</h4>
+ <p>
+ Attempting to install the relevant ISO 2- and 3-letter
+ codes as the enumerated possible values is probably never
+ going to be a realistic possibility.
+ </p>
+ <p>
+ See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
+ http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
+ and the IANA language subtag registry at
+ <a href="http://www.iana.org/assignments/language-subtag-registry">
+ http://www.iana.org/assignments/language-subtag-registry</a>
+ for further information.
+ </p>
+ <p>
+ The union allows for the 'un-declaration' of xml:lang with
+ the empty string.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:language">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="space">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>space (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose
+ value is a keyword indicating what whitespace processing
+ discipline is intended for the content of the element; its
+ value is inherited. This name is reserved by virtue of its
+ definition in the XML specification.</p>
+
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>base (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ provides a URI to be used as the base for interpreting any
+ relative URIs in the scope of the element on which it
+ appears; its value is inherited. This name is reserved
+ by virtue of its definition in the XML Base specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="id" type="xs:ID">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>id (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ should be interpreted as if declared to be of type ID.
+ This name is reserved by virtue of its definition in the
+ xml:id specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+ <xs:attribute ref="xml:base"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute ref="xml:space"/>
+ <xs:attribute ref="xml:id"/>
+ </xs:attributeGroup>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>Father (in any context at all)</h3>
+
+ <div class="bodytext">
+ <p>
+ denotes Jon Bosak, the chair of
+ the original XML Working Group. This name is reserved by
+ the following decision of the W3C XML Plenary and
+ XML Coordination groups:
+ </p>
+ <blockquote>
+ <p>
+ In appreciation for his vision, leadership and
+ dedication the W3C XML Plenary on this 10th day of
+ February, 2000, reserves for Jon Bosak in perpetuity
+ the XML name "xml:Father".
+ </p>
+ </blockquote>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div xml:id="usage" id="usage">
+ <h2><a name="usage">About this schema document</a></h2>
+
+ <div class="bodytext">
+ <p>
+ This schema defines attributes and an attribute group suitable
+ for use by schemas wishing to allow <code>xml:base</code>,
+ <code>xml:lang</code>, <code>xml:space</code> or
+ <code>xml:id</code> attributes on elements they define.
+ </p>
+ <p>
+ To enable this, such a schema must import this schema for
+ the XML namespace, e.g. as follows:
+ </p>
+ <pre>
+ <schema . . .>
+ . . .
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ </pre>
+ <p>
+ or
+ </p>
+ <pre>
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+ </pre>
+ <p>
+ Subsequently, qualified reference to any of the attributes or the
+ group defined below will have the desired effect, e.g.
+ </p>
+ <pre>
+ <type . . .>
+ . . .
+ <attributeGroup ref="xml:specialAttrs"/>
+ </pre>
+ <p>
+ will define a type which will schema-validate an instance element
+ with any of those attributes.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div id="nsversioning" xml:id="nsversioning">
+ <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
+ <div class="bodytext">
+ <p>
+ In keeping with the XML Schema WG's standard versioning
+ policy, this schema document will persist at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a>.
+ </p>
+ <p>
+ At the date of issue it can also be found at
+ <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd</a>.
+ </p>
+ <p>
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XML
+ Schema itself, or with the XML namespace itself. In other words,
+ if the XML Schema or XML namespaces change, the version of this
+ document at <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd
+ </a>
+ will change accordingly; the version at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd
+ </a>
+ will not change.
+ </p>
+ <p>
+ Previous dated (and unchanging) versions of this schema
+ document are at:
+ </p>
+ <ul>
+ <li><a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2007/08/xml.xsd">
+ http://www.w3.org/2007/08/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2004/10/xml.xsd">
+ http://www.w3.org/2004/10/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2001/03/xml.xsd">
+ http://www.w3.org/2001/03/xml.xsd</a></li>
+ </ul>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+</xs:schema>
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
new file mode 100644
index 0000000..7a68813
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivity.java
@@ -0,0 +1,152 @@
+package net.sf.taverna.t2.component;
+
+import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.getAnnotationString;
+import static net.sf.taverna.t2.workflowmodel.utils.AnnotationTools.setAnnotationString;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
+import net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation;
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
+import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.utils.AnnotationUtils;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+import net.sf.taverna.t2.invocation.InvocationContext;
+import net.sf.taverna.t2.invocation.impl.InvocationContextImpl;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.Dataflow;
+import net.sf.taverna.t2.workflowmodel.EditException;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+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 = getAnnotationString(realizingDataflow,
+ SemanticAnnotation.class, null);
+ if (annotationValue != null)
+ 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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
new file mode 100644
index 0000000..7d04aac
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityConfigurationBean.java
@@ -0,0 +1,145 @@
+package net.sf.taverna.t2.component;
+
+import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static net.sf.taverna.t2.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static org.apache.log4j.Logger.getLogger;
+
+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.component.api.Version;
+import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
+import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.registry.ComponentVersionIdentification;
+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 uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * 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 (net.sf.taverna.t2.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));
+ for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
+ outputs.add(makeOutputDefinition(0, owp.getName()));//FIXME
+
+ try {
+ eh = util.getFamily(getRegistryBase(), getFamilyName())
+ .getComponentProfile().getExceptionHandling();
+ if (eh != null)
+ outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
+ } catch (net.sf.taverna.t2.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 net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
new file mode 100644
index 0000000..670a0af
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityFactory.java
@@ -0,0 +1,125 @@
+package net.sf.taverna.t2.component;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Version.ID;
+import net.sf.taverna.t2.component.registry.ComponentImplementationCache;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.component.utils.AnnotationUtils;
+import net.sf.taverna.t2.component.utils.SystemUtils;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
+import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+
+import org.springframework.beans.factory.annotation.Required;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
new file mode 100644
index 0000000..846c36f
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityLocalChecker.java
@@ -0,0 +1,52 @@
+package net.sf.taverna.t2.component;
+
+import static net.sf.taverna.t2.component.ComponentHealthCheck.NON_SHAREABLE;
+import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
+
+import java.util.List;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
new file mode 100644
index 0000000..70fc303
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentActivityUpgradeChecker.java
@@ -0,0 +1,69 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component;
+
+import static net.sf.taverna.t2.component.ComponentHealthCheck.OUT_OF_DATE;
+import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.registry.ComponentUtil;
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
+
+import org.apache.log4j.Logger;
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
new file mode 100644
index 0000000..f37e567
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentExceptionFactory.java
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component;
+
+/**
+ * @author alanrw
+ *
+ */
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
new file mode 100644
index 0000000..7d4c906
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentHealthCheck.java
@@ -0,0 +1,24 @@
+package net.sf.taverna.t2.component;
+
+import net.sf.taverna.t2.visit.VisitKind;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
new file mode 100644
index 0000000..11a8fde
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ComponentImplementationException.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component;
+
+/**
+ * @author alanrw
+ *
+ */
+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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
new file mode 100644
index 0000000..75f5b21
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/ProxyCallback.java
@@ -0,0 +1,250 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component;
+
+import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
+import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
+import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
+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 net.sf.taverna.t2.component.api.profile.ExceptionHandling;
+import net.sf.taverna.t2.component.api.profile.ExceptionReplacement;
+import net.sf.taverna.t2.component.api.profile.HandleException;
+import net.sf.taverna.t2.invocation.InvocationContext;
+import net.sf.taverna.t2.reference.ErrorDocument;
+import net.sf.taverna.t2.reference.ErrorDocumentService;
+import net.sf.taverna.t2.reference.IdentifiedList;
+import net.sf.taverna.t2.reference.ListService;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
new file mode 100644
index 0000000..92b4e51
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ActivityProfileImpl.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.profile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.profile.ActivityProfile;
+import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import net.sf.taverna.t2.component.api.profile.doc.Activity;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
new file mode 100644
index 0000000..d39ee57
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/BaseProfileLocator.java
@@ -0,0 +1,145 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.component.profile;
+
+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 net.sf.taverna.t2.component.api.ComponentException;
+
+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 uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+/**
+ * @author alanrw
+ *
+ */
+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(), "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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
new file mode 100644
index 0000000..2a37972
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/ComponentProfileImpl.java
@@ -0,0 +1,686 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.profile;
+
+import static com.hp.hpl.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 net.sf.taverna.t2.workflowmodel.health.HealthCheck.NO_PROBLEM;
+import static net.sf.taverna.t2.workflowmodel.health.RemoteHealthChecker.contactEndpoint;
+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 net.sf.taverna.t2.component.api.ComponentException;
+import net.sf.taverna.t2.component.api.Registry;
+import net.sf.taverna.t2.component.api.profile.ActivityProfile;
+import net.sf.taverna.t2.component.api.profile.ExceptionHandling;
+import net.sf.taverna.t2.component.api.profile.PortProfile;
+import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+
+import net.sf.taverna.t2.component.api.profile.doc.Activity;
+import net.sf.taverna.t2.component.api.profile.doc.Ontology;
+import net.sf.taverna.t2.component.api.profile.doc.Port;
+import net.sf.taverna.t2.component.api.profile.doc.Profile;
+import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.OntProperty;
+
+/**
+ * A ComponentProfile specifies the inputs, outputs and semantic annotations
+ * that a Component must contain.
+ *
+ * @author David Withers
+ */
+public class ComponentProfileImpl implements
+ net.sf.taverna.t2.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 net.sf.taverna.t2.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 net.sf.taverna.t2.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 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<net.sf.taverna.t2.component.api.profile.ActivityProfile> getActivityProfiles() {
+ List<net.sf.taverna.t2.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
+ net.sf.taverna.t2.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<net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
new file mode 100644
index 0000000..31eb5f6
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/PortProfileImpl.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.profile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.taverna.t2.component.api.profile.PortProfile;
+import net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import net.sf.taverna.t2.component.api.profile.doc.Port;
+import net.sf.taverna.t2.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
new file mode 100644
index 0000000..9961aa0
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/profile/SemanticAnnotationProfileImpl.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.component.profile;
+
+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 net.sf.taverna.t2.component.api.profile.SemanticAnnotationProfile;
+import net.sf.taverna.t2.component.api.profile.doc.SemanticAnnotation;
+
+import com.hp.hpl.jena.ontology.Individual;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.OntProperty;
+import com.hp.hpl.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/e15f9c85/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
new file mode 100644
index 0000000..b06ae67
--- /dev/null
+++ b/taverna-component-activity/src/main/java/net/sf/taverna/t2/component/registry/ClientVersion.java
@@ -0,0 +1,33 @@
+package net.sf.taverna.t2.component.registry;
+
+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;
+ }
+
+}