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/03/06 23:34:41 UTC
[45/50] [abbrv] incubator-taverna-workbench git commit: taverna-*
taverna-*
.. and observer goes, as it's already in taverna-engine
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/commit/f676ef35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/tree/f676ef35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/diff/f676ef35
Branch: refs/heads/master
Commit: f676ef352e740a17bcc03aee32f72c98276c3c47
Parents: f0af04e
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Mar 6 22:28:07 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Mar 6 22:28:07 2015 +0000
----------------------------------------------------------------------
README.md | 3 -
beans/pom.xml | 21 -
.../t2/lang/beans/PropertyAnnotated.java | 74 ---
.../t2/lang/beans/PropertyAnnotation.java | 109 ---
.../lang/beans/PropertyAnnotationExtractor.java | 202 ------
io/pom.xml | 21 -
.../net/sf/taverna/t2/lang/io/StreamCopier.java | 69 --
.../sf/taverna/t2/lang/io/StreamDevourer.java | 106 ---
observer/pom.xml | 28 -
.../taverna/t2/lang/observer/MultiCaster.java | 93 ---
.../sf/taverna/t2/lang/observer/Observable.java | 56 --
.../sf/taverna/t2/lang/observer/Observer.java | 44 --
.../t2/lang/observer/SwingAwareObserver.java | 51 --
.../taverna/t2/lang/observer/package-info.java | 73 ---
.../taverna/t2/lang/observer/ObserverTest.java | 133 ----
partition/pom.xml | 23 -
.../sf/taverna/t2/partition/HashSetModel.java | 116 ----
.../net/sf/taverna/t2/partition/Partition.java | 441 -------------
.../t2/partition/PartitionAlgorithm.java | 47 --
.../t2/partition/PartitionAlgorithmSetSPI.java | 36 -
.../t2/partition/PropertyExtractorRegistry.java | 37 --
.../t2/partition/PropertyExtractorSPI.java | 44 --
.../java/net/sf/taverna/t2/partition/Query.java | 56 --
.../sf/taverna/t2/partition/RootPartition.java | 394 -----------
.../net/sf/taverna/t2/partition/SetModel.java | 53 --
.../t2/partition/SetModelChangeListener.java | 42 --
.../algorithms/CustomPartitionAlgorithm.java | 98 ---
.../LiteralValuePartitionAlgorithm.java | 106 ---
.../ui/PartitionAlgorithmListEditor.java | 224 -------
.../t2/partition/ui/TableTreeNodeColumn.java | 69 --
.../t2/partition/ui/TableTreeNodeRenderer.java | 554 ----------------
.../net/sf/taverna/t2/partition/ui/UITest.java | 58 --
.../t2/partition/PartitionTestApplication.java | 280 --------
.../LiteralValuePartitionAlgorithmTest.java | 68 --
taverna-beaninfo/pom.xml | 21 +
.../t2/lang/beans/PropertyAnnotated.java | 74 +++
.../t2/lang/beans/PropertyAnnotation.java | 109 +++
.../lang/beans/PropertyAnnotationExtractor.java | 202 ++++++
taverna-io/pom.xml | 21 +
.../net/sf/taverna/t2/lang/io/StreamCopier.java | 69 ++
.../sf/taverna/t2/lang/io/StreamDevourer.java | 106 +++
taverna-partition/pom.xml | 23 +
.../sf/taverna/t2/partition/HashSetModel.java | 116 ++++
.../net/sf/taverna/t2/partition/Partition.java | 441 +++++++++++++
.../t2/partition/PartitionAlgorithm.java | 47 ++
.../t2/partition/PartitionAlgorithmSetSPI.java | 36 +
.../t2/partition/PropertyExtractorRegistry.java | 37 ++
.../t2/partition/PropertyExtractorSPI.java | 44 ++
.../java/net/sf/taverna/t2/partition/Query.java | 56 ++
.../sf/taverna/t2/partition/RootPartition.java | 394 +++++++++++
.../net/sf/taverna/t2/partition/SetModel.java | 53 ++
.../t2/partition/SetModelChangeListener.java | 42 ++
.../algorithms/CustomPartitionAlgorithm.java | 98 +++
.../LiteralValuePartitionAlgorithm.java | 106 +++
.../ui/PartitionAlgorithmListEditor.java | 224 +++++++
.../t2/partition/ui/TableTreeNodeColumn.java | 69 ++
.../t2/partition/ui/TableTreeNodeRenderer.java | 554 ++++++++++++++++
.../net/sf/taverna/t2/partition/ui/UITest.java | 58 ++
.../t2/partition/PartitionTestApplication.java | 280 ++++++++
.../LiteralValuePartitionAlgorithmTest.java | 68 ++
taverna-ui/pom.xml | 36 +
.../net/sf/taverna/t2/lang/ui/CArrowImage.java | 198 ++++++
.../t2/lang/ui/CTransferableTreePath.java | 66 ++
.../taverna/t2/lang/ui/DeselectingButton.java | 45 ++
.../sf/taverna/t2/lang/ui/DialogTextArea.java | 83 +++
.../sf/taverna/t2/lang/ui/EdgeLineBorder.java | 91 +++
.../sf/taverna/t2/lang/ui/EditorKeySetUtil.java | 67 ++
.../taverna/t2/lang/ui/ExtensionFileFilter.java | 105 +++
.../net/sf/taverna/t2/lang/ui/FileTools.java | 117 ++++
.../net/sf/taverna/t2/lang/ui/HtmlUtils.java | 87 +++
.../sf/taverna/t2/lang/ui/JSplitPaneExt.java | 56 ++
.../sf/taverna/t2/lang/ui/KeywordDocument.java | 568 ++++++++++++++++
.../t2/lang/ui/LineEnabledTextPanel.java | 106 +++
.../net/sf/taverna/t2/lang/ui/LinePainter.java | 163 +++++
.../t2/lang/ui/LineWrappingTextArea.java | 217 ++++++
.../sf/taverna/t2/lang/ui/NoWrapEditorKit.java | 77 +++
.../sf/taverna/t2/lang/ui/ReadOnlyTextArea.java | 50 ++
.../t2/lang/ui/SanitisingDocumentFilter.java | 60 ++
.../net/sf/taverna/t2/lang/ui/ShadedLabel.java | 126 ++++
.../net/sf/taverna/t2/lang/ui/TableMap.java | 69 ++
.../net/sf/taverna/t2/lang/ui/TableSorter.java | 341 ++++++++++
.../t2/lang/ui/ValidatingUserInputDialog.java | 274 ++++++++
.../net/sf/taverna/t2/lang/ui/icons/Icons.java | 48 ++
.../lang/ui/tabselector/ScrollController.java | 85 +++
.../sf/taverna/t2/lang/ui/tabselector/Tab.java | 200 ++++++
.../t2/lang/ui/tabselector/TabLayout.java | 135 ++++
.../ui/tabselector/TabSelectorComponent.java | 99 +++
.../lang/ui/treetable/AbstractCellEditor.java | 81 +++
.../ui/treetable/AbstractTreeTableModel.java | 198 ++++++
.../t2/lang/ui/treetable/JTreeTable.LICENSE | 59 ++
.../t2/lang/ui/treetable/JTreeTable.java | 657 +++++++++++++++++++
.../t2/lang/ui/treetable/LinesBorder.java | 178 +++++
.../t2/lang/ui/treetable/TreeTableModel.java | 69 ++
.../ui/treetable/TreeTableModelAdapter.java | 132 ++++
.../net/sf/taverna/t2/lang/ui/icons/ok.png | Bin 0 -> 3318 bytes
.../net/sf/taverna/t2/lang/ui/icons/severe.png | Bin 0 -> 867 bytes
.../net/sf/taverna/t2/lang/ui/icons/warning.png | Bin 0 -> 3459 bytes
ui/pom.xml | 36 -
.../net/sf/taverna/t2/lang/ui/CArrowImage.java | 198 ------
.../t2/lang/ui/CTransferableTreePath.java | 66 --
.../taverna/t2/lang/ui/DeselectingButton.java | 45 --
.../sf/taverna/t2/lang/ui/DialogTextArea.java | 83 ---
.../sf/taverna/t2/lang/ui/EdgeLineBorder.java | 91 ---
.../sf/taverna/t2/lang/ui/EditorKeySetUtil.java | 67 --
.../taverna/t2/lang/ui/ExtensionFileFilter.java | 105 ---
.../net/sf/taverna/t2/lang/ui/FileTools.java | 117 ----
.../net/sf/taverna/t2/lang/ui/HtmlUtils.java | 87 ---
.../sf/taverna/t2/lang/ui/JSplitPaneExt.java | 56 --
.../sf/taverna/t2/lang/ui/KeywordDocument.java | 568 ----------------
.../t2/lang/ui/LineEnabledTextPanel.java | 106 ---
.../net/sf/taverna/t2/lang/ui/LinePainter.java | 163 -----
.../t2/lang/ui/LineWrappingTextArea.java | 217 ------
.../sf/taverna/t2/lang/ui/NoWrapEditorKit.java | 77 ---
.../sf/taverna/t2/lang/ui/ReadOnlyTextArea.java | 50 --
.../t2/lang/ui/SanitisingDocumentFilter.java | 60 --
.../net/sf/taverna/t2/lang/ui/ShadedLabel.java | 126 ----
.../net/sf/taverna/t2/lang/ui/TableMap.java | 69 --
.../net/sf/taverna/t2/lang/ui/TableSorter.java | 341 ----------
.../t2/lang/ui/ValidatingUserInputDialog.java | 274 --------
.../net/sf/taverna/t2/lang/ui/icons/Icons.java | 48 --
.../lang/ui/tabselector/ScrollController.java | 85 ---
.../sf/taverna/t2/lang/ui/tabselector/Tab.java | 200 ------
.../t2/lang/ui/tabselector/TabLayout.java | 135 ----
.../ui/tabselector/TabSelectorComponent.java | 99 ---
.../lang/ui/treetable/AbstractCellEditor.java | 81 ---
.../ui/treetable/AbstractTreeTableModel.java | 198 ------
.../t2/lang/ui/treetable/JTreeTable.LICENSE | 59 --
.../t2/lang/ui/treetable/JTreeTable.java | 657 -------------------
.../t2/lang/ui/treetable/LinesBorder.java | 178 -----
.../t2/lang/ui/treetable/TreeTableModel.java | 69 --
.../ui/treetable/TreeTableModelAdapter.java | 132 ----
.../net/sf/taverna/t2/lang/ui/icons/ok.png | Bin 3318 -> 0 bytes
.../net/sf/taverna/t2/lang/ui/icons/severe.png | Bin 867 -> 0 bytes
.../net/sf/taverna/t2/lang/ui/icons/warning.png | Bin 3459 -> 0 bytes
134 files changed, 8291 insertions(+), 8772 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
deleted file mode 100644
index 58d1f52..0000000
--- a/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Taverna Workflow system assorted support utilities
-
-This code was previously hosted at http://taverna.googlecode.com/svn/taverna/utils/net.sf.taverna.t2.lang/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/beans/pom.xml
----------------------------------------------------------------------
diff --git a/beans/pom.xml b/beans/pom.xml
deleted file mode 100644
index ea51b1a..0000000
--- a/beans/pom.xml
+++ /dev/null
@@ -1,21 +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.t2</groupId>
- <artifactId>lang</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.t2.lang</groupId>
- <artifactId>beans</artifactId>
- <packaging>bundle</packaging>
- <name>BeanInfo extensions</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java
----------------------------------------------------------------------
diff --git a/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java b/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java
deleted file mode 100644
index aa59e68..0000000
--- a/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- **********************************************************************/
-package net.sf.taverna.t2.lang.beans;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.beans.SimpleBeanInfo;
-
-/**
- * A {@link BeanInfo} that includes {@link PropertyDescriptor}s from methods
- * annotated using {@link PropertyAnnotation}.
- * <p>
- * The bean info from the PropertyAnnotation will then be available through
- * Java's {@link Introspector}, and allows you to specify details such as
- * {@link PropertyAnnotation#displayName()} and
- * {@link PropertyAnnotation#hidden()} for the properties of a Java Bean.
- * <p>
- * This class can either be used as a superclass for the classes containing
- * property annotated methods, or put in a neighbouring BeanInfo class.
- * <p>
- * For instance, if your class is called DescribedClass and has methods
- * annotated using {@link PropertyAnnotation}, either let DescribedClass
- * subclass {@link PropertyAnnotated}, or make a neighbouring {@link BeanInfo}
- * class called DescribedClassBeanInfo, which should subclass
- * {@link PropertyAnnotated}.
- *
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class PropertyAnnotated extends SimpleBeanInfo {
-
- private static PropertyAnnotationExtractor extractor = new PropertyAnnotationExtractor();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public PropertyDescriptor[] getPropertyDescriptors() {
- return extractor.getPropertyDescriptors(getDescribedClass());
- }
-
- /**
- * The class that is being described. By default this returns
- * {@link #getClass()} so that {@link PropertyAnnotated} can be used as a
- * superclass, but if instead the DescribedClassBeanInfo pattern is used,
- * subclass PropertyAnnotated in each BeanInfo class, and override this
- * method to return the described class. (DescribedClass in this example)
- *
- */
- public Class<?> getDescribedClass() {
- return getClass();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java b/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java
deleted file mode 100644
index 5923a21..0000000
--- a/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**********************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- **********************************************************************/
-package net.sf.taverna.t2.lang.beans;
-
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * An annotation of a Java bean style property method, ie. a getXX() or setXX()
- * method.
- * <p>
- * The annotations allow the method to better describe properties such as
- * {@link #displayName()}, {@link #shortDescription()} and {@link #hidden()}.
- * <p>
- * The annotations can be retrieved as {@link PropertyDescriptor} using
- * {@link PropertyAnnotationExtractor}, or if {@link PropertyAnnotated} has been
- * used (recommended), through Java's BeanInfo support, such as using
- * {@link Introspector}.
- * <p>
- * Annotations can be applied to interfaces or classes, abstract and normal
- * methods, as long as they confirm with the Java bean conventions. Annotations
- * will be inherited, so overriding methods don't need to reapply the annotations,
- * although they can if they want to override.
- * <p>
- * It is recommended that classes using these annotations either subclass
- * {@link PropertyAnnotated} or have a neighbouring BeanInfo class that
- * subclasses PropertyAnnotated.
- * <p>
- * Example usage:
- *
- * <pre>
- * public interface MyBean {
- * // Annotation for the property called "name". displayName: Title
- * // of the property shown in UI instead of "name".
- * @PropertyAnnotation(displayName = "Full name")
- * public String getName();
- *
- * // Second annotation for the write-method of the same property called
- * // "name". Both displayName and shortDescription will be set on the
- * // property descriptor.
- * @PropertyAnnotation(shortDescription = "The name of the person")
- * public void setName(String name);
- *
- * // Boolean read method for the property "married", two annotations.
- * // expert: Only shown in UI under "advanced" views.
- * @PropertyAnnotation(expert = true, shortDescription = "Marital status")
- * public boolean isMarried();
- *
- * // Write-method for the "married" property, no new annotations, but will
- * // get the ones from {@link #isMarried()}.
- * public void setMarried(boolean married);
- *
- * // Write-only method, hidden (not shown in UIs).
- * @PropertyAnnotation(hidden = true)
- * public void setID(String id);
- *
- * // Read-only method, no annotations, defaults will be used.
- * public void getTelephoneNumber(String number);
- * }
- * </pre>
- *
- * @see PropertyAnnotated
- * @author Stian Soiland-Reyes
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target( { ElementType.METHOD })
-public @interface PropertyAnnotation {
-
- /**
- * A unique string that means the default should be used
- */
- public static String DEFAULT = "Default_8930B86A-50C0-4859-9B6F-DD034B3C5C1E";
-
- String displayName() default DEFAULT;
-
- String name() default DEFAULT;
-
- String shortDescription() default DEFAULT;
-
- boolean expert() default false;
-
- boolean hidden() default false;
-
- boolean preferred() default false;
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java
----------------------------------------------------------------------
diff --git a/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java b/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java
deleted file mode 100644
index 4524822..0000000
--- a/beans/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/**********************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- **********************************************************************/
-package net.sf.taverna.t2.lang.beans;
-
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A utility class for extracting {@link PropertyDescriptor}s from a class which
- * methods have been described using {@link PropertyAnnotation}.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class PropertyAnnotationExtractor {
-
- protected static Pattern methodPattern = Pattern
- .compile("(get|is|set)(.+)");
-
- protected WeakHashMap<Class<?>, List<Method>> allMethodsCache = new WeakHashMap<Class<?>, List<Method>>();
-
- protected WeakHashMap<Class<?>, PropertyDescriptor[]> propertyDescriptorsCache = new WeakHashMap<Class<?>, PropertyDescriptor[]>();
-
- @SuppressWarnings("unchecked")
- protected List<Class> ignoreClasses = Arrays.<Class>asList(Class.class, Object.class, PropertyAnnotated.class);
-
- /**
- * Find PropertyDescriptors for the given bean class based on descriptions
- * using {@link PropertyAnnotation}s.
- * <p>
- * Annotations will be inherited from interfaces and superclasses.
- *
- * @param beanClass
- * @return Array of {@link PropertyDescriptor}
- */
- public PropertyDescriptor[] getPropertyDescriptors(Class<?> beanClass) {
- PropertyDescriptor[] cached = propertyDescriptorsCache.get(beanClass);
- if (cached != null) {
- return cached;
- }
-
- Map<String, PropertyDescriptor> descriptors = new HashMap<String, PropertyDescriptor>();
-
- for (Method method : allMethods(beanClass)) {
- PropertyAnnotation annotation = method
- .getAnnotation(PropertyAnnotation.class);
- Matcher methodMatcher = methodPattern.matcher(method.getName());
- if (!methodMatcher.matches() && annotation == null) {
- continue;
- }
-
- String name = PropertyAnnotation.DEFAULT;
- if (annotation != null) {
- annotation.name();
- }
- if (name.equals(PropertyAnnotation.DEFAULT)) {
- name = methodMatcher.group(2);
- if (name.length() < 1) {
- continue;
- }
- // decapitalize first letter
- name = name.substring(0, 1).toLowerCase() + name.substring(1);
- }
- Method writeMethod = null;
- Method readMethod = null;
- if (methodMatcher.group(1).equals("set")) {
- writeMethod = method;
- if (writeMethod.getParameterTypes().length != 1) {
- continue;
- }
- } else {
- readMethod = method;
- if (readMethod.getParameterTypes().length != 0) {
- continue;
- }
- }
-
- PropertyDescriptor descriptor = descriptors.get(name);
- try {
- if (descriptor == null) {
- descriptor = new PropertyDescriptor(name, readMethod,
- writeMethod);
- descriptors.put(name, descriptor);
- }
- // Set the one we just found
- if (readMethod != null) {
- descriptor.setReadMethod(readMethod);
- }
- if (writeMethod != null) {
- descriptor.setWriteMethod(writeMethod);
- }
- } catch (IntrospectionException ex) {
- throw new RuntimeException("Can't inspect property " + name
- + " using method " + method, ex);
- }
- if (annotation != null) {
- descriptor.setExpert(annotation.expert());
- descriptor.setHidden(annotation.hidden());
- descriptor.setPreferred(annotation.preferred());
- if (!annotation.displayName()
- .equals(PropertyAnnotation.DEFAULT)) {
- descriptor.setDisplayName(annotation.displayName());
- }
- if (!annotation.shortDescription().equals(
- PropertyAnnotation.DEFAULT)) {
- descriptor.setShortDescription(annotation
- .shortDescription());
- }
- }
- }
- cached = descriptors.values().toArray(
- new PropertyDescriptor[descriptors.size()]);
- propertyDescriptorsCache.put(beanClass, cached);
- return cached;
- }
-
- /**
- * Find all {@link Method}s defined in the class, all its superclasses and
- * interfaces. This might include methods that override each other.
- * <p>
- * The list contains first the methods from each of the class's interfaces
- * (and the methods they inherit from their interfaces), then recurses for
- * the subclass of this class (including any additional interfaces used in
- * the superclasses), before finally adding methods declared in the given
- * class.
- * <p>
- * This can be useful to find annotations given to methods that have been
- * overridden in subclasses.
- *
- * @param theClass
- * @return
- */
- @SuppressWarnings("unchecked")
- protected List<Method> allMethods(Class<?> theClass) {
- List<Method> methods = allMethodsCache.get(theClass);
- if (methods == null) {
- methods = new ArrayList<Method>();
- allMethods(theClass, new HashSet<Class>(ignoreClasses), methods);
- allMethodsCache.put(theClass, methods);
- }
- return methods;
- }
-
- @SuppressWarnings("unchecked")
- protected void allMethods(Class<?> theClass, Set<Class> visitedClasses,
- List<Method> foundMethods) {
- if (theClass == null || theClass == Object.class
- || theClass == Class.class || !visitedClasses.add(theClass)) {
- // Top class or already visted
- return;
- }
- // Let's first dig down into our interfaces
- for (Class anInterface : theClass.getInterfaces()) {
- allMethods(anInterface, visitedClasses, foundMethods);
- }
- // And our superclasses
- allMethods(theClass.getSuperclass(), visitedClasses, foundMethods);
- // Before we find any methods only declared in this class
- // (parent methods are already earlier in the list -
- // note that the new methods might override earlier methods)
- for (Method method : theClass.getDeclaredMethods()) {
- int methodModifiers = method.getModifiers();
- if (!Modifier.isPublic(methodModifiers)
- || Modifier.isStatic(methodModifiers)) {
- continue;
- }
- assert !foundMethods.contains(method) : "Method discovered twice: "
- + method;
- foundMethods.add(method);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/io/pom.xml
----------------------------------------------------------------------
diff --git a/io/pom.xml b/io/pom.xml
deleted file mode 100644
index 1512fd7..0000000
--- a/io/pom.xml
+++ /dev/null
@@ -1,21 +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.t2</groupId>
- <artifactId>lang</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.t2.lang</groupId>
- <artifactId>io</artifactId>
- <packaging>bundle</packaging>
- <name>IO utility classes</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
----------------------------------------------------------------------
diff --git a/io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java b/io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
deleted file mode 100644
index b0d600d..0000000
--- a/io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.lang.io;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.log4j.Logger;
-
-/**
- * Copies an InputStream to an OutputStream.
- *
- * @author Tom Oinn
- */
-public class StreamCopier extends Thread {
-
- private static Logger logger = Logger
- .getLogger(StreamCopier.class);
-
- InputStream is;
-
- OutputStream os;
-
- /**
- * Create a new StreamCopier which will, when started, copy the specified
- * InputStream to the specified OutputStream
- */
- public StreamCopier(InputStream is, OutputStream os) {
- super("StreamCopier");
- this.is = is;
- this.os = os;
- }
-
- /**
- * Start copying the stream, exits when the InputStream runs out of data
- */
- public void run() {
- try {
- byte[] buffer = new byte[1024];
- int bytesRead;
- while ((bytesRead = is.read(buffer)) != -1) {
- os.write(buffer, 0, bytesRead);
- }
- os.flush();
- os.close();
- } catch (Exception ex) {
- logger.error("Could not copy stream", ex);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
----------------------------------------------------------------------
diff --git a/io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java b/io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
deleted file mode 100644
index 8495e27..0000000
--- a/io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.lang.io;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.log4j.Logger;
-
-/**
- * Devours an input stream and allows the contents to be read as a String once
- * the stream has completed.
- *
- * @author Tom Oinn
- * @author Alan R Williams
- */
-public class StreamDevourer extends Thread {
-
- private static Logger logger = Logger.getLogger(StreamDevourer.class);
-
- private static byte[] newLine = System.getProperty("line.separator").getBytes();
-
- BufferedReader br;
-
- ByteArrayOutputStream output;
-
- /**
- * Returns the current value of the internal ByteArrayOutputStream
- */
- @Override
- public String toString() {
- return output.toString();
- }
-
- /**
- * Waits for the stream to close then returns the String representation of
- * its contents (this is equivalent to doing a join then calling toString)
- */
- public String blockOnOutput() {
- try {
- this.join();
- return output.toString();
- } catch (InterruptedException ie) {
- logger.error("Interrupted", ie);
- interrupt();
- return "";
- }
- }
-
- /**
- * Create the StreamDevourer and point it at an InputStream to consume
- */
- public StreamDevourer(InputStream is) {
- super("StreamDevourer");
- this.br = new BufferedReader(new InputStreamReader(is));
- this.output = new ByteArrayOutputStream();
- }
-
- /**
- * When started this Thread will copy all data from the InputStream into a
- * ByteArrayOutputStream via a BufferedReader. Because of the use of the
- * BufferedReader this is only really appropriate for streams of textual
- * data
- */
- @Override
- public void run() {
- try {
- String line = null;
- while ((line = br.readLine()) != null) {
- // && line.endsWith("</svg>") == false) {
- if (line.endsWith("\\") && !line.endsWith("\\\\")) {
- line = line.substring(0, line.length() - 1);
- output.write(line.getBytes());
- } else {
- output.write(line.getBytes());
- output.write(newLine);
- }
- }
- br.close();
- } catch (IOException ioe) {
- logger.error(ioe);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/pom.xml
----------------------------------------------------------------------
diff --git a/observer/pom.xml b/observer/pom.xml
deleted file mode 100644
index 76e8140..0000000
--- a/observer/pom.xml
+++ /dev/null
@@ -1,28 +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.t2</groupId>
- <artifactId>lang</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.t2.lang</groupId>
- <artifactId>observer</artifactId>
- <packaging>bundle</packaging>
- <name>Observer pattern</name>
- <description>Implementation of the Observer pattern.</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/src/main/java/net/sf/taverna/t2/lang/observer/MultiCaster.java
----------------------------------------------------------------------
diff --git a/observer/src/main/java/net/sf/taverna/t2/lang/observer/MultiCaster.java b/observer/src/main/java/net/sf/taverna/t2/lang/observer/MultiCaster.java
deleted file mode 100644
index d563e39..0000000
--- a/observer/src/main/java/net/sf/taverna/t2/lang/observer/MultiCaster.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.lang.observer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-/**
- * Send notifications to registered observers about changes to models
- *
- * @author Ian Dunlop
- * @author Stian Soiland
- *
- * @param <Message>
- */
-public class MultiCaster<Message> implements Observable<Message> {
-
- private static Logger logger = Logger.getLogger(MultiCaster.class);
-
- private Observable<Message> observable;
-
- protected List<Observer<Message>> observers = new ArrayList<Observer<Message>>();
-
- /**
- * Set the {@link #observable} ie. the class that changes are happening to
- * and it's Message for this {@link MultiCaster}
- *
- * @param observable
- */
- public MultiCaster(Observable<Message> observable) {
- this.observable = observable;
- }
-
- /**
- * Tell all the registered observers about the change to the model
- *
- * @param message
- */
- @SuppressWarnings("unchecked")
- public void notify(Message message) {
- // Use a copy that can be iterated even if register/remove is called
- for (Observer<Message> observer : getObservers()) {
- try {
- observer.notify(observable, message);
- } catch (Exception ex) {
- logger.warn("Could not notify " + observer, ex);
- }
- }
- }
-
- /**
- * Register an observer ie. someone who wants informed about changes
- */
- public synchronized void addObserver(Observer<Message> observer) {
- observers.add(observer);
- }
-
- /**
- * Remove the observer and no longer send out any notifications about it
- */
- public synchronized void removeObserver(Observer<Message> observer) {
- observers.remove(observer);
- }
-
- /**
- * A list of all the classes currently registered with this
- * {@link MultiCaster}
- */
- public synchronized List<Observer<Message>> getObservers() {
- return new ArrayList<Observer<Message>>(observers);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observable.java
----------------------------------------------------------------------
diff --git a/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observable.java b/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observable.java
deleted file mode 100644
index 1fa7425..0000000
--- a/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observable.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.lang.observer;
-
-import java.util.List;
-
-/**
- * Implements this if you want to notify other classes about changes
- *
- * @author Ian Dunlop
- * @author Stian Soiland
- *
- * @param <Message>
- */
-public interface Observable<Message> {
- /**
- * Register an {@link Observer}
- *
- * @param observer
- * the class who wants notified of changes
- */
- public void addObserver(Observer<Message> observer);
-
- /**
- * Remove a class who is currently observing
- *
- * @param observer
- * the class who no longer wants notified
- */
- public void removeObserver(Observer<Message> observer);
-
- /**
- * A list of all the currently registered {@link Observer}s
- *
- * @return
- */
- public List<Observer<Message>> getObservers();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observer.java
----------------------------------------------------------------------
diff --git a/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observer.java b/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observer.java
deleted file mode 100644
index 81b7c85..0000000
--- a/observer/src/main/java/net/sf/taverna/t2/lang/observer/Observer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.lang.observer;
-
-/**
- * Implement if you want to register with an {@link Observable}
- *
- * @author Ian Dunlop
- * @author Stian Soiland
- *
- * @param <Message>
- */
-public interface Observer<Message> {
- /**
- * Called by the {@link Observable} to notify the implementing class of
- * changes
- *
- * @param sender
- * the class where the changes have happened
- * @param message
- * what has changed
- * @throws Exception
- */
- public void notify(Observable<Message> sender, Message message)
- throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/src/main/java/net/sf/taverna/t2/lang/observer/SwingAwareObserver.java
----------------------------------------------------------------------
diff --git a/observer/src/main/java/net/sf/taverna/t2/lang/observer/SwingAwareObserver.java b/observer/src/main/java/net/sf/taverna/t2/lang/observer/SwingAwareObserver.java
deleted file mode 100644
index 39435d7..0000000
--- a/observer/src/main/java/net/sf/taverna/t2/lang/observer/SwingAwareObserver.java
+++ /dev/null
@@ -1,51 +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.lang.observer;
-
-import javax.swing.SwingUtilities;
-
-/**
- * Implementation of an {@link Observer} that adds calls to notify to the AWT event dispatching
- * thread.
- *
- * @author David Withers
- */
-public abstract class SwingAwareObserver<Message> implements Observer<Message> {
-
- @Override
- public void notify(final Observable<Message> sender, final Message message) throws Exception {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- notifySwing(sender, message);
- }
- };
- if (SwingUtilities.isEventDispatchThread()) {
- runnable.run();
- } else {
- // T2-971
- SwingUtilities.invokeLater(runnable);
- }
- }
-
- public abstract void notifySwing(Observable<Message> sender, Message message);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/src/main/java/net/sf/taverna/t2/lang/observer/package-info.java
----------------------------------------------------------------------
diff --git a/observer/src/main/java/net/sf/taverna/t2/lang/observer/package-info.java b/observer/src/main/java/net/sf/taverna/t2/lang/observer/package-info.java
deleted file mode 100644
index e9d3ff2..0000000
--- a/observer/src/main/java/net/sf/taverna/t2/lang/observer/package-info.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- * Implementation of the observer pattern. {@link Observer}s registers with an
- * {@link Observable} using {@link Observable#addObserver(Observer)}, and will receive
- * notifications as a call to {@link Observer#notify(Observable, Object)}.
- * <p>
- * Typical implementations of {@link Observable} will be delegating to a
- * {@link MultiCaster} to do the boring observer registration and message
- * dispatching.
- * </p>
- * <p>
- * Example of Observable:
- * <pre>
- * public class MyObservable implements Observable<MyEvent> {
- * public static class MyEvent {
- * // ..
- * }
- * private MultiCaster<:MyEvent> multiCaster = new MultiCaster<:MyEvent>(this);
- *
- * public void doStuff() {
- * multiCaster.notify(new MyEvent());
- * }
- *
- * public void addObserver(Observer<MyEvent> observer) {
- * multiCaster.addObserver(observer);
- * }
- *
- * public List<Observer<MyEvent>> getObservers() {
- * return multiCaster.getObservers();
- * }
- *
- * public void removeObserver(Observer<MyEvent> observer) {
- * multiCaster.removeObserver(observer);
- * }
- * }
- * </pre>
- * And an observer that is notified when MyObservable.doStuff() is called:
- * <pre>
- * public class MyObserver implements Observer<MyEvent> {
- * public void notify(Observable<MyEvent> sender, MyEvent message) {
- * System.out.println("Receieved " + message + " from " + sender);
- * }
- * }
- * </pre>
- * Example of usage:
- * <pre>
- * MyObservable observable = new MyObservable();
- * MyObserver observer = new MyObserver();
- * observable.addObserver(observer);
- * observable.doStuff();
- * </pre>
- */
-package net.sf.taverna.t2.lang.observer;
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/observer/src/test/java/net/sf/taverna/t2/lang/observer/ObserverTest.java
----------------------------------------------------------------------
diff --git a/observer/src/test/java/net/sf/taverna/t2/lang/observer/ObserverTest.java b/observer/src/test/java/net/sf/taverna/t2/lang/observer/ObserverTest.java
deleted file mode 100644
index 661cbbc..0000000
--- a/observer/src/test/java/net/sf/taverna/t2/lang/observer/ObserverTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.lang.observer;
-
-import static org.junit.Assert.*;
-
-import java.util.List;
-
-import net.sf.taverna.t2.lang.observer.MultiCaster;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-
-import org.junit.Test;
-
-public class ObserverTest {
-
- @Test
- public void registerObserver() throws Exception {
- MyObservable observable = new MyObservable();
- MyObserver observer1 = new MyObserver();
- MyObserver observer2 = new MyObserver();
-
- observable.triggerEvent(); // don't notify, but increase count
- assertNull(observer1.lastMessage);
- observable.addObserver(observer1);
- assertNull(observer1.lastMessage);
- assertNull(observer2.lastMessage);
- assertNull(observer1.lastSender);
- assertNull(observer2.lastSender);
- observable.triggerEvent();
- assertEquals("This is message 1", observer1.lastMessage);
- assertSame(observable, observer1.lastSender);
- assertNull(observer2.lastSender);
-
- observable.addObserver(observer2);
- assertNull(observer2.lastMessage);
- observable.triggerEvent();
- assertEquals("This is message 2", observer1.lastMessage);
- assertEquals("This is message 2", observer2.lastMessage);
- assertSame(observable, observer1.lastSender);
- assertSame(observable, observer2.lastSender);
-
- MyObservable otherObservable = new MyObservable();
- otherObservable.addObserver(observer2);
- otherObservable.triggerEvent();
- // New instance, should start from 0
- assertEquals("This is message 0", observer2.lastMessage);
- assertSame(otherObservable, observer2.lastSender);
-
- // observer1 unchanged
- assertEquals("This is message 2", observer1.lastMessage);
- assertSame(observable, observer1.lastSender);
-
- }
-
- @Test
- public void concurrencyTest() {
- MyObservable observable = new MyObservable();
- MyObserver dummyObserver = new MyObserver();
- SelvRemovingObserver selfRemoving = new SelvRemovingObserver();
- observable.addObserver(dummyObserver);
- observable.addObserver(selfRemoving);
- assertEquals(2, observable.getObservers().size());
- observable.triggerEvent();
-
-
- }
-
- public class MyObservable implements Observable<String> {
-
- private int counter = 0;
- MultiCaster<String> multiCaster = new MultiCaster<String>(this);
-
- public void addObserver(Observer<String> observer) {
- multiCaster.addObserver(observer);
- }
-
- public void removeObserver(Observer<String> observer) {
- multiCaster.removeObserver(observer);
- }
-
- public void triggerEvent() {
- multiCaster.notify("This is message " + counter++);
- }
-
- public List<Observer<String>> getObservers() {
- return multiCaster.getObservers();
- }
- }
-
- public class MyObserver implements Observer<String> {
- String lastMessage = null;
- Observable<String> lastSender = null;
-
- public void notify(Observable<String> sender, String message) {
- lastSender = sender;
- lastMessage = message;
- }
- }
-
- public class SelvRemovingObserver implements Observer<String> {
-
- public int called=0;
-
- public void notify(Observable<String> sender, String message) {
- called++;
- if (called > 1) {
- fail("Did not remove itself");
- }
- sender.removeObserver(this);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/pom.xml
----------------------------------------------------------------------
diff --git a/partition/pom.xml b/partition/pom.xml
deleted file mode 100644
index ba5088a..0000000
--- a/partition/pom.xml
+++ /dev/null
@@ -1,23 +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.t2</groupId>
- <artifactId>lang</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.t2.lang</groupId>
- <artifactId>partition</artifactId>
- <packaging>bundle</packaging>
- <name>Partition</name>
- <description>API for recursive subset partitioning</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/HashSetModel.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/HashSetModel.java b/partition/src/main/java/net/sf/taverna/t2/partition/HashSetModel.java
deleted file mode 100644
index 3a66eb0..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/HashSetModel.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Implementation of SetModel based on a HashSet
- *
- * @author Tom Oinn
- */
-public class HashSetModel<ItemType> extends HashSet<ItemType> implements
- SetModel<ItemType> {
-
- /**
- *
- */
- private static final long serialVersionUID = 5763277571663880941L;
- // Listeners for set change events
- private List<SetModelChangeListener<ItemType>> changeListeners;
-
- /**
- * Default constructor, creates a set model based on a HashSet
- */
- public HashSetModel() {
- super();
- changeListeners = new ArrayList<SetModelChangeListener<ItemType>>();
- }
-
- /**
- * Implements SetModel
- */
- public synchronized void addSetModelChangeListener(
- SetModelChangeListener<ItemType> listener) {
- changeListeners.add(listener);
- }
-
- /**
- * Implements SetModel
- */
- public synchronized void removeSetModelChangeListener(
- SetModelChangeListener<ItemType> listener) {
- changeListeners.remove(listener);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public synchronized void clear() {
- notifyRemoval((Set<Object>) this);
- super.clear();
- }
-
- @Override
- public synchronized boolean add(ItemType item) {
- if (super.add(item)) {
- notifyAddition(Collections.singleton(item));
- return true;
- }
- return false;
- }
-
- @Override
- public synchronized boolean remove(Object item) {
- if (super.remove(item)) {
- notifyRemoval(Collections.singleton(item));
- return true;
- }
- return false;
- }
-
- /**
- * Push addition notification to listeners
- *
- * @param itemsAdded
- */
- private synchronized void notifyAddition(Set<ItemType> itemsAdded) {
- for (SetModelChangeListener<ItemType> listener : new ArrayList<SetModelChangeListener<ItemType>>(
- changeListeners)) {
- listener.itemsWereAdded(itemsAdded);
- }
- }
-
- /**
- * Push removal notification to listeners
- *
- * @param itemsRemoved
- */
- private synchronized void notifyRemoval(Set<Object> itemsRemoved) {
- for (SetModelChangeListener<ItemType> listener : new ArrayList<SetModelChangeListener<ItemType>>(
- changeListeners)) {
- listener.itemsWereRemoved(itemsRemoved);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/Partition.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/Partition.java b/partition/src/main/java/net/sf/taverna/t2/partition/Partition.java
deleted file mode 100644
index e1e5819..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/Partition.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import javax.swing.event.TreeModelEvent;
-import javax.swing.tree.TreePath;
-
-/**
- * A partition represents a set of items which can be exclusively classified
- * into one or more distinct subsets along with the algorithm to perform this
- * subset operation.
- *
- * @author Tom Oinn
- *
- * @param <ItemType>
- * all items in the underlying set of which this is a subset are
- * instances of this type or can be cast to it according to
- * conventional java language rules.
- * @param <PartitionValueType>
- * the partition value type used by the parent partition algorithm to
- * create this partition object. As an example, if this partition
- * object represented all those entries with a particular host
- * institution this would be a String or possibly URL.
- * @param <ChildPartitionValueType>
- * the partition value type used by this partition's partition
- * algorithm to create sub-partitions, it's used in the signature
- * here because ordering of children is done based on these values.
- * Any child partition will have a getPartitionValue return type
- * cast-able to this type.
- */
-public class Partition<ItemType extends Comparable, PartitionValueType, ChildPartitionValueType> {
-
- // A comparator operating over the value type of the child partitions and
- // used to order them as created or to re-order on a change of this property
- private Comparator<ChildPartitionValueType> childPartitionOrder = null;
-
- // Back reference to the root partition of which this is a direct or
- // indirect sub-partition. If this *is* the root partition this points to
- // self
- protected RootPartition<ItemType> root;
-
- // A subset of the parent's member set containing items which have been
- // allocated to this partition by the parent's partition algorithm. The
- // partition is specified by the partitionValue field.
- private List<ItemType> members;
-
- // The parent partition of which this is a subset
- private Partition<ItemType, ?, PartitionValueType> parent;
-
- // Specification of the partition in terms of the parent's partitioning
- // algorithm
- private PartitionValueType partitionValue;
-
- // List of partitioning algorithms to be applied to this subset to create
- // further partitions, the algorithm at index 0 is the one used for this
- // partition, all others are passed in to the constructors for
- // sub-partitions
- protected List<PartitionAlgorithm<?>> partitionAlgorithms;
-
- // An initially empty list of sub-partitions created by the head element of
- // the partition algorithm list
- protected List<Partition<ItemType, ChildPartitionValueType, ?>> children;
-
- // Path from this node back to the root, initialised on first access and
- // cached
- private List<Partition<ItemType, ?, ?>> partitionPath = null;
-
- // For leaf partitions this is equal to the number of items in the member
- // set, for all other partitions it is the sum of the item count of all
- // child partitions
- protected int itemCount = 0;
-
- /**
- * Construct a new Partition, this is used by the RootPartition and by this
- * class to construct the recursively sub-divided partition structure based
- * on the rules encapsulated by the partition algorithm list.
- *
- * @param parent
- * parent partition of which this is a subset
- * @param pa
- * partition algorithm list, with the algorithm used to create
- * child partitions of this one at position 0, if this list is
- * empty this is a leaf partition.
- * @param root
- * reference to the RootPartition acting as the externally
- * visible front-end to this structure
- * @param pv
- * the value which the parent's partition algorithm has assigned
- * to this partition. This must be interpreted in the context of
- * the parent's first partition algorithm for display and other
- * purposes
- */
- protected Partition(Partition<ItemType, ?, PartitionValueType> parent,
- List<PartitionAlgorithm<?>> pa, RootPartition<ItemType> root,
- PartitionValueType pv) {
- this.root = root;
- this.members = new ArrayList<ItemType>();
- this.parent = parent;
- this.partitionValue = pv;
- this.partitionAlgorithms = pa;
- this.children = new ArrayList<Partition<ItemType, ChildPartitionValueType, ?>>();
- }
-
- /**
- * Return the number of items below this node in the partition tree; in the
- * case of leaf partitions this is the number of items in the member set,
- * for non-leaf partitions it is the sum of the item count for all immediate
- * child partitions.
- */
- public int getItemCount() {
- return this.itemCount;
- }
-
- /**
- * Sub-partitions of this partition are ordered based on a comparator over
- * the child partition value type.
- *
- * @return a comparator over child partition value types, or null if no
- * comparator has been specified (by default this returns null)
- */
- public Comparator<ChildPartitionValueType> getChildPartitionOrder() {
- return this.childPartitionOrder;
- }
-
- /**
- * Set a comparator for child partition ordering - if the supplied
- * comparator is different to the current one this will also trigger a
- * re-order of all child partitions and corresponding events in the root
- * partition's tree view. In the current implementation this is the very
- * broad 'tree structure changed' event for this node in the tree view.
- *
- * @param order
- * a new comparator to order child partitions
- */
- public void setChildPartitionOrder(Comparator<ChildPartitionValueType> order) {
- if (!order.equals(childPartitionOrder)) {
- childPartitionOrder = order;
- sortChildPartitions();
- }
- }
-
- /**
- * Return the parent partition of which this is a sub-partition, or null if
- * this is the root partition.
- */
- public Partition<ItemType, ?, PartitionValueType> getParent() {
- return this.parent;
- }
-
- /**
- * The parent partition created this partition based on a particular value
- * of a property of the members of the sub-partition. This returns that
- * value, and is the result returned from the parent partition's first
- * partition algorithm when run on all members of this partition or its
- * direct or indirect sub-partitions.
- */
- public PartitionValueType getPartitionValue() {
- return this.partitionValue;
- }
-
- @Override
- public String toString() {
- if (getParent() != null) {
- // query type
- String string = this.getParent().getPartitionAlgorithms().get(0)
- .toString();
- // result of query
- String string2 = this.partitionValue.toString();
- return string2 + " (" + getItemCount() + ")";
- } else {
- // This is for a root partition, loop through its children to return
- // the correct number when running a new query
- int items = 0;
- for (Partition child : children) {
- items = items + child.getItemCount();
- }
- String queryType = getPartitionAlgorithms().get(0).toString();
- // return "Activities which match query = " + getItemCount();
- return "Available activities (" + items + ")";
- //+ ", query by "
- // + queryType;
- }
- }
-
- /**
- * Return a list of Partition objects from the root (at index 0) to this
- * node at the final position in the list. Computes the first time then
- * caches, as it should be impossible for this to be modified without
- * recreation of the entire structure from scratch.
- */
- public synchronized List<Partition<ItemType, ?, ?>> getPartitionPath() {
- if (partitionPath == null) {
- List<Partition<ItemType, ?, ?>> al = new ArrayList<Partition<ItemType, ?, ?>>();
- Partition<ItemType, ?, ?> activePartition = this;
- al.add(activePartition);
- while (activePartition.getParent() != null) {
- al.add(0, activePartition.getParent());
- activePartition = activePartition.getParent();
- }
- partitionPath = al;
- }
- return partitionPath;
- }
-
- /**
- * If this is a leaf partition, defined as one with an empty list of
- * partition algorithms, then this method returns the set of all items which
- * have been classified as belonging to this leaf partition. For non-leaf
- * partitions it will return an empty set.
- */
- public final List<ItemType> getMembers() {
- return Collections.unmodifiableList(this.members);
- }
-
- /**
- * The list of partition algorithms applicable to this node (at index 0) and
- * subsequent downstream sub-partitions of it. If this is empty then the
- * partition is a leaf partition.
- */
- public final List<PartitionAlgorithm<?>> getPartitionAlgorithms() {
- return Collections.unmodifiableList(partitionAlgorithms);
- }
-
- /**
- * Sub-partitions of this partition defined by the partition algorithm at
- * index 0 of the list. If this is a leaf partition this will always be
- * empty.
- */
- public final List<Partition<ItemType, ChildPartitionValueType, ?>> getChildren() {
- return Collections.unmodifiableList(children);
- }
-
- /**
- * Inject an item into this partition, if there are partition algorithms in
- * the partition algorithm list (i.e. this is not a leaf) this will
- * recursively call the same method on child partitions or create new
- * partitions where there are none that match the value from the partition
- * algorithm. If this is a leaf partition the item is added to the member
- * set. The list is sorted when adding an item and it is inserted in the
- * appropriate place
- *
- * @param item
- * the item to add to the partition structure.
- */
- @SuppressWarnings("unchecked")
- protected synchronized void addItem(ItemType item) {
- if (partitionAlgorithms.isEmpty()) {
- // itemCount = 0;
- // Allocate directly to member set, no further partitioning
- members.add(item);
- Collections.sort(members);
- int indexOf = members.indexOf(item);
- // root.treeNodesInserted(new TreeModelEvent(this, getTreePath(),
- // new int[] { members.size() - 1 }, new Object[] { item }));
- root.treeNodesInserted(new TreeModelEvent(this, getTreePath(),
- new int[] { indexOf }, new Object[] { item }));
- // Increment item count for all partitions in the partition path
- for (Partition<ItemType, ?, ?> p : getPartitionPath()) {
- synchronized (p) {
- p.itemCount++;
- root.treeNodesChanged(new TreeModelEvent(this, p
- .getTreePath()));
- }
- }
-
- // Cache the storage of this item to this partition in the root
- // partition for more efficient removal if required (saves having to
- // search the entire partition tree, although that wouldn't be too
- // painful if it was required this is faster at the cost of a few
- // bytes of memory)
- root.itemStoredAt(item, this);
- // TODO - when the tree model covers items on the leaf nodes we'll
- // want to message it here as well.
- } else {
- PartitionAlgorithm<ChildPartitionValueType> pa;
- pa = (PartitionAlgorithm<ChildPartitionValueType>) partitionAlgorithms
- .get(0);
- ChildPartitionValueType pvalue = pa.allocate(item, root
- .getPropertyExtractorRegistry());
- // FIXME not sure how to do this since you seem to have to add the
- // items to the partition if you want to then search them again,
- // maybe you need a non-showing partition or something?
- // //if it is a failed search then don't bother adding to the
- // partition
- // if (pvalue.toString().equalsIgnoreCase("No match")) {
- // return;
- // }
- // See if there's a partition with this value already in the child
- // partition list
- for (Partition<ItemType, ChildPartitionValueType, ?> potentialChild : children) {
- if (potentialChild.getPartitionValue().equals(pvalue)) {
- potentialChild.addItem(item);
- return;
- }
- }
- // If not we have to create a new sub-partition
- List<PartitionAlgorithm<?>> tail = new ArrayList<PartitionAlgorithm<?>>();
- for (int i = 1; i < partitionAlgorithms.size(); i++) {
- tail.add(partitionAlgorithms.get(i));
- }
- Partition<ItemType, ChildPartitionValueType, ?> newPartition = new Partition(
- this, tail, this.root, pvalue);
- // Insert the new partition in the correct place according to the
- // comparator currently installed, or at the end if none exists or
- // the list is empty
- if (childPartitionOrder == null || children.isEmpty()) {
- children.add(newPartition);
- root.treeNodesInserted(new TreeModelEvent(this, getTreePath(),
- new int[] { children.indexOf(newPartition) },
- new Object[] { newPartition }));
- } else {
- boolean foundIndex = false;
- for (int i = 0; i < children.size(); i++) {
- ChildPartitionValueType existingPartitionValue = children
- .get(i).getPartitionValue();
- if (childPartitionOrder.compare(pvalue,
- existingPartitionValue) < 0) {
- children.add(i, newPartition);
- root.treeNodesInserted(new TreeModelEvent(this,
- getTreePath(), new int[] { i },
- new Object[] { newPartition }));
- if (i != 0) {
- root.treeStructureChanged(new TreeModelEvent(this,
- getTreePath()));
- }
- foundIndex = true;
- break;
- }
- }
- if (!foundIndex) {
- // Fallen off the end of the array without finding something
- // with greater index than the new partition so we add it at
- // the
- // end (by definition this is the largest value according to
- // the
- // comparator)
- children.add(newPartition);
- root.treeNodesInserted(new TreeModelEvent(this,
- getTreePath(), new int[] { children
- .indexOf(newPartition) },
- new Object[] { newPartition }));
- }
- }
- // Add the item to the new partition to trigger creation of any
- // sub-partitions required
- newPartition.addItem(item);
- }
- }
-
- /**
- * Remove an item from the member set
- *
- * @param item
- * the item to remove
- */
- protected void removeMember(ItemType item) {
- this.members.remove(item);
- }
-
- /**
- * Re-order the child partitions based on the comparator, if no comparator
- * has been defined this method does nothing. Tree structure changed
- * messages are fired from this node in the tree view if the comparator is
- * defined even if no nodes have been changed (lazy but not too much of an
- * issue I suspect)
- */
- protected synchronized final void sortChildPartitions() {
- if (this.childPartitionOrder == null) {
- // Can't do anything unless the comparator is set appropriately
- return;
- }
- Comparator<Partition<ItemType, ChildPartitionValueType, ?>> comparator = new Comparator<Partition<ItemType, ChildPartitionValueType, ?>>() {
- public int compare(
- Partition<ItemType, ChildPartitionValueType, ?> o1,
- Partition<ItemType, ChildPartitionValueType, ?> o2) {
- // FIXME is this really safe to do? It's fairly specific to our
- // case. Doesn't seem very generic
- if (o1.getPartitionValue().toString().equalsIgnoreCase(
- "no value")) {
- // No value so put it to the end
- return 1;
- }
- return childPartitionOrder.compare(o1.getPartitionValue(), o2
- .getPartitionValue());
- }
- };
- Collections.<Partition<ItemType, ChildPartitionValueType, ?>> sort(
- children, comparator);
- // Message the root that the node structure under this node has changed
- // (this is a bit lazy and we could almost certainly be more clever here
- // as the nodes have been removed and added to re-order them)
- root.treeStructureChanged(new TreeModelEvent(this, getTreePath()));
- }
-
- /**
- * Return a TreePath object with this node as the final entry in the path
- */
- protected final synchronized TreePath getTreePath() {
- return new TreePath(getPartitionPath().toArray());
- }
-
- // public void sortItems() {
- // System.out.println("sorting the items");
- // synchronized (members) {
- // List<ItemType> oldOrder = new ArrayList<ItemType>(members);
- // Collections.sort(oldOrder);
- //
- // for (ItemType item : oldOrder) {
- // removeMember(item);
- // }
- // for (ItemType item : oldOrder) {
- // addItem(item);
- // }
- // }
- //
- // }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithm.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithm.java b/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithm.java
deleted file mode 100644
index b7b80f6..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithm.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-/**
- * Interface for classes which can partition a set of objects into subsets according
- * to some embedded partitioning rule
- *
- * @author Tom Oinn
- * @author Stuart Owen
- *
- * @param ValueType
- * the java type of values used to represent the distinct partitions
- * created by this algorithm, in many cases these will be primitive
- * java types such as String but they could represent ranges of
- * values in the case of binning of continuous quantities etc.
- */
-public interface PartitionAlgorithm<ValueType> {
-
- /**
- * Given an object to classify return the value of the partition into which
- * the object falls.
- *
- * @param newItem
- * @return
- */
- ValueType allocate(Object newItem, PropertyExtractorRegistry reg);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithmSetSPI.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithmSetSPI.java b/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithmSetSPI.java
deleted file mode 100644
index 330a11a..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/PartitionAlgorithmSetSPI.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-import java.util.Set;
-
-/**
- * An SPI interface that provides access to a Set of partition algorithms.
- *
- * @author Stuart Owen
- *
- */
-public interface PartitionAlgorithmSetSPI {
- /**
- * @return a Set of PartitionAlgorithms
- */
- public Set<PartitionAlgorithm<?>> getPartitionAlgorithms();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorRegistry.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorRegistry.java b/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorRegistry.java
deleted file mode 100644
index 229aa87..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorRegistry.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-import java.util.Map;
-
-/**
- * Convenience to allow caching of property extractors. Implementations should
- * scan for available PropertyExtractorSPI implementations and use these to get
- * the properties for each target, caching as applicable.
- *
- * @author Tom Oinn
- *
- */
-public interface PropertyExtractorRegistry {
-
- public Map<String, Object> getAllPropertiesFor(Object target);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorSPI.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorSPI.java b/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorSPI.java
deleted file mode 100644
index 130f2b7..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/PropertyExtractorSPI.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-import java.util.Map;
-
-/**
- * SPI for classes which can extract or infer a set of named properties from a
- * target object.
- *
- * @author Tom Oinn
- *
- */
-public interface PropertyExtractorSPI {
-
- /**
- * Given a target object extract or infer the property map from it. If the
- * target is one which this plugin cannot act on then simply return an empty
- * map.
- *
- * @param target
- * @return
- */
- Map<String, Object> extractProperties(Object target);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/f676ef35/partition/src/main/java/net/sf/taverna/t2/partition/Query.java
----------------------------------------------------------------------
diff --git a/partition/src/main/java/net/sf/taverna/t2/partition/Query.java b/partition/src/main/java/net/sf/taverna/t2/partition/Query.java
deleted file mode 100644
index c8f3cb6..0000000
--- a/partition/src/main/java/net/sf/taverna/t2/partition/Query.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.partition;
-
-import java.util.Date;
-
-/**
- * Defines a query which can be re-run and which presents a set view on its
- * results. The Query is intended to represent both the old Taverna scavenger
- * class (which were queries in all but name) and new integration with external
- * search-able repositories in which case the term 'query' is a more literal
- * description.
- *
- * @author Tom Oinn
- *
- * @param <ItemType>
- * the parameterised type of the result set of the query
- */
-public interface Query<ItemType> extends SetModel<ItemType> {
-
- /**
- * Run the query. The query has internal state from any previous runs
- * (including the initial empty state) and will notify all listeners from
- * the SetModel interface of any items that are present in the new query
- * result and not in the old state or vice versa. It also updates the query
- * time to be the current time.
- */
- public void doQuery();
-
- /**
- * Returns the time at which the query was last invoked, or null if the
- * query has not been invoked yet.
- *
- * @return time of last call to doQuery or null if this hasn't happened yet.
- */
- public Date getLastQueryTime();
-
-}