http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java deleted file mode 100644 index c92c4e8..0000000 --- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2011 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.workbench.activityicons; - -import java.net.URI; - -import javax.swing.Icon; - -import org.apache.taverna.scufl2.api.activity.Activity; - -/** - * Manager for activities' icons. - * - * @author David Withers - */ -public interface ActivityIconManager { - /** Returns an icon for the Activity. */ - Icon iconForActivity(URI activityType); - - Icon iconForActivity(Activity activity); - - void resetIcon(URI activityType); -}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java deleted file mode 100644 index 7270dfc..0000000 --- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.workbench.activityicons; - -import java.net.URI; - -import javax.swing.Icon; - -/** - * Defines an interface for getting an icon for an Activity. - * - * @author Alex Nenadic - */ -public interface ActivityIconSPI { - /** - * A return value for {@link canProvideIconScore()} indicating an SPI cannot - * provide an icon for a given activity. - */ - int NO_ICON = 0; - - /** - * {@link DefaultActivityIcon} returns this value that will be used when an - * activity that has no other SPI providing an icon for. Any SPI shour - * return value of at least DEFAULT_ICON + 1 if they want to 'override' the - * default icon. - */ - int DEFAULT_ICON = 10; - - /** - * Returns a positive number if the class can provide an icon for the given - * activity or {@link NO_ICON} otherwise. Out of two SPIs capable of - * providing an icon for the same activity, the one returning a higher score - * will be used. - */ - int canProvideIconScore(URI activityType); - - /** Returns an icon for the Activity. */ - Icon getIcon(URI activityType); -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java deleted file mode 100644 index c474e69..0000000 --- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.workbench.activityicons; - -import java.net.URI; - -import javax.swing.Icon; -import javax.swing.ImageIcon; - -public class DefaultActivityIcon implements ActivityIconSPI { - private static final String ICON_RESOURCE = "/default-activity-icon.png"; - - @Override - public int canProvideIconScore(URI activityType) { - // For any activity we can provide a default icon - return DEFAULT_ICON; - } - - @Override - public Icon getIcon(URI activityType) { - return getDefaultIcon(); - } - - public static Icon getDefaultIcon() { - return IconLoader.icon; - } - - private static class IconLoader { - static final Icon icon = loadDefaultIcon(); - - private static Icon loadDefaultIcon() { - return new ImageIcon( - DefaultActivityIcon.class.getResource(ICON_RESOURCE)); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java deleted file mode 100644 index 762de69..0000000 --- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.workbench.activityicons.impl; - -import static net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI.NO_ICON; - -import java.net.URI; -import java.util.List; -import java.util.WeakHashMap; - -import javax.swing.Icon; - -import org.apache.taverna.scufl2.api.activity.Activity; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI; - -/** - * Manager for activities' icons. - * - * @author Alex Nenadic - * @author Alan R Williams - */ -public class ActivityIconManagerImpl implements ActivityIconManager { - /** Cache of already obtained icons; maps activities to their icons*/ - private WeakHashMap<URI, Icon> iconsMap = new WeakHashMap<>(); - - private List<ActivityIconSPI> activityIcons; - - /** Returns an icon for the Activity. */ - @Override - public Icon iconForActivity(URI activityType) { - Icon icon = iconsMap.get(activityType); - if (icon != null) - return icon; - int bestScore = NO_ICON; - ActivityIconSPI bestSPI = null; - for (ActivityIconSPI spi : activityIcons) { - int spiScore = spi.canProvideIconScore(activityType); - if (spiScore > bestScore) { - bestSPI = spi; - bestScore = spiScore; - } - } - if (bestSPI == null) - return null; - icon = bestSPI.getIcon(activityType); - iconsMap.put(activityType, icon); - return icon; - } - - @Override - public Icon iconForActivity(Activity activity) { - return iconForActivity(activity.getType()); - } - - @Override - public void resetIcon(URI activityType) { - Icon icon = iconsMap.get(activityType); - if (icon != null) - iconsMap.remove(activityType); - iconForActivity(activityType); - } - - public void setActivityIcons(List<ActivityIconSPI> activityIcons) { - this.activityIcons = activityIcons; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java new file mode 100644 index 0000000..9a80fd3 --- /dev/null +++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java @@ -0,0 +1,40 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.workbench.activityicons; + +import java.net.URI; + +import javax.swing.Icon; + +import org.apache.taverna.scufl2.api.activity.Activity; + +/** + * Manager for activities' icons. + * + * @author David Withers + */ +public interface ActivityIconManager { + /** Returns an icon for the Activity. */ + Icon iconForActivity(URI activityType); + + Icon iconForActivity(Activity activity); + + void resetIcon(URI activityType); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java new file mode 100644 index 0000000..59c6da0 --- /dev/null +++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java @@ -0,0 +1,56 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.workbench.activityicons; + +import java.net.URI; + +import javax.swing.Icon; + +/** + * Defines an interface for getting an icon for an Activity. + * + * @author Alex Nenadic + */ +public interface ActivityIconSPI { + /** + * A return value for {@link canProvideIconScore()} indicating an SPI cannot + * provide an icon for a given activity. + */ + int NO_ICON = 0; + + /** + * {@link DefaultActivityIcon} returns this value that will be used when an + * activity that has no other SPI providing an icon for. Any SPI shour + * return value of at least DEFAULT_ICON + 1 if they want to 'override' the + * default icon. + */ + int DEFAULT_ICON = 10; + + /** + * Returns a positive number if the class can provide an icon for the given + * activity or {@link NO_ICON} otherwise. Out of two SPIs capable of + * providing an icon for the same activity, the one returning a higher score + * will be used. + */ + int canProvideIconScore(URI activityType); + + /** Returns an icon for the Activity. */ + Icon getIcon(URI activityType); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java new file mode 100644 index 0000000..f061ded --- /dev/null +++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java @@ -0,0 +1,53 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.workbench.activityicons; + +import java.net.URI; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +public class DefaultActivityIcon implements ActivityIconSPI { + private static final String ICON_RESOURCE = "/default-activity-icon.png"; + + @Override + public int canProvideIconScore(URI activityType) { + // For any activity we can provide a default icon + return DEFAULT_ICON; + } + + @Override + public Icon getIcon(URI activityType) { + return getDefaultIcon(); + } + + public static Icon getDefaultIcon() { + return IconLoader.icon; + } + + private static class IconLoader { + static final Icon icon = loadDefaultIcon(); + + private static Icon loadDefaultIcon() { + return new ImageIcon( + DefaultActivityIcon.class.getResource(ICON_RESOURCE)); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java new file mode 100644 index 0000000..61dd6e4 --- /dev/null +++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java @@ -0,0 +1,84 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.workbench.activityicons.impl; + +import static org.apache.taverna.workbench.activityicons.ActivityIconSPI.NO_ICON; + +import java.net.URI; +import java.util.List; +import java.util.WeakHashMap; + +import javax.swing.Icon; + +import org.apache.taverna.scufl2.api.activity.Activity; +import org.apache.taverna.workbench.activityicons.ActivityIconManager; +import org.apache.taverna.workbench.activityicons.ActivityIconSPI; + +/** + * Manager for activities' icons. + * + * @author Alex Nenadic + * @author Alan R Williams + */ +public class ActivityIconManagerImpl implements ActivityIconManager { + /** Cache of already obtained icons; maps activities to their icons*/ + private WeakHashMap<URI, Icon> iconsMap = new WeakHashMap<>(); + + private List<ActivityIconSPI> activityIcons; + + /** Returns an icon for the Activity. */ + @Override + public Icon iconForActivity(URI activityType) { + Icon icon = iconsMap.get(activityType); + if (icon != null) + return icon; + int bestScore = NO_ICON; + ActivityIconSPI bestSPI = null; + for (ActivityIconSPI spi : activityIcons) { + int spiScore = spi.canProvideIconScore(activityType); + if (spiScore > bestScore) { + bestSPI = spi; + bestScore = spiScore; + } + } + if (bestSPI == null) + return null; + icon = bestSPI.getIcon(activityType); + iconsMap.put(activityType, icon); + return icon; + } + + @Override + public Icon iconForActivity(Activity activity) { + return iconForActivity(activity.getType()); + } + + @Override + public void resetIcon(URI activityType) { + Icon icon = iconsMap.get(activityType); + if (icon != null) + iconsMap.remove(activityType); + iconForActivity(activityType); + } + + public void setActivityIcons(List<ActivityIconSPI> activityIcons) { + this.activityIcons = activityIcons; + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI deleted file mode 100644 index d268c81..0000000 --- a/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.workbench.activityicons.DefaultActivityIcon \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI new file mode 100644 index 0000000..5510f07 --- /dev/null +++ b/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI @@ -0,0 +1 @@ +org.apache.taverna.workbench.activityicons.DefaultActivityIcon \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml index 5c67640..e0e24ef 100644 --- a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml +++ b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml @@ -6,10 +6,10 @@ http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> - <service ref="DefaultActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" /> + <service ref="DefaultActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" /> - <service ref="ActivityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" /> + <service ref="ActivityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" /> - <list id="activityIcons" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" cardinality="0..N" /> + <list id="activityIcons" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" cardinality="0..N" /> </beans:beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml ---------------------------------------------------------------------- diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml index 93c98c4..8ff584d 100644 --- a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml +++ b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="DefaultActivityIcon" class="net.sf.taverna.t2.workbench.activityicons.DefaultActivityIcon" /> + <bean id="DefaultActivityIcon" class="org.apache.taverna.workbench.activityicons.DefaultActivityIcon" /> - <bean id="ActivityIconManager" class="net.sf.taverna.t2.workbench.activityicons.impl.ActivityIconManagerImpl"> + <bean id="ActivityIconManager" class="org.apache.taverna.workbench.activityicons.impl.ActivityIconManagerImpl"> <property name="activityIcons" ref="activityIcons" /> </bean> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java deleted file mode 100644 index e3c4c54..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import org.apache.taverna.scufl2.api.configurations.Configuration; - -public abstract class AbstractConfigurableServiceProvider extends - IdentifiedObject implements ConfigurableServiceProvider { - protected Configuration serviceProviderConfig; - - /** - * Construct configurable service provider. - * - * @param configTemplate - * Template configuration - */ - public AbstractConfigurableServiceProvider(Configuration configTemplate) { - if (configTemplate == null) - throw new NullPointerException("Default config can't be null"); - serviceProviderConfig = configTemplate; - } - - /** - * Package access constructor - only used with {@link #clone()} - otherwise - * use {@link #AbstractConfigurableServiceProvider(Object)} - */ - AbstractConfigurableServiceProvider() { - } - - @Override - public AbstractConfigurableServiceProvider clone() { - AbstractConfigurableServiceProvider provider = (AbstractConfigurableServiceProvider) newInstance(); - Configuration configuration = getConfiguration(); - if (configuration != null) - provider.configure(configuration); - return provider; - } - - @Override - public synchronized void configure(Configuration conf) { - if (conf == null) - throw new IllegalArgumentException("Config can't be null"); - this.serviceProviderConfig = conf; - } - - @Override - public Configuration getConfiguration() { - return serviceProviderConfig; - } - - @Override - public String toString() { - return getName() + " " + getConfiguration(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java deleted file mode 100644 index b5b2a7c..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java +++ /dev/null @@ -1,85 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import static java.util.Collections.singleton; - -import java.net.URI; -import java.util.Arrays; -import java.util.List; - -import javax.swing.Icon; - -import org.apache.taverna.scufl2.api.configurations.Configuration; - -public abstract class AbstractTemplateService implements - ServiceDescriptionProvider { - protected TemplateServiceDescription templateService = new TemplateServiceDescription(); - - @Override - public void findServiceDescriptionsAsync( - FindServiceDescriptionsCallBack callBack) { - callBack.partialResults(singleton(templateService)); - callBack.finished(); - } - - @Override - public abstract Icon getIcon(); - - public URI getActivityType() { - return null; - } - - public abstract Configuration getActivityConfiguration(); - - public class TemplateServiceDescription extends ServiceDescription { - @Override - public Icon getIcon() { - return AbstractTemplateService.this.getIcon(); - } - - @Override - public String getName() { - return AbstractTemplateService.this.getName(); - } - - @Override - public List<String> getPath() { - return Arrays.asList(SERVICE_TEMPLATES); - } - - @Override - public boolean isTemplateService() { - return true; - } - - @Override - protected List<Object> getIdentifyingData() { - // Do it by object identity - return null; - } - - @Override - public URI getActivityType() { - return AbstractTemplateService.this.getActivityType(); - } - - @Override - public Configuration getActivityConfiguration() { - return AbstractTemplateService.this.getActivityConfiguration(); - } - - @Override - public String getDescription() { - return AbstractTemplateService.this.getDescription(); - } - } - - @Override - public String toString() { - return "Template service " + getName(); - } - - public String getDescription() { - // Default to an empty string - return ""; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java deleted file mode 100644 index d16afaa..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import org.apache.taverna.scufl2.api.common.Configurable; -import org.apache.taverna.scufl2.api.configurations.Configuration; - -public interface ConfigurableServiceProvider extends - ServiceDescriptionProvider, Configurable, Cloneable { - void configure(Configuration configuration) throws Exception; - Configuration getConfiguration(); -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java deleted file mode 100644 index f6bdd4a..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.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.servicedescriptions; - -import org.apache.taverna.scufl2.api.configurations.Configuration; - -public interface CustomizedConfigurePanelProvider extends - ConfigurableServiceProvider { - void createCustomizedConfigurePanel(CustomizedConfigureCallBack callBack); - - interface CustomizedConfigureCallBack { - void newProviderConfiguration(Configuration providerConfig); - - Configuration getTemplateConfig(); - - ServiceDescriptionRegistry getServiceDescriptionRegistry(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java deleted file mode 100644 index 596f502..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import java.util.List; - -import net.sf.taverna.t2.lang.beans.PropertyAnnotated; - -public abstract class IdentifiedObject extends PropertyAnnotated { - @Override - public boolean equals(Object obj) { - if (!(obj instanceof IdentifiedObject)) - return false; - List<? extends Object> myIdentifyingData = getIdentifyingData(); - if (myIdentifyingData == null) - return super.equals(obj); - if (!getClass().isInstance(obj) && obj.getClass().isInstance(this)) - return false; - IdentifiedObject id = (IdentifiedObject) obj; - return myIdentifyingData.equals(id.getIdentifyingData()); - } - - @Override - public int hashCode() { - List<? extends Object> identifyingData = getIdentifyingData(); - if (identifyingData == null) - return super.hashCode(); - return identifyingData.hashCode(); - } - - protected abstract List<? extends Object> getIdentifyingData(); -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java deleted file mode 100644 index 72e1b2e..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import java.net.URI; -import java.util.List; - -import javax.swing.Icon; - -import net.sf.taverna.t2.lang.beans.PropertyAnnotation; -import net.sf.taverna.t2.workbench.edits.Edit; -import org.apache.taverna.scufl2.api.activity.Activity; -import org.apache.taverna.scufl2.api.configurations.Configuration; -import org.apache.taverna.scufl2.api.core.Processor; -import org.apache.taverna.scufl2.api.core.Workflow; - -public abstract class ServiceDescription extends IdentifiedObject { - public static final String SERVICE_TEMPLATES = "Service templates"; - private static final String NAME = "Name"; - private static final String SERVICE_CONFIGURATION = "Service configuration"; - private static final String SERVICE_IMPLEMENTATION_URI = "Service implementation URI"; - private static final String DESCRIPTION = "Description"; - public static final String LOCAL_SERVICES = "Local services"; - - private String description = ""; - - @PropertyAnnotation(expert = true, displayName = SERVICE_IMPLEMENTATION_URI) - public abstract URI getActivityType(); - - @PropertyAnnotation(expert = true, displayName = SERVICE_CONFIGURATION) - public Configuration getActivityConfiguration() { - Configuration configuration = new Configuration(); - configuration.setType(getActivityType().resolve("#Config")); - return configuration; - } - - @PropertyAnnotation(displayName = DESCRIPTION) - public String getDescription() { - return this.description; - } - - @PropertyAnnotation(expert = true) - public abstract Icon getIcon(); - - @PropertyAnnotation(displayName = NAME) - public abstract String getName(); - - @PropertyAnnotation(expert = true) - public abstract List<? extends Comparable<?>> getPath(); - - @PropertyAnnotation(hidden = true) - public boolean isTemplateService() { - return false; - } - - /** - * @param description - * the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - @Override - public String toString() { - return "Service description " + getName(); - } - - /** - * Any additional edit that needs to be performed upon insertion of an - * instance of the ServiceDescription into the {@link Workflow} within the - * specified {@link Processor} - * - * @param dataflow - * @param p - * @param a - * @return - */ - public Edit<?> getInsertionEdit(Workflow dataflow, Processor p, Activity a) { - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java deleted file mode 100644 index 8170819..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import java.util.Collection; - -import javax.swing.Icon; - -import net.sf.taverna.t2.lang.beans.PropertyAnnotation; - -/** - * A provider of service descriptions - * - * @author Stian Soiland-Reyes - */ -public interface ServiceDescriptionProvider { - /** - * Get all service descriptions. - * - * @param callBack - */ - void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack); - - /** - * @author stain - */ - interface FindServiceDescriptionsCallBack { - void partialResults( - Collection<? extends ServiceDescription> serviceDescriptions); - - void status(String message); - - void warning(String message); - - void finished(); - - void fail(String message, Throwable ex); - } - - /** - * Name of this service description provider, for instance "BioCatalogue" or - * "WSDL". This name is typically used in a "Add service..." menu. - * - * @return Name of provider - */ - String getName(); - - @PropertyAnnotation(expert = true) - abstract Icon getIcon(); - - /** - * @return unique id of this provider. - */ - String getId(); - - /** - * Create a new copy of this service provider. It <i>need not be - * configured</i> at the point where it is returned. - * - * @return The copy. - */ - ServiceDescriptionProvider newInstance(); -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java deleted file mode 100644 index c44b541..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions; - -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.util.List; -import java.util.Set; - -import org.apache.taverna.lang.observer.Observable; -import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionRegistryEvent; - -public interface ServiceDescriptionRegistry extends - Observable<ServiceDescriptionRegistryEvent> { - void addServiceDescriptionProvider(ServiceDescriptionProvider provider); - - Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProviders(); - - Set<ServiceDescriptionProvider> getServiceDescriptionProviders(); - - Set<ServiceDescriptionProvider> getServiceDescriptionProviders( - ServiceDescription sd); - - Set<ServiceDescription> getServiceDescriptions(); - - ServiceDescription getServiceDescription(URI activityType); - - List<ConfigurableServiceProvider> getUnconfiguredServiceProviders(); - - Set<ServiceDescriptionProvider> getUserAddedServiceProviders(); - - Set<ServiceDescriptionProvider> getUserRemovedServiceProviders(); - - void loadServiceProviders(); - - void loadServiceProviders(File serviceProvidersURL); - - void loadServiceProviders(URL serviceProvidersURL); - - void refresh(); - - void removeServiceDescriptionProvider(ServiceDescriptionProvider provider); - - void saveServiceDescriptions(); - - void saveServiceDescriptions(File serviceDescriptionsFile); - - void exportCurrentServiceDescriptions(File serviceDescriptionsFile); - - boolean isDefaultSystemConfigurableProvidersLoaded(); -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java deleted file mode 100644 index 7fbcbfc..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java +++ /dev/null @@ -1,36 +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.servicedescriptions; - -import uk.org.taverna.configuration.Configurable; - -/** - * @author David Withers - */ -public interface ServiceDescriptionsConfiguration extends Configurable { - public boolean isIncludeDefaults(); - - public void setIncludeDefaults(boolean includeDefaults); - - public boolean isRemovePermanently(); - - public void setRemovePermanently(boolean removePermanently); -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java deleted file mode 100644 index 1fd224e..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public abstract class AbstractProviderEvent extends - ServiceDescriptionRegistryEvent { - private final ServiceDescriptionProvider provider; - - public AbstractProviderEvent(ServiceDescriptionProvider provider) { - this.provider = provider; - } - - public ServiceDescriptionProvider getProvider() { - return provider; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java deleted file mode 100644 index 2cabf90..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class AbstractProviderNotification extends AbstractProviderEvent { - - private final String message; - - public AbstractProviderNotification(ServiceDescriptionProvider provider, String message) { - super(provider); - this.message = message; - } - - public String getMessage() { - return message; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java deleted file mode 100644 index 6e003d7..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class AddedProviderEvent extends AbstractProviderEvent { - - public AddedProviderEvent(ServiceDescriptionProvider provider) { - super(provider); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java deleted file mode 100644 index 3bd8c7f..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import java.util.Collection; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescription; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class PartialServiceDescriptionsNotification extends - AbstractProviderNotification { - private final Collection<? extends ServiceDescription> serviceDescriptions; - - public PartialServiceDescriptionsNotification( - ServiceDescriptionProvider provider, - Collection<? extends ServiceDescription> serviceDescriptions) { - super(provider, "Found " + serviceDescriptions.size() + " services"); - this.serviceDescriptions = serviceDescriptions; - } - - public Collection<? extends ServiceDescription> getServiceDescriptions() { - return serviceDescriptions; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java deleted file mode 100644 index a712124..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class ProviderErrorNotification extends AbstractProviderNotification { - - private final Throwable cause; - - public ProviderErrorNotification(ServiceDescriptionProvider provider, - String message, Throwable cause) { - super(provider, message); - this.cause = cause; - } - - public Throwable getCause() { - return cause; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java deleted file mode 100644 index f094e47..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class ProviderStatusNotification extends AbstractProviderNotification { - - public ProviderStatusNotification(ServiceDescriptionProvider provider, - String message) { - super(provider, message); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java deleted file mode 100644 index e2947e1..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class ProviderUpdatingNotification extends AbstractProviderNotification { - - public ProviderUpdatingNotification(ServiceDescriptionProvider provider) { - super(provider, "Updating"); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java deleted file mode 100644 index d7476aa..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class ProviderWarningNotification extends AbstractProviderNotification { - - public ProviderWarningNotification(ServiceDescriptionProvider provider, - String message) { - super(provider, message); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java deleted file mode 100644 index a382bdf..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class RemovedProviderEvent extends AbstractProviderEvent { - - public RemovedProviderEvent(ServiceDescriptionProvider provider) { - super(provider); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java deleted file mode 100644 index 76ef22d..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -import java.util.Set; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescription; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -public class ServiceDescriptionProvidedEvent extends AbstractProviderEvent { - private final Set<ServiceDescription> serviceDescriptions; - - public ServiceDescriptionProvidedEvent(ServiceDescriptionProvider provider, - Set<ServiceDescription> serviceDescriptions) { - super(provider); - this.serviceDescriptions = serviceDescriptions; - } - - public Set<ServiceDescription> getServiceDescriptions() { - return serviceDescriptions; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java deleted file mode 100644 index 0604510..0000000 --- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.sf.taverna.t2.servicedescriptions.events; - -public abstract class ServiceDescriptionRegistryEvent { -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java new file mode 100644 index 0000000..31fd372 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java @@ -0,0 +1,72 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import org.apache.taverna.scufl2.api.configurations.Configuration; + +public abstract class AbstractConfigurableServiceProvider extends + IdentifiedObject implements ConfigurableServiceProvider { + protected Configuration serviceProviderConfig; + + /** + * Construct configurable service provider. + * + * @param configTemplate + * Template configuration + */ + public AbstractConfigurableServiceProvider(Configuration configTemplate) { + if (configTemplate == null) + throw new NullPointerException("Default config can't be null"); + serviceProviderConfig = configTemplate; + } + + /** + * Package access constructor - only used with {@link #clone()} - otherwise + * use {@link #AbstractConfigurableServiceProvider(Object)} + */ + AbstractConfigurableServiceProvider() { + } + + @Override + public AbstractConfigurableServiceProvider clone() { + AbstractConfigurableServiceProvider provider = (AbstractConfigurableServiceProvider) newInstance(); + Configuration configuration = getConfiguration(); + if (configuration != null) + provider.configure(configuration); + return provider; + } + + @Override + public synchronized void configure(Configuration conf) { + if (conf == null) + throw new IllegalArgumentException("Config can't be null"); + this.serviceProviderConfig = conf; + } + + @Override + public Configuration getConfiguration() { + return serviceProviderConfig; + } + + @Override + public String toString() { + return getName() + " " + getConfiguration(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java new file mode 100644 index 0000000..d42a72f --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java @@ -0,0 +1,104 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import static java.util.Collections.singleton; + +import java.net.URI; +import java.util.Arrays; +import java.util.List; + +import javax.swing.Icon; + +import org.apache.taverna.scufl2.api.configurations.Configuration; + +public abstract class AbstractTemplateService implements + ServiceDescriptionProvider { + protected TemplateServiceDescription templateService = new TemplateServiceDescription(); + + @Override + public void findServiceDescriptionsAsync( + FindServiceDescriptionsCallBack callBack) { + callBack.partialResults(singleton(templateService)); + callBack.finished(); + } + + @Override + public abstract Icon getIcon(); + + public URI getActivityType() { + return null; + } + + public abstract Configuration getActivityConfiguration(); + + public class TemplateServiceDescription extends ServiceDescription { + @Override + public Icon getIcon() { + return AbstractTemplateService.this.getIcon(); + } + + @Override + public String getName() { + return AbstractTemplateService.this.getName(); + } + + @Override + public List<String> getPath() { + return Arrays.asList(SERVICE_TEMPLATES); + } + + @Override + public boolean isTemplateService() { + return true; + } + + @Override + protected List<Object> getIdentifyingData() { + // Do it by object identity + return null; + } + + @Override + public URI getActivityType() { + return AbstractTemplateService.this.getActivityType(); + } + + @Override + public Configuration getActivityConfiguration() { + return AbstractTemplateService.this.getActivityConfiguration(); + } + + @Override + public String getDescription() { + return AbstractTemplateService.this.getDescription(); + } + } + + @Override + public String toString() { + return "Template service " + getName(); + } + + public String getDescription() { + // Default to an empty string + return ""; + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java new file mode 100644 index 0000000..9f8e85a --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java @@ -0,0 +1,29 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import org.apache.taverna.scufl2.api.common.Configurable; +import org.apache.taverna.scufl2.api.configurations.Configuration; + +public interface ConfigurableServiceProvider extends + ServiceDescriptionProvider, Configurable, Cloneable { + void configure(Configuration configuration) throws Exception; + Configuration getConfiguration(); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java new file mode 100644 index 0000000..8c9ddb6 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java @@ -0,0 +1,35 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import org.apache.taverna.scufl2.api.configurations.Configuration; + +public interface CustomizedConfigurePanelProvider extends + ConfigurableServiceProvider { + void createCustomizedConfigurePanel(CustomizedConfigureCallBack callBack); + + interface CustomizedConfigureCallBack { + void newProviderConfiguration(Configuration providerConfig); + + Configuration getTemplateConfig(); + + ServiceDescriptionRegistry getServiceDescriptionRegistry(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java new file mode 100644 index 0000000..1d97dce --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java @@ -0,0 +1,49 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import java.util.List; + +import org.apache.taverna.lang.beans.PropertyAnnotated; + +public abstract class IdentifiedObject extends PropertyAnnotated { + @Override + public boolean equals(Object obj) { + if (!(obj instanceof IdentifiedObject)) + return false; + List<? extends Object> myIdentifyingData = getIdentifyingData(); + if (myIdentifyingData == null) + return super.equals(obj); + if (!getClass().isInstance(obj) && obj.getClass().isInstance(this)) + return false; + IdentifiedObject id = (IdentifiedObject) obj; + return myIdentifyingData.equals(id.getIdentifyingData()); + } + + @Override + public int hashCode() { + List<? extends Object> identifyingData = getIdentifyingData(); + if (identifyingData == null) + return super.hashCode(); + return identifyingData.hashCode(); + } + + protected abstract List<? extends Object> getIdentifyingData(); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java new file mode 100644 index 0000000..dda5fc6 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java @@ -0,0 +1,99 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import java.net.URI; +import java.util.List; + +import javax.swing.Icon; + +import org.apache.taverna.lang.beans.PropertyAnnotation; +import org.apache.taverna.workbench.edits.Edit; +import org.apache.taverna.scufl2.api.activity.Activity; +import org.apache.taverna.scufl2.api.configurations.Configuration; +import org.apache.taverna.scufl2.api.core.Processor; +import org.apache.taverna.scufl2.api.core.Workflow; + +public abstract class ServiceDescription extends IdentifiedObject { + public static final String SERVICE_TEMPLATES = "Service templates"; + private static final String NAME = "Name"; + private static final String SERVICE_CONFIGURATION = "Service configuration"; + private static final String SERVICE_IMPLEMENTATION_URI = "Service implementation URI"; + private static final String DESCRIPTION = "Description"; + public static final String LOCAL_SERVICES = "Local services"; + + private String description = ""; + + @PropertyAnnotation(expert = true, displayName = SERVICE_IMPLEMENTATION_URI) + public abstract URI getActivityType(); + + @PropertyAnnotation(expert = true, displayName = SERVICE_CONFIGURATION) + public Configuration getActivityConfiguration() { + Configuration configuration = new Configuration(); + configuration.setType(getActivityType().resolve("#Config")); + return configuration; + } + + @PropertyAnnotation(displayName = DESCRIPTION) + public String getDescription() { + return this.description; + } + + @PropertyAnnotation(expert = true) + public abstract Icon getIcon(); + + @PropertyAnnotation(displayName = NAME) + public abstract String getName(); + + @PropertyAnnotation(expert = true) + public abstract List<? extends Comparable<?>> getPath(); + + @PropertyAnnotation(hidden = true) + public boolean isTemplateService() { + return false; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "Service description " + getName(); + } + + /** + * Any additional edit that needs to be performed upon insertion of an + * instance of the ServiceDescription into the {@link Workflow} within the + * specified {@link Processor} + * + * @param dataflow + * @param p + * @param a + * @return + */ + public Edit<?> getInsertionEdit(Workflow dataflow, Processor p, Activity a) { + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java new file mode 100644 index 0000000..582de92 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java @@ -0,0 +1,80 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import java.util.Collection; + +import javax.swing.Icon; + +import org.apache.taverna.lang.beans.PropertyAnnotation; + +/** + * A provider of service descriptions + * + * @author Stian Soiland-Reyes + */ +public interface ServiceDescriptionProvider { + /** + * Get all service descriptions. + * + * @param callBack + */ + void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack); + + /** + * @author stain + */ + interface FindServiceDescriptionsCallBack { + void partialResults( + Collection<? extends ServiceDescription> serviceDescriptions); + + void status(String message); + + void warning(String message); + + void finished(); + + void fail(String message, Throwable ex); + } + + /** + * Name of this service description provider, for instance "BioCatalogue" or + * "WSDL". This name is typically used in a "Add service..." menu. + * + * @return Name of provider + */ + String getName(); + + @PropertyAnnotation(expert = true) + abstract Icon getIcon(); + + /** + * @return unique id of this provider. + */ + String getId(); + + /** + * Create a new copy of this service provider. It <i>need not be + * configured</i> at the point where it is returned. + * + * @return The copy. + */ + ServiceDescriptionProvider newInstance(); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java new file mode 100644 index 0000000..59f96be --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java @@ -0,0 +1,69 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import java.io.File; +import java.net.URI; +import java.net.URL; +import java.util.List; +import java.util.Set; + +import org.apache.taverna.lang.observer.Observable; +import org.apache.taverna.servicedescriptions.events.ServiceDescriptionRegistryEvent; + +public interface ServiceDescriptionRegistry extends + Observable<ServiceDescriptionRegistryEvent> { + void addServiceDescriptionProvider(ServiceDescriptionProvider provider); + + Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProviders(); + + Set<ServiceDescriptionProvider> getServiceDescriptionProviders(); + + Set<ServiceDescriptionProvider> getServiceDescriptionProviders( + ServiceDescription sd); + + Set<ServiceDescription> getServiceDescriptions(); + + ServiceDescription getServiceDescription(URI activityType); + + List<ConfigurableServiceProvider> getUnconfiguredServiceProviders(); + + Set<ServiceDescriptionProvider> getUserAddedServiceProviders(); + + Set<ServiceDescriptionProvider> getUserRemovedServiceProviders(); + + void loadServiceProviders(); + + void loadServiceProviders(File serviceProvidersURL); + + void loadServiceProviders(URL serviceProvidersURL); + + void refresh(); + + void removeServiceDescriptionProvider(ServiceDescriptionProvider provider); + + void saveServiceDescriptions(); + + void saveServiceDescriptions(File serviceDescriptionsFile); + + void exportCurrentServiceDescriptions(File serviceDescriptionsFile); + + boolean isDefaultSystemConfigurableProvidersLoaded(); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java new file mode 100644 index 0000000..8aa62e3 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java @@ -0,0 +1,35 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions; + +import uk.org.taverna.configuration.Configurable; + +/** + * @author David Withers + */ +public interface ServiceDescriptionsConfiguration extends Configurable { + public boolean isIncludeDefaults(); + + public void setIncludeDefaults(boolean includeDefaults); + + public boolean isRemovePermanently(); + + public void setRemovePermanently(boolean removePermanently); +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java new file mode 100644 index 0000000..8f58594 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java @@ -0,0 +1,35 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions.events; + +import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider; + +public abstract class AbstractProviderEvent extends + ServiceDescriptionRegistryEvent { + private final ServiceDescriptionProvider provider; + + public AbstractProviderEvent(ServiceDescriptionProvider provider) { + this.provider = provider; + } + + public ServiceDescriptionProvider getProvider() { + return provider; + } +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java new file mode 100644 index 0000000..fa5bb48 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java @@ -0,0 +1,37 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions.events; + +import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider; + +public class AbstractProviderNotification extends AbstractProviderEvent { + + private final String message; + + public AbstractProviderNotification(ServiceDescriptionProvider provider, String message) { + super(provider); + this.message = message; + } + + public String getMessage() { + return message; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java ---------------------------------------------------------------------- diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java new file mode 100644 index 0000000..e3e1655 --- /dev/null +++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java @@ -0,0 +1,29 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.taverna.servicedescriptions.events; + +import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider; + +public class AddedProviderEvent extends AbstractProviderEvent { + + public AddedProviderEvent(ServiceDescriptionProvider provider) { + super(provider); + } +} \ No newline at end of file
