You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/17 21:50:53 UTC
[1/5] incubator-taverna-osgi git commit: temporarily empty repository
Repository: incubator-taverna-osgi
Updated Branches:
refs/heads/master e9d4f177f -> 2f5a0e941
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-impl/src/main/java/uk/org/taverna/commons/update/impl/UpdateManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-update-impl/src/main/java/uk/org/taverna/commons/update/impl/UpdateManagerImpl.java b/taverna-update-impl/src/main/java/uk/org/taverna/commons/update/impl/UpdateManagerImpl.java
deleted file mode 100644
index 98d3257..0000000
--- a/taverna-update-impl/src/main/java/uk/org/taverna/commons/update/impl/UpdateManagerImpl.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.update.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.commons.io.FileUtils;
-import org.osgi.service.event.EventAdmin;
-
-import uk.org.taverna.commons.download.DownloadException;
-import uk.org.taverna.commons.download.DownloadManager;
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-import uk.org.taverna.commons.profile.xml.jaxb.UpdateSite;
-import uk.org.taverna.commons.profile.xml.jaxb.Updates;
-import uk.org.taverna.commons.update.UpdateException;
-import uk.org.taverna.commons.update.UpdateManager;
-import uk.org.taverna.commons.versions.xml.jaxb.Version;
-import uk.org.taverna.commons.versions.xml.jaxb.Versions;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * Implementation of the Taverna Update Manager.
- *
- * @author David Withers
- */
-public class UpdateManagerImpl implements UpdateManager {
-
- private static final String DIGEST_ALGORITHM = "MD5";
-
- private EventAdmin eventAdmin;
-
- private int checkIntervalSeconds;
-
- private ApplicationConfiguration applicationConfiguration;
-
- private DownloadManager downloadManager;
-
- private long lastCheckTime;
- private boolean updateAvailable;
- private Unmarshaller unmarshaller;
-
- private Versions applicationVersions;
- private Version latestVersion;
-
- public UpdateManagerImpl() throws UpdateException {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance(UpdateSite.class, ApplicationProfile.class);
- unmarshaller = jaxbContext.createUnmarshaller();
- } catch (JAXBException e) {
- throw new UpdateException("Error creating JAXBContext", e);
- }
- }
-
- @Override
- public boolean checkForUpdates() throws UpdateException {
- ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
- String version = applicationProfile.getVersion();
- Updates updates = applicationProfile.getUpdates();
-
- URL updatesURL;
- try {
- URI updateSiteURI = new URI(updates.getUpdateSite());
- updatesURL = updateSiteURI.resolve(updates.getUpdatesFile()).toURL();
- } catch (MalformedURLException e) {
- throw new UpdateException(String.format("Update site URL (%s) is not a valid URL",
- updates.getUpdateSite()), e);
- } catch (URISyntaxException e) {
- throw new UpdateException(String.format("Update site URL (%s) is not a valid URL",
- updates.getUpdateSite()), e);
- }
- File updateDirectory = new File(applicationConfiguration.getApplicationHomeDir(), "updates");
- updateDirectory.mkdirs();
- File updatesFile = new File(updateDirectory, updates.getUpdatesFile());
- try {
- downloadManager.download(updatesURL, updatesFile, DIGEST_ALGORITHM);
- } catch (DownloadException e) {
- throw new UpdateException(String.format("Error downloading %1$s",
- updatesURL), e);
- }
-
- try {
- UpdateSite updateSite = (UpdateSite) unmarshaller
- .unmarshal(updatesFile);
- applicationVersions = updateSite.getVersions();
- latestVersion = applicationVersions.getLatestVersion();
- updateAvailable = isHigherVersion(latestVersion.getVersion(), version);
- } catch (JAXBException e) {
- throw new UpdateException(String.format("Error reading %s",
- updatesFile.getName()), e);
- }
- lastCheckTime = System.currentTimeMillis();
- return updateAvailable;
- }
-
- @Override
- public boolean update() throws UpdateException {
- if (updateAvailable) {
- ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
- Updates updates = applicationProfile.getUpdates();
- URL profileURL;
- try {
- URI updateSiteURI = new URI(updates.getUpdateSite());
- profileURL = updateSiteURI.resolve(latestVersion.getFile()).toURL();
- } catch (MalformedURLException e) {
- throw new UpdateException(String.format(
- "Application profile URL (%s) is not a valid URL",
- latestVersion.getFile()), e);
- } catch (URISyntaxException e) {
- throw new UpdateException(String.format("Update site URL (%s) is not a valid URL",
- updates.getUpdateSite()), e);
- }
-
- File updateDirectory = new File(applicationConfiguration.getApplicationHomeDir(),
- "updates");
- updateDirectory.mkdirs();
- File latestProfileFile = new File(updateDirectory, "ApplicationProfile-"
- + latestVersion.getVersion() + ".xml");
- try {
- downloadManager.download(profileURL, latestProfileFile, DIGEST_ALGORITHM);
- } catch (DownloadException e) {
- throw new UpdateException(String.format("Error downloading %1$s",
- profileURL), e);
- }
-
- ApplicationProfile latestProfile;
- try {
- latestProfile = (ApplicationProfile) unmarshaller.unmarshal(latestProfileFile);
- } catch (JAXBException e) {
- throw new UpdateException(String.format("Error reading %s",
- latestProfileFile.getName()), e);
- }
-
- Set<BundleInfo> requiredBundles = getRequiredBundles(
- applicationConfiguration.getApplicationProfile(), latestProfile);
- downloadBundles(latestProfile, requiredBundles, new File(applicationConfiguration.getStartupDir(), "lib"));
- File applicationProfileFile = new File(applicationConfiguration.getStartupDir(), "ApplicationProfile.xml");
- try {
- FileUtils.copyFile(latestProfileFile, applicationProfileFile);
- } catch (IOException e) {
- throw new UpdateException(String.format("Error copying %1$s to %2$s",
- latestProfileFile.getName(), applicationProfileFile.getName()), e);
- }
-// eventAdmin.postEvent(new Event("UpdateManagerEvent", new HashMap()));
- updateAvailable = false;
- return true;
- }
- return false;
- }
-
- /**
- * @param requiredBundles
- * @param file
- * @throws UpdateException
- */
- private void downloadBundles(ApplicationProfile profile, Set<BundleInfo> requiredBundles, File file) throws UpdateException {
- Updates updates = profile.getUpdates();
- String updateSite = updates.getUpdateSite();
- String libDirectory = updates.getLibDirectory();
- if (!libDirectory.endsWith("/")) {
- libDirectory = libDirectory + "/";
- }
-
- URI updateLibDirectory;
- try {
- updateLibDirectory = new URI(updateSite).resolve(libDirectory);
- } catch (URISyntaxException e) {
- throw new UpdateException(String.format("Update site URL (%s) is not a valid URL",
- updates.getUpdateSite()), e);
- }
- for (BundleInfo bundle : requiredBundles) {
- URL bundleURL;
- URI bundleURI = updateLibDirectory.resolve(bundle.getFileName());
- try {
- bundleURL = bundleURI.toURL();
- } catch (MalformedURLException e) {
- throw new UpdateException(String.format("Bundle URL (%s) is not a valid URL",
- bundleURI), e);
- }
- File bundleDestination = new File(file, bundle.getFileName());
- try {
- downloadManager.download(bundleURL, new File(file, bundle.getFileName()), DIGEST_ALGORITHM);
- } catch (DownloadException e) {
- throw new UpdateException(String.format("Error downloading %1$s to %2$s",
- bundleURL, bundleDestination), e);
- }
- }
- }
-
- /**
- * Returns the new bundles required for the new application profile.
- *
- * @param currentProfile
- * @param newProfile
- * @return the new bundles required for the new application profile
- */
- private Set<BundleInfo> getRequiredBundles(ApplicationProfile currentProfile,
- ApplicationProfile newProfile) {
- Set<BundleInfo> requiredBundles = new HashSet<BundleInfo>();
- Map<String, BundleInfo> currentBundles = new HashMap<String, BundleInfo>();
- for (BundleInfo bundle : currentProfile.getBundle()) {
- currentBundles.put(bundle.getSymbolicName(), bundle);
- }
- for (BundleInfo bundle : newProfile.getBundle()) {
- if (currentBundles.containsKey(bundle.getSymbolicName())) {
- BundleInfo currentBundle = currentBundles.get(bundle.getSymbolicName());
- if (!bundle.getVersion().equals(currentBundle.getVersion())) {
- requiredBundles.add(bundle);
- }
- } else {
- requiredBundles.add(bundle);
- }
- }
- return requiredBundles;
- }
-
- private boolean isHigherVersion(String version1, String version2) {
- org.osgi.framework.Version semanticVersion1 = org.osgi.framework.Version.parseVersion(version1);
- org.osgi.framework.Version semanticVersion2 = org.osgi.framework.Version.parseVersion(version2);
- return semanticVersion1.compareTo(semanticVersion2) > 0;
- }
-
- public void setEventAdmin(EventAdmin eventAdmin) {
- this.eventAdmin = eventAdmin;
- }
-
- public void setCheckIntervalSeconds(int checkIntervalSeconds) {
- this.checkIntervalSeconds = checkIntervalSeconds;
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
- public void setDownloadManager(DownloadManager downloadManager) {
- this.downloadManager = downloadManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-impl/src/main/resources/META-INF/spring/update-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-update-impl/src/main/resources/META-INF/spring/update-context-osgi.xml b/taverna-update-impl/src/main/resources/META-INF/spring/update-context-osgi.xml
deleted file mode 100644
index 53f3c33..0000000
--- a/taverna-update-impl/src/main/resources/META-INF/spring/update-context-osgi.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <service ref="updateManager" interface="uk.org.taverna.commons.update.UpdateManager" />
-
- <reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
- <reference id="downloadManager" interface="uk.org.taverna.commons.download.DownloadManager" />
-
- <!-- <reference id="eventAdmin" interface="org.osgi.service.event.EventAdmin" /> -->
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-impl/src/main/resources/META-INF/spring/update-context.xml
----------------------------------------------------------------------
diff --git a/taverna-update-impl/src/main/resources/META-INF/spring/update-context.xml b/taverna-update-impl/src/main/resources/META-INF/spring/update-context.xml
deleted file mode 100644
index 4b58267..0000000
--- a/taverna-update-impl/src/main/resources/META-INF/spring/update-context.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
-
- <!-- <osgix:cm-properties id="cfg.with.defaults" persistent-id="uk.org.taverna.commons.update.impl.UpdateManagerImpl">
- <prop key="checkIntervalSeconds">300</prop>
- </osgix:cm-properties> -->
-
- <bean id="updateManager" class="uk.org.taverna.commons.update.impl.UpdateManagerImpl">
- <!-- <property name="eventAdmin" ref="eventAdmin" /> -->
- <property name="applicationConfiguration" ref="applicationConfiguration" />
- <property name="downloadManager" ref="downloadManager" />
- <!-- <osgix:managed-properties persistent-id="uk.org.taverna.commons.update.impl.UpdateManagerImpl" /> -->
- </bean>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-parser-service/.project
----------------------------------------------------------------------
diff --git a/xml-parser-service/.project b/xml-parser-service/.project
deleted file mode 100644
index 01c5428..0000000
--- a/xml-parser-service/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>xml-parser-service</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-parser-service/pom.xml
----------------------------------------------------------------------
diff --git a/xml-parser-service/pom.xml b/xml-parser-service/pom.xml
deleted file mode 100644
index 8ded30e..0000000
--- a/xml-parser-service/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>xml-parser-service</artifactId>
- <packaging>bundle</packaging>
- <name>XML Parser Service</name>
- <description>Implementation of XML Parser Service Specification, Version 1.0</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>org.w3c.dom;version="0.0.0",org.xml.sax;version="0.0.0",javax.xml.parsers;version="0.0.0",org.apache.xerces.jaxp,*</Import-Package>
- <Private-Package>org.osgi.util.xml</Private-Package>
- <Bundle-Activator>org.osgi.util.xml.XMLParserActivator</Bundle-Activator>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>4.3.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xerces</groupId>
- <artifactId>com.springsource.org.apache.xerces</artifactId>
- <version>2.9.1</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
----------------------------------------------------------------------
diff --git a/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory b/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
deleted file mode 100644
index 3845cc1..0000000
--- a/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
----------------------------------------------------------------------
diff --git a/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory b/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
deleted file mode 100644
index 88b247c..0000000
--- a/xml-parser-service/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.xerces.jaxp.SAXParserFactoryImpl
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-transformer-service/.project
----------------------------------------------------------------------
diff --git a/xml-transformer-service/.project b/xml-transformer-service/.project
deleted file mode 100644
index 86e32b9..0000000
--- a/xml-transformer-service/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>xml-transformer-service</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-transformer-service/pom.xml
----------------------------------------------------------------------
diff --git a/xml-transformer-service/pom.xml b/xml-transformer-service/pom.xml
deleted file mode 100644
index dc58a2e..0000000
--- a/xml-transformer-service/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>xml-transformer-service</artifactId>
- <packaging>bundle</packaging>
- <name>XML Transformer Service</name>
- <description>An XML Transformer Service</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>javax.xml.transform;version="0.0.0",org.apache.xalan.processor,*</Import-Package>
- <Private-Package>uk.org.taverna.osgi.services.xml</Private-Package>
- <Bundle-Activator>uk.org.taverna.osgi.services.xml.XMLTransformerActivator</Bundle-Activator>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.3.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xalan</groupId>
- <artifactId>com.springsource.org.apache.xalan</artifactId>
- <version>2.7.1</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.cglib</groupId>
- <artifactId>com.springsource.net.sf.cglib</artifactId>
- <version>2.1.3</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-transformer-service/src/main/java/uk/org/taverna/osgi/services/xml/XMLTransformerActivator.java
----------------------------------------------------------------------
diff --git a/xml-transformer-service/src/main/java/uk/org/taverna/osgi/services/xml/XMLTransformerActivator.java b/xml-transformer-service/src/main/java/uk/org/taverna/osgi/services/xml/XMLTransformerActivator.java
deleted file mode 100644
index dc197d9..0000000
--- a/xml-transformer-service/src/main/java/uk/org/taverna/osgi/services/xml/XMLTransformerActivator.java
+++ /dev/null
@@ -1,147 +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 uk.org.taverna.osgi.services.xml;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.transform.TransformerFactoryConfigurationError;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * A BundleActivator class that allows XML Transformers to register as an OSGi service.
- *
- * @author David Withers
- */
-public class XMLTransformerActivator implements BundleActivator, ServiceFactory {
-
- private static final Logger logger = Logger.getLogger(XMLTransformerActivator.class.getName());
-
- private BundleContext context;
-
- private static final String FACTORY_INTERFACE = "javax.xml.transform.TransformerFactory";
-
- private static final String SERVICES_DIRECTORY = "/META-INF/services/";
-
- private static final String FACTORY_IMPLEMENTATIONS_FILE = SERVICES_DIRECTORY
- + FACTORY_INTERFACE;
-
- private static final String FACTORY_DESCRIPTION = "An XML Transformer";
-
- private static final String FACTORY_NAMEKEY = "transformer.factoryname";
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- ServiceReference serviceReference = registration.getReference();
- String transformerFactoryClassName = (String) serviceReference.getProperty(FACTORY_NAMEKEY);
- try {
- return createFactory(transformerFactoryClassName);
- } catch (TransformerFactoryConfigurationError fce) {
- logger.log(Level.WARNING, "Error while creating TransformerFactory", fce);
- return null;
- }
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- this.context = context;
- Bundle bundle = context.getBundle();
- try {
- registerFactories(getFactoryClassNames(bundle.getResource(FACTORY_IMPLEMENTATIONS_FILE)));
- } catch (IOException ioe) {
- throw new TransformerFactoryConfigurationError(ioe);
- }
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- }
-
- private List<String> getFactoryClassNames(URL implementationsURL) throws IOException {
- List<String> classNames = new ArrayList<String>();
- if (implementationsURL != null) {
- InputStream is = implementationsURL.openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- String line = null;
- while ((line = br.readLine()) != null) {
- line = line.trim();
- if (line.length() == 0) {
- continue; // blank line
- }
- int commentPosition = line.indexOf("#");
- if (commentPosition == 0) { // comment line
- continue;
- } else if (commentPosition < 0) { // no comment
- classNames.add(line);
- } else {
- classNames.add(line.substring(0, commentPosition).trim());
- }
- }
- }
- return classNames;
- }
-
- private void registerFactories(List<String> factoryClassNames)
- throws TransformerFactoryConfigurationError {
- for (int index = 0; factoryClassNames.size() > index; index++) {
- String factoryClassName = factoryClassNames.get(index);
- Hashtable<String, String> properties = new Hashtable<String, String>();
- properties.put(Constants.SERVICE_DESCRIPTION, FACTORY_DESCRIPTION);
- properties.put(Constants.SERVICE_PID, FACTORY_INTERFACE + "."
- + context.getBundle().getBundleId() + "." + index);
- properties.put(FACTORY_NAMEKEY, factoryClassName);
- context.registerService(FACTORY_INTERFACE, this, properties);
- }
- }
-
- private Object createFactory(String factoryClassName)
- throws TransformerFactoryConfigurationError {
- try {
- return Class.forName(factoryClassName).newInstance();
- } catch (InstantiationException e) {
- throw new TransformerFactoryConfigurationError(e);
- } catch (IllegalAccessException e) {
- throw new TransformerFactoryConfigurationError(e);
- } catch (ClassNotFoundException e) {
- throw new TransformerFactoryConfigurationError(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/xml-transformer-service/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory
----------------------------------------------------------------------
diff --git a/xml-transformer-service/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory b/xml-transformer-service/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory
deleted file mode 100644
index 8e877dc..0000000
--- a/xml-transformer-service/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.xalan.processor.TransformerFactoryImpl
[5/5] incubator-taverna-osgi git commit: temporarily empty repository
Posted by st...@apache.org.
temporarily empty repository
.. as Software Grant is not yet formally on file
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/commit/2f5a0e94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/tree/2f5a0e94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/diff/2f5a0e94
Branch: refs/heads/master
Commit: 2f5a0e941bdf0afee66e9a5f1c3d188d40803e83
Parents: e9d4f17
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Tue Feb 17 20:43:20 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Tue Feb 17 20:43:20 2015 +0000
----------------------------------------------------------------------
.gitignore | 24 -
.travis.yml | 1 -
LICENSE | 176 -------
README.md | 8 -
osgi-launcher/pom.xml | 19 -
.../java/uk/org/taverna/osgi/OsgiLauncher.java | 434 -----------------
pom.xml | 46 --
taverna-app-configuration-api/.project | 24 -
taverna-app-configuration-api/pom.xml | 19 -
.../app/ApplicationConfiguration.java | 62 ---
taverna-app-configuration-impl/.project | 24 -
taverna-app-configuration-impl/pom.xml | 43 --
.../app/impl/ApplicationConfigurationImpl.java | 293 ------------
.../app/impl/ApplicationUserHome.java | 224 ---------
.../app/impl/Log4JConfiguration.java | 161 -------
.../spring/configuration-context-osgi.xml | 11 -
.../META-INF/spring/configuration-context.xml | 14 -
taverna-configuration-api/.project | 24 -
taverna-configuration-api/pom.xml | 30 --
.../configuration/AbstractConfigurable.java | 184 --------
.../org/taverna/configuration/Configurable.java | 118 -----
.../configuration/ConfigurationManager.java | 51 --
.../configuration/ConfigurationUIFactory.java | 29 --
.../uk/org/taverna/configuration/package.html | 3 -
.../proxy/HttpProxyConfiguration.java | 79 ----
.../configuration/AbstractConfigurableTest.java | 244 ----------
.../configuration/DummyConfigurable.java | 65 ---
taverna-configuration-impl/.project | 24 -
taverna-configuration-impl/pom.xml | 79 ----
.../impl/ConfigurationManagerImpl.java | 153 ------
.../proxy/impl/HttpProxyConfigurationImpl.java | 166 -------
.../spring/configuration-context-osgi.xml | 14 -
.../META-INF/spring/configuration-context.xml | 16 -
.../impl/ConfigurationManagerImplTest.java | 182 --------
.../configuration/impl/DummyUIFactory1.java | 126 -----
.../configuration/impl/DummyUIFactory2.java | 126 -----
taverna-download-api/pom.xml | 12 -
.../commons/download/DownloadException.java | 45 --
.../commons/download/DownloadManager.java | 116 -----
taverna-download-impl/pom.xml | 48 --
.../download/impl/DownloadManagerImpl.java | 120 -----
.../META-INF/spring/download-context-osgi.xml | 11 -
.../META-INF/spring/download-context.xml | 9 -
taverna-maven-plugin/pom.xml | 104 -----
.../t2/maven/plugins/AbstractDeployMojo.java | 56 ---
.../t2/maven/plugins/AbstractWagonMojo.java | 60 ---
.../t2/maven/plugins/BundleArtifact.java | 66 ---
.../t2/maven/plugins/MavenOsgiUtils.java | 415 -----------------
.../sf/taverna/t2/maven/plugins/Package.java | 46 --
.../t2/maven/plugins/PackageVersion.java | 77 ---
.../plugins/TavernaPluginDeployFileMojo.java | 235 ----------
.../maven/plugins/TavernaPluginDeployMojo.java | 220 ---------
.../plugins/TavernaPluginGenerateMojo.java | 142 ------
.../TavernaPluginPrepareBundlesMojo.java | 84 ----
.../maven/plugins/TavernaProfileDeployMojo.java | 275 -----------
.../plugins/TavernaProfileGenerateMojo.java | 221 ---------
.../net/sf/taverna/t2/maven/plugins/Utils.java | 171 -------
.../resources/META-INF/plexus/components.xml | 30 --
.../src/main/resources/java7-packages | 209 ---------
.../plugins/TavernaPluginGenerateMojoTest.java | 80 ----
.../src/test/resources/unit/plugin-config.xml | 19 -
taverna-osgi-schemas/pom.xml | 27 --
.../src/main/resources/ApplicationPlugin.xsd | 67 ---
.../src/main/resources/ApplicationProfile.xsd | 75 ---
.../src/main/resources/ApplicationVersions.xsd | 44 --
taverna-plugin-api/pom.xml | 29 --
.../uk/org/taverna/commons/plugin/Plugin.java | 88 ----
.../taverna/commons/plugin/PluginException.java | 45 --
.../taverna/commons/plugin/PluginManager.java | 105 -----
.../org/taverna/commons/plugin/PluginSite.java | 65 ---
.../commons/plugin/PluginSiteManager.java | 86 ----
taverna-plugin-impl/pom.xml | 81 ----
.../plugin/impl/PluginDirectoryWatcher.java | 106 -----
.../taverna/commons/plugin/impl/PluginImpl.java | 183 --------
.../commons/plugin/impl/PluginManagerImpl.java | 466 -------------------
.../commons/plugin/impl/PluginSiteImpl.java | 76 ---
.../plugin/impl/PluginSiteManagerImpl.java | 190 --------
.../commons/plugin/impl/PluginSites.java | 50 --
.../META-INF/spring/plugin-context-osgi.xml | 17 -
.../META-INF/spring/plugin-context.xml | 31 --
.../commons/plugin/impl/PluginSiteImplTest.java | 72 ---
.../plugin/impl/PluginSiteManagerImplTest.java | 142 ------
taverna-update-api/pom.xml | 12 -
.../taverna/commons/update/UpdateException.java | 47 --
.../taverna/commons/update/UpdateManager.java | 34 --
taverna-update-impl/pom.xml | 63 ---
.../commons/update/impl/UpdateManagerImpl.java | 270 -----------
.../META-INF/spring/update-context-osgi.xml | 16 -
.../META-INF/spring/update-context.xml | 21 -
xml-parser-service/.project | 24 -
xml-parser-service/pom.xml | 40 --
.../javax.xml.parsers.DocumentBuilderFactory | 1 -
.../services/javax.xml.parsers.SAXParserFactory | 1 -
xml-transformer-service/.project | 24 -
xml-transformer-service/pom.xml | 45 --
.../services/xml/XMLTransformerActivator.java | 147 ------
.../javax.xml.transform.TransformerFactory | 1 -
97 files changed, 8958 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index ebe0e5b..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# ignore project files #
-.classpath
-.project
-.settings/
-catalog-v001.xml
-
-# ignore target files #
-target/
-bin/
-build/
-dist/
-apidoc/
-*.swp
-
-# ignore svn files if there
-.svn
-
-# ignore log files #
-*.log
-/logs/*
-*/logs/*
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index dff5f3a..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1 +0,0 @@
-language: java
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 68c771a..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,176 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
deleted file mode 100644
index dd2958f..0000000
--- a/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Apache Taverna OSGi plugin system
-
-[![Build Status](https://travis-ci.org/taverna-incubator/incubator-taverna-osgi.svg)](https://travis-ci.org/taverna-incubator/incubator-taverna-osgi)
-
-OSGi-based plugin system, including online updates. Written for Apache Taverna, probably
-usable for any OSGi-based command line/desktop product.
-
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/osgi-launcher/pom.xml
----------------------------------------------------------------------
diff --git a/osgi-launcher/pom.xml b/osgi-launcher/pom.xml
deleted file mode 100644
index f2c6996..0000000
--- a/osgi-launcher/pom.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>osgi-launcher</artifactId>
- <name>OSGi Framework Launcher</name>
- <description>Launches an OSGi framework and handles loading and starting of OSGi bundles and Spring DM managed services</description>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/osgi-launcher/src/main/java/uk/org/taverna/osgi/OsgiLauncher.java
----------------------------------------------------------------------
diff --git a/osgi-launcher/src/main/java/uk/org/taverna/osgi/OsgiLauncher.java b/osgi-launcher/src/main/java/uk/org/taverna/osgi/OsgiLauncher.java
deleted file mode 100644
index cfd006b..0000000
--- a/osgi-launcher/src/main/java/uk/org/taverna/osgi/OsgiLauncher.java
+++ /dev/null
@@ -1,434 +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 uk.org.taverna.osgi;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * OSGi Framework launcher.
- *
- * Handles loading and starting of OSGi bundles and Spring DM managed services.
- *
- * An implementation of an OSGi Service Platform Release 4.1 (or higher) must be available on the
- * classpath.
- *
- * @author David Withers
- */
-public class OsgiLauncher {
-
- /**
- * Default boot delegation packages.
- */
- public static final String DEFAULT_BOOT_DELEGATION_PACKAGES = "sun.*,com.sun.*,java.*";
-
- /**
- * Default system packages.
- */
- public static final String DEFAULT_SYSTEM_PACKAGES = "com.sun.org.apache.xml.internal.utils";
-
- /**
- * Default time to wait for services to start up.
- */
- private static final long serviceLoadTimeoutSeconds = 30;
-
- private static final Logger logger = Logger.getLogger(OsgiLauncher.class.getName());
-
- private Framework framework;
- private BundleContext context;
-
- private Map<String, String> frameworkConfiguration = new HashMap<String, String>();
- private List<URI> bundlesToInstall = new ArrayList<URI>();
- private List<Bundle> installedBundles = new ArrayList<Bundle>();
- private Set<String> startedSpringContexts = new HashSet<String>();
- private Bundle springOsgiExtender;
-
- private OsgiLauncher(File storageDirectory) {
- setStorageDirectory(storageDirectory);
- setCleanStorageDirectory(true);
- setBootDelegationPackages(DEFAULT_BOOT_DELEGATION_PACKAGES);
- setSystemPackages(DEFAULT_SYSTEM_PACKAGES);
- }
-
- /**
- * Constructs an <code>OsgiLauncher</code> that loads bundles from a directory.
- *
- * Any file in the specified directory with a .jar extension will be loaded when the framework
- * is started.
- *
- * @param storageDirectory
- * persistent storage area used by the framework
- * @param storageDirectory
- * the directory containing bundles to load
- */
- public OsgiLauncher(File storageDirectory, File bundleDirectory) {
- this(storageDirectory);
- List<File> jars = Arrays.asList(bundleDirectory.listFiles(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
- }));
- for (File jar : jars) {
- bundlesToInstall.add(jar.toURI());
- }
- }
-
- /**
- * Constructs an <code>OsgiLauncher</code> that loads the specified bundles.
- *
- * @param storageDirectory
- * persistent storage area used by the framework
- * @param bundleURIs
- * bundles to load
- */
- public OsgiLauncher(File storageDirectory, List<URI> bundleURIs) {
- this(storageDirectory);
- for (URI bundleURI : bundleURIs) {
- bundlesToInstall.add(bundleURI);
- }
- }
-
- /**
- * Starts the OSGi framework, installs and starts the bundles.
- *
- * @throws BundleException
- * if the framework could not be started
- */
- public void start() throws BundleException {
- logger.info("Loading the OSGi Framework Factory");
- FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator()
- .next();
-
- logger.info("Creating the OSGi Framework");
- framework = frameworkFactory.newFramework(frameworkConfiguration);
- logger.info("Starting the OSGi Framework");
- framework.start();
-
- context = framework.getBundleContext();
- context.addServiceListener(new ServiceListener() {
- public void serviceChanged(ServiceEvent event) {
- ServiceReference serviceReference = event.getServiceReference();
- if (event.getType() == ServiceEvent.REGISTERED) {
- Object property = serviceReference
- .getProperty("org.springframework.context.service.name");
- if (property != null) {
- addStartedSpringContext(property.toString());
- }
- }
- logger.fine((event.getType() == ServiceEvent.REGISTERED ? "Registering : "
- : "Unregistering : ") + serviceReference);
- }
- });
-
- installedBundles = installBundles(bundlesToInstall);
-
- List<Bundle> bundlesToStart = new ArrayList<Bundle>();
- for (Bundle bundle : installedBundles) {
- if ("org.springframework.osgi.extender".equals(bundle.getSymbolicName())) {
- springOsgiExtender = bundle;
- } else {
- bundlesToStart.add(bundle);
- }
- }
- startBundles(bundlesToStart);
- }
-
- /**
- * Starts SpringDM managed services.
- *
- * @param waitForServices
- * if true waits for services to start before returning
- * @throws BundleException
- * if the framework has not been started or a service could not be started
- */
- public void startServices(boolean waitForServices) throws BundleException {
- if (framework == null || framework.getState() != Bundle.ACTIVE) {
- throw new BundleException("Framework not started");
- }
- if (springOsgiExtender != null) {
- logger.info("Starting Spring OSGi Extender");
- springOsgiExtender.start();
- if (waitForServices) {
- logger.info("Waiting for spring contexts to be started");
- for (Bundle bundle : installedBundles) {
- if (bundle.getState() == Bundle.ACTIVE) {
- if (hasSpringContext(bundle)) {
- logger.fine("Waiting for " + bundle.getSymbolicName());
- waitForSpringContext(context, bundle.getSymbolicName(), serviceLoadTimeoutSeconds);
- }
- }
- }
- }
- }
- }
-
- /**
- * Stops the OSGI framework.
- *
- * @throws BundleException
- * if the framework has not been started
- * @throws InterruptedException
- * if the thread is interrupted while the framework is stopping
- */
- public void stop() throws BundleException, InterruptedException {
- if (framework == null || framework.getState() != Bundle.ACTIVE) {
- throw new BundleException("Framework not started");
- }
- framework.stop();
- framework.waitForStop(0);
- context = null;
- }
-
- /**
- * Installs the bundles specified by the URIs into the framework.
- *
- * @param bundlesURIs
- * the URIs of the bundles to install
- * @return the installed bundles
- * @throws BundleException
- * if a bundle could not be installed
- */
- public List<Bundle> installBundles(List<URI> bundlesURIs) throws BundleException {
- List<Bundle> installedBundles = new ArrayList<Bundle>();
- logger.info("Installing bundles into the OSGi Framework");
- for (URI bundleURI : bundlesURIs) {
- installedBundles.add(installBundle(bundleURI));
- }
- return installedBundles;
- }
-
- /**
- * Installs the bundle specified by the URI into the framework.
- *
- * @param bundleURI
- * the URI of the bundle to install
- * @return the installed bundle
- * @throws BundleException
- * if the bundle could not be installed
- */
- public Bundle installBundle(URI bundleURI) throws BundleException {
- logger.fine("Installing bundle " + bundleURI);
- return context.installBundle(bundleURI.toASCIIString());
- }
-
- /**
- * Starts the bundles.
- *
- * If a bundle is a fragment bundle that bundle is not started.
- *
- * @param bundles
- * the bundles to start
- * @throws BundleException
- * if a bundle could not be started
- */
- public void startBundles(List<Bundle> bundles) throws BundleException {
- logger.info("Starting bundles in the OSGi Framework");
- for (Bundle bundle : bundles) {
- startBundle(bundle);
- }
- }
-
- /**
- * Starts the bundle.
- *
- * If the bundle is a fragment bundle the bundle is not started.
- *
- * @param bundle
- * the bundle to start
- * @throws BundleException
- * if the bundle could not be started
- */
- public void startBundle(Bundle bundle) throws BundleException {
- if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) == null) {
- logger.fine("Starting bundle " + bundle);
- bundle.start();
- }
- }
-
- /**
- * Returns the context. Returns <code>null</code> if the framework is not started.
- *
- * @return the context
- */
- public BundleContext getContext() {
- return context;
- }
-
- /**
- * Sets the configuration to use when creating the OSGi framework.
- *
- * @param frameworkConfiguration the configuration to use when creating the OSGi framework
- */
- public void setFrameworkConfiguration(Map<String, String> frameworkConfiguration) {
- this.frameworkConfiguration = frameworkConfiguration;
- }
-
- /**
- * Adds boot delegation packages.
- *
- * Multiple packages must be separated by a ','.
- *
- * @param additionalBootDelegationPackages
- * boot delegation packages to add
- */
- public void addBootDelegationPackages(String additionalBootDelegationPackages) {
- String bootDelegationPackages = frameworkConfiguration
- .get(Constants.FRAMEWORK_BOOTDELEGATION);
- if (bootDelegationPackages == null || bootDelegationPackages.isEmpty()) {
- bootDelegationPackages = additionalBootDelegationPackages;
- } else {
- bootDelegationPackages = bootDelegationPackages + ","
- + additionalBootDelegationPackages;
- }
- frameworkConfiguration.put(Constants.FRAMEWORK_BOOTDELEGATION, bootDelegationPackages);
- }
-
- /**
- * Sets the boot delegation packages.
- *
- * Multiple packages must be separated by a ','.
- *
- * @param bootDelegationPackages
- * the boot delegation packages
- */
- public void setBootDelegationPackages(String bootDelegationPackages) {
- frameworkConfiguration.put(Constants.FRAMEWORK_BOOTDELEGATION, bootDelegationPackages);
- }
-
- /**
- * Adds system packages.
- *
- * Multiple packages must be separated by a ','.
- *
- * @param additionalSystemPackages
- * system packages to add
- */
- public void addSystemPackages(String additionalSystemPackages) {
- String systemPackages = frameworkConfiguration
- .get(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
- if (systemPackages == null || systemPackages.isEmpty()) {
- systemPackages = additionalSystemPackages;
- } else {
- systemPackages = systemPackages + "," + additionalSystemPackages;
- }
- frameworkConfiguration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, systemPackages);
- }
-
- /**
- * Sets the system packages.
- *
- * Multiple packages must be separated by a ','.
- *
- * @param systemPackages
- * the system packages
- */
- public void setSystemPackages(String systemPackages) {
- frameworkConfiguration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, systemPackages);
- }
-
- /**
- * Sets the persistent storage area used by the framework.
- *
- * @param storageDirectory the persistent storage area used by the framework
- */
- public void setStorageDirectory(File storageDirectory) {
- frameworkConfiguration.put(Constants.FRAMEWORK_STORAGE, storageDirectory.getAbsolutePath());
- }
-
- /**
- * Set whether the storage directory should be cleaned on startup.
- *
- * @param cleanStorageDirectory
- * whether the storage directory should be cleaned on startup
- */
- public void setCleanStorageDirectory(boolean cleanStorageDirectory) {
- if (cleanStorageDirectory) {
- frameworkConfiguration.put(Constants.FRAMEWORK_STORAGE_CLEAN,
- Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
- } else {
- frameworkConfiguration.remove(Constants.FRAMEWORK_STORAGE_CLEAN);
- }
- }
-
- /**
- * Returns true if a bundle contains spring context files.
- *
- * @param bundle
- * the bundle to check
- * @return true if a bundle contains spring context files
- */
- private boolean hasSpringContext(Bundle bundle) {
- String springFilesLocation = "META-INF/spring";
- // check for custom spring files location
- @SuppressWarnings("rawtypes")
- Dictionary headers = bundle.getHeaders();
- if (headers != null) {
- Object header = headers.get("Spring-Context");
- if (header != null) {
- springFilesLocation = header.toString().trim();
- }
- }
- @SuppressWarnings("rawtypes")
- Enumeration springFiles = bundle.findEntries(springFilesLocation, "*.xml", false);
- return springFiles != null && springFiles.hasMoreElements();
- }
-
- private synchronized void waitForSpringContext(BundleContext context, String springContext,
- long timeoutSeconds) {
- long timeLeftToWait = timeoutSeconds * 1000;
- long startTime = System.currentTimeMillis();
-
- while (!startedSpringContexts.contains(springContext) && timeLeftToWait > 0) {
- try {
- wait(timeLeftToWait);
- } catch (InterruptedException e) {}
- timeLeftToWait = timeLeftToWait - (System.currentTimeMillis() - startTime);
- }
- }
-
- private synchronized void addStartedSpringContext(String springContext) {
- startedSpringContexts.add(springContext);
- notifyAll();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 32bd337..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>1-incubating-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- <name>Apache Taverna OSGi plugin system</name>
- <description>OSGi-based plugin system, including
- online updates. Written for Apache Taverna,
- usable for any OSGi-based
- command line/desktop product</description>
- <packaging>pom</packaging>
- <modules>
- <module>xml-parser-service</module>
- <module>xml-transformer-service</module>
- <module>osgi-launcher</module>
- <module>taverna-app-configuration-api</module>
- <module>taverna-app-configuration-impl</module>
- <module>taverna-configuration-api</module>
- <module>taverna-configuration-impl</module>
- <module>taverna-download-api</module>
- <module>taverna-download-impl</module>
- <module>taverna-maven-plugin</module>
- <module>taverna-plugin-api</module>
- <module>taverna-plugin-impl</module>
- <module>taverna-update-api</module>
- <module>taverna-update-impl</module>
- <module>taverna-osgi-schemas</module>
- </modules>
- <repositories>
- <repository>
- <id>taverna-incubating</id>
- <name>Apache Taverna incubating Repository</name>
- <url>http://repository.mygrid.org.uk/artifactory/incubator-snapshot-local/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- </repository>
- </repositories>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-api/.project
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-api/.project b/taverna-app-configuration-api/.project
deleted file mode 100644
index dabe905..0000000
--- a/taverna-app-configuration-api/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>taverna-app-configuration-api</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-api/pom.xml b/taverna-app-configuration-api/pom.xml
deleted file mode 100644
index 020cea7..0000000
--- a/taverna-app-configuration-api/pom.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-app-configuration-api</artifactId>
- <packaging>bundle</packaging>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
- <name>Apache Taverna App Configuration API</name>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-api/src/main/java/uk/org/taverna/configuration/app/ApplicationConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-api/src/main/java/uk/org/taverna/configuration/app/ApplicationConfiguration.java b/taverna-app-configuration-api/src/main/java/uk/org/taverna/configuration/app/ApplicationConfiguration.java
deleted file mode 100644
index b372598..0000000
--- a/taverna-app-configuration-api/src/main/java/uk/org/taverna/configuration/app/ApplicationConfiguration.java
+++ /dev/null
@@ -1,62 +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 uk.org.taverna.configuration.app;
-
-import java.io.File;
-
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-
-/**
- * Represent the application config as it has been specified in
- * {@value #PROPERTIES}. This configuration specifies the application's name
- * and title, etc.
- * <p>
- * An application would typically provide the {@value #PROPERTIES} file on the classpath under
- * a <code>conf</code> directory, or in a <code>conf</code> directory in the
- * application's distribution directory.
- *
- * @author Stian Soiland-Reyes
- * @author David Withers
- */
-public interface ApplicationConfiguration {
-
- public static final String CONF_DIR = "conf/";
- public static final String PLUGINS_DIR = "plugins";
-
- public String getName();
-
- public String getTitle();
-
- public File getStartupDir();
-
- public File getApplicationHomeDir();
-
- public File getUserPluginDir();
-
- public File getSystemPluginDir();
-
- public File getLogFile();
-
- public File getLogDir();
-
- public ApplicationProfile getApplicationProfile();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/.project
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/.project b/taverna-app-configuration-impl/.project
deleted file mode 100644
index 477b70d..0000000
--- a/taverna-app-configuration-impl/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>taverna-app-configuration-impl</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/pom.xml b/taverna-app-configuration-impl/pom.xml
deleted file mode 100644
index 55bab09..0000000
--- a/taverna-app-configuration-impl/pom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <packaging>bundle</packaging>
- <artifactId>taverna-app-configuration-impl</artifactId>
- <name>Apache Taverna App Configuration implementation</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>uk.org.taverna.configuration.app;provide:=true,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-app-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationConfigurationImpl.java b/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationConfigurationImpl.java
deleted file mode 100644
index b45f36f..0000000
--- a/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationConfigurationImpl.java
+++ /dev/null
@@ -1,293 +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 uk.org.taverna.configuration.app.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-import java.util.UUID;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * Represent the application config as it has been specified in {@value #PROPERTIES}. This
- * configuration specifies the application's name and title, etc.
- * <p>
- * An application would typically provide the {@value #PROPERTIES} file on the classpath under a
- * <code>conf</code> directory, or in a <code>conf</code> directory in the application's
- * distribution directory.
- *
- * @author Stian Soiland-Reyes
- * @author David Withers
- */
-public class ApplicationConfigurationImpl implements ApplicationConfiguration {
-
- private static final Logger logger = Logger.getLogger(ApplicationConfigurationImpl.class);
-
- private static final String UNKNOWN_APPLICATION = "unknownApplication-"
- + UUID.randomUUID().toString();
-
- public static final String APP_HOME = "taverna.app.home";
- public static final String APP_STARTUP = "taverna.app.startup";
- public static final String APPLICATION_PROFILE = "ApplicationProfile.xml";
-
- private File startupDir;
- private File homeDir;
-
- private ApplicationProfile applicationProfile;
- private ApplicationProfile defaultApplicationProfile;
-
- public ApplicationConfigurationImpl() {
- }
-
- @Override
- public String getName() {
- String name = null;
- ApplicationProfile profile = getDefaultApplicationProfile();
- if (profile != null) {
- name = profile.getName();
- }
- if (name == null) {
- logger.error("ApplicationConfig could not determine application name, using "
- + UNKNOWN_APPLICATION);
- return UNKNOWN_APPLICATION;
- }
- return name;
- }
-
- @Override
- public String getTitle() {
- return getName();
- }
-
- @Override
- public File getStartupDir() {
- if (startupDir == null) {
- String startupDirName = System.getProperty(APP_STARTUP);
- if (startupDirName != null) {
- startupDir = new File(startupDirName).getAbsoluteFile();
- }
- }
- return startupDir;
- }
-
- @Override
- public synchronized File getApplicationHomeDir() {
- if (homeDir == null) {
- if (getName().equals(ApplicationConfigurationImpl.UNKNOWN_APPLICATION)) {
- try {
- // Make a temporary home directory as a backup
- homeDir = File.createTempFile(getName(), "home");
- homeDir.delete();
- homeDir.mkdirs();
- } catch (IOException e) {
- throw new IllegalStateException("Can't create temporary application home", e);
- }
- logger.warn("Could not determine application's user home,"
- + " using temporary dir " + homeDir);
- } else {
- homeDir = new ApplicationUserHome(getName(), System.getProperty(APP_HOME)).getAppUserHome();
- }
- if (homeDir == null || !homeDir.isDirectory()) {
- throw new IllegalStateException("Could not create application home directory "
- + homeDir);
- }
- }
- return homeDir;
- }
-
- @Override
- public File getUserPluginDir() {
- File userPluginsDir = new File(getApplicationHomeDir(), PLUGINS_DIR);
- try {
- userPluginsDir.mkdirs();
- } catch (SecurityException e) {
- logger.warn("Error creating user plugin directory at " + userPluginsDir, e);
- }
- return userPluginsDir;
- }
-
- @Override
- public File getSystemPluginDir() {
- File systemPluginsDir = new File(getStartupDir(), PLUGINS_DIR);
- try {
- systemPluginsDir.mkdirs();
- } catch (SecurityException e) {
- logger.debug("Error creating system plugin directory at " + systemPluginsDir, e);
- }
- return systemPluginsDir;
- }
-
- @Override
- public File getLogFile() {
- return new File(getLogDir(), getName() + ".log");
- }
-
- @Override
- public File getLogDir() {
- File logDir = new File(getApplicationHomeDir(), "logs");
- logDir.mkdirs();
- if (!logDir.isDirectory()) {
- throw new IllegalStateException("Could not create log directory " + logDir);
- }
- return logDir;
- }
-
- private void findInClassLoader(List<URI> configs, ClassLoader classLoader, String resourcePath) {
- Enumeration<URL> resources;
- try {
- resources = classLoader.getResources(resourcePath);
- } catch (IOException ex) {
- System.err.println("Error looking for " + resourcePath + " in " + classLoader);
- ex.printStackTrace();
- return;
- }
- while (resources.hasMoreElements()) {
- URL configURL = resources.nextElement();
- try {
- configs.add(configURL.toURI());
- } catch (URISyntaxException ex) {
- throw new RuntimeException("Invalid URL from getResource(): " + configURL, ex);
- }
- }
- }
-
- /**
- * Attempt to load application properties from propertyFileName.
- * <p>
- * Will attempt to load a property file from the locations below. The first non-empty properties
- * successfully loaded will be returned.
- * <ol>
- * <li>$startup/conf/$resourceName</li>
- * <li>$startup/$resourceName</li>
- * <li>$contextClassPath/conf/$resourceName</li>
- * <li>$contextClassPath/$resourceName</li>
- * <li>$classpath/conf/$resourceName</li>
- * <li>$classpath/$resourceName</li>
- * </ol>
- * <p>
- * Where <code>$startup</code> is this application's startup directory as determined by
- * {@link #getStartupDir()}, and <code>$contextClassPath</code> means a search using
- * {@link ClassLoader#getResources(String)} from the classloader returned by
- * {@link Thread#getContextClassLoader()} and then again <code>$classpath</code> for the
- * classloader of {@link #getClass()} of this instance.
- * </p>
- * <p>
- * If none of these sources could find a non-empty property file, a warning is logged, and an
- * empty {@link Properties} instance is returned.
- *
- * @param resourceName
- * Relative filename of property file
- *
- * @return Loaded or empty {@link Properties} instance.
- */
- protected Properties loadProperties(String resourceName) {
- // Ordered list of config locations to attempt to load
- // properties from
- List<URI> configs = new ArrayList<URI>();
-
- File startupDir = getStartupDir();
- if (startupDir != null) {
- configs.add(startupDir.toURI().resolve(CONF_DIR).resolve(resourceName));
- configs.add(startupDir.toURI().resolve(resourceName));
- }
-
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- findInClassLoader(configs, contextClassLoader, CONF_DIR + resourceName);
- findInClassLoader(configs, contextClassLoader, resourceName);
-
- findInClassLoader(configs, getClass().getClassLoader(), CONF_DIR + resourceName);
- findInClassLoader(configs, getClass().getClassLoader(), resourceName);
-
- Properties loadedProps = new Properties();
- for (URI config : configs) {
- try {
- InputStream inputStream = config.toURL().openStream();
- loadedProps.load(inputStream);
- } catch (MalformedURLException ex) {
- throw new RuntimeException("Invalid URL from URI: " + config, ex);
- } catch (IOException ex) {
- continue; // Probably not found/access denied
- }
- if (!loadedProps.isEmpty()) {
- logger.debug("Loaded " + resourceName + " from " + config);
- return loadedProps;
- }
- }
- logger.debug("Could not find application properties file " + resourceName);
- return loadedProps;
- }
-
- @Override
- public ApplicationProfile getApplicationProfile() {
- if (applicationProfile == null) {
- File applicationProfileFile = new File(getApplicationHomeDir(), APPLICATION_PROFILE);
- if (!applicationProfileFile.exists()) {
- logger.debug("Application profile not found at " + applicationProfileFile);
- return getDefaultApplicationProfile();
- }
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance(ApplicationProfile.class);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- applicationProfile = (ApplicationProfile) unmarshaller.unmarshal(applicationProfileFile);
- } catch (JAXBException e) {
- logger.error("Could not read application profile from " + applicationProfileFile, e);
- }
- if (applicationProfile == null) {
- logger.debug("Application profile not found at " + applicationProfileFile);
- return getDefaultApplicationProfile();
- }
- }
- return applicationProfile;
- }
-
- public ApplicationProfile getDefaultApplicationProfile() {
- if (defaultApplicationProfile == null) {
- File applicationProfileFile = new File(getStartupDir(), APPLICATION_PROFILE);
- if (applicationProfileFile.exists()) {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance(ApplicationProfile.class);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- defaultApplicationProfile = (ApplicationProfile) unmarshaller.unmarshal(applicationProfileFile);
- } catch (JAXBException e) {
- throw new IllegalStateException("Could not read application profile from " + applicationProfileFile);
- }
- }
- }
- return defaultApplicationProfile;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationUserHome.java
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationUserHome.java b/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationUserHome.java
deleted file mode 100644
index a5bf207..0000000
--- a/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/ApplicationUserHome.java
+++ /dev/null
@@ -1,224 +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 uk.org.taverna.configuration.app.impl;
-
-import java.io.File;
-
-import org.apache.log4j.Logger;
-
-/**
- * Find and create an application's user directory according to operating system
- * standards.
- * <p>
- * For example for the application "MyApp" this class will be able to find
- * <code>$HOME/.myapp</code> on Linux or
- * <code>C:\Document and settings\MyUsername\Application Data\MyApplication</code>
- * on Windows XP.
- *
- * @author Stian Soiland-Reyes
- * @author Stuart Owen
- *
- */
-public class ApplicationUserHome {
-
- private final String defaultApplicationHome;
-
- private final String applicationName;
-
- private File homeDir;
-
- private static Logger logger = Logger.getLogger(ApplicationUserHome.class);
-
- /**
- * Initialise with the name of the application.
- *
- * @param applicationName
- * This name will be used as a template for creating the
- * application home directory (but might be transcribed, for
- * instance to lowercase). It is generally recommended, but not
- * required - that this name does not contain spaces or any
- * special international/Unicode characters.
- */
- public ApplicationUserHome(String applicationName) {
- this(applicationName, null);
- }
-
- /**
- * Initialise with the name of the application and a default application
- * home.
- *
- * @param applicationName
- * This name will be used as a template for creating the
- * application home directory (but might be transcribed, for
- * instance to lowercase). It is generally recommended, but not
- * required - that this name does not contain spaces or any
- * special international/Unicode characters.
- * @param defaultApplicationHome
- * The full path to the default home directory. If this string is
- * not <code>null</code>, then a {@link File} based on this
- * directory will always be returned by
- * {@link #getDefaultApplicationHome()} - otherwise the normal
- * operating system logic is used to determine the application's
- * home directory.
- */
- public ApplicationUserHome(String applicationName,
- String defaultApplicationHome) {
- this.applicationName = applicationName;
- this.defaultApplicationHome = defaultApplicationHome;
- }
-
- /**
- * Find (and if necessary create) the user's application directory,
- * according to operating system standards. The resolved directory is then
- * returned as a {@link File} object.
- * <p>
- * The application's name as defined by {@link #getApplicationName()} is
- * used as a basis for naming the directory of the application's user
- * directory, but the directory name might for instance be transformed to
- * lowercase.
- * <p>
- * If {@link #getDefaultApplicationHome()} returns a non-null value, the
- * directory specified by that path will be used instead of the operation
- * system specific directory. The directory will be created if needed.
- * <p>
- * If any exception occurs (such as out of diskspace), <code>null</code>
- * will be returned.
- *
- * <p>
- * On Windows XP, this will typically be something like:
- *
- * <pre>
- * C:\Document and settings\MyUsername\Application Data\MyApplication
- * </pre>
- *
- * and on Windows Vista it would be something like:
- *
- * <pre>
- * C:\Users\MyUsername\Application Data\MyApplication
- * </pre>
- *
- * while on Mac OS X it will be something like:
- *
- * <pre>
- * /Users/MyUsername/Library/Application Support/MyApplication
- * </pre>
- *
- * All other OS'es are assumed to be UNIX-alike, returning something like:
- *
- * <pre>
- * /user/myusername/.myapplication
- * </pre>
- *
- * <p>
- * If the directory does not already exist, it will be created.
- * </p>
- *
- * @return An {@link File} referring to an existing directory for
- * user-specific configuration etc. for the given application.
- */
- public synchronized File getAppUserHome() {
- if (homeDir != null) {
- return homeDir;
- }
- File appHome;
- String applicationHome = getDefaultApplicationHome();
- if (applicationHome != null) {
- appHome = new File(applicationHome);
- } else {
- if (getApplicationName() == null) {
- logger.warn("Unknown application name");
- return null;
- }
- File home = new File(System.getProperty("user.home"));
- if (!home.isDirectory()) {
- logger.error("User home not a valid directory: " + home);
- return null;
- }
- String os = System.getProperty("os.name");
- // logger.debug("OS is " + os);
- if (os.equals("Mac OS X")) {
- File libDir = new File(home, "Library/Application Support");
- libDir.mkdirs();
- appHome = new File(libDir, getApplicationName());
- } else if (os.startsWith("Windows")) {
- String APPDATA = System.getenv("APPDATA");
- File appData = null;
- if (APPDATA != null) {
- appData = new File(APPDATA);
- }
- if (appData != null && appData.isDirectory()) {
- appHome = new File(appData, getApplicationName());
- } else {
- logger.warn("Could not find %APPDATA%: " + APPDATA);
- appHome = new File(home, getApplicationName());
- }
- } else {
- // We'll assume UNIX style is OK
- appHome = new File(home, "."
- + getApplicationName().toLowerCase().replace(' ', '-'));
- }
- }
- if (!appHome.exists()) {
- if (appHome.mkdir()) {
- logger.info("Created " + appHome);
- } else {
- logger.error("Could not create " + appHome);
- return null;
- }
- }
- if (!appHome.isDirectory()) {
- logger.error("User home not a valid directory: " + appHome);
- return null;
- }
- this.homeDir = appHome.getAbsoluteFile();
- return this.homeDir;
- }
-
- /**
- * The application's name. This name will be used as a template for creating
- * the application home directory (but might be transcribed, for instance to
- * lowercase). It is generally recommended, but not required - that this
- * name does not contain spaces or any special international/Unicode
- * characters.
- *
- * @return The application's name.
- *
- */
- public String getApplicationName() {
- return applicationName;
- }
-
- /**
- * The full path to the default home directory. If this string is not
- * <code>null</code>, then a {@link File} based on this directory will
- * always be returned by {@link #getDefaultApplicationHome()} - otherwise
- * the normal operating system logic is used to determine the application's
- * home directory.
- *
- * @return The full path to the application's home directory, or
- * <code>null</code> if the operation system specific logic is to
- * be used.
- */
- public String getDefaultApplicationHome() {
- return defaultApplicationHome;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/Log4JConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/Log4JConfiguration.java b/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/Log4JConfiguration.java
deleted file mode 100644
index f0e88c2..0000000
--- a/taverna-app-configuration-impl/src/main/java/uk/org/taverna/configuration/app/impl/Log4JConfiguration.java
+++ /dev/null
@@ -1,161 +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 uk.org.taverna.configuration.app.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.RollingFileAppender;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-public class Log4JConfiguration {
- public final static String LOG4J_PROPERTIES = "log4j.properties";
-
- private static boolean log4jConfigured = false;
-
- private ApplicationConfiguration applicationConfiguration;
-
- private Properties properties ;
-
- public Log4JConfiguration() {
-// prepareLog4J();
- }
-
- public void prepareLog4J() {
- if (!log4jConfigured) {
- Properties log4jProperties = getLogProperties();
- if (log4jProperties != null && ! log4jProperties.isEmpty()) {
- LogManager.resetConfiguration();
- PropertyConfigurator.configure(log4jProperties);
- }
-
- String logFilePath = applicationConfiguration.getLogFile().getAbsolutePath();
- PatternLayout layout = new PatternLayout("%-5p %d{ISO8601} (%c:%L) - %m%n");
-
- // Add file appender
- RollingFileAppender appender;
- try {
- appender = new RollingFileAppender(layout, logFilePath);
- appender.setMaxFileSize("1MB");
- appender.setEncoding("UTF-8");
- appender.setMaxBackupIndex(4);
- // Let root logger decide level
- appender.setThreshold(Level.ALL);
- LogManager.getRootLogger().addAppender(appender);
- } catch (IOException e) {
- System.err.println("Could not log to " + logFilePath);
- }
-
- log4jConfigured = true;
- }
- }
-
- /**
- * Initialises and provides access to the list of Properties.
- * @return
- */
- public Properties getLogProperties() {
- if (properties == null) {
- InputStream is = getLogPropertiesInputStream();
- if (is != null) {
- try {
- properties = new Properties();
- properties.load(is);
-// properties.putAll(System.getProperties());
- } catch (IOException e) {
- errorLog("An error occurred trying to load the " + LOG4J_PROPERTIES + " file",e);
- }
- }
- }
- return properties;
- }
-
- /**
- * Return an input stream to the configuration file, or null if it can't be found
- * @return
- */
- private InputStream getLogPropertiesInputStream() {
- InputStream result = null;
- File propertiesFile = getLogPropertiesFile();
- if (propertiesFile!=null) {
- try {
- result=new FileInputStream(propertiesFile);
- } catch (FileNotFoundException e) {
- errorLog("Unable to find "+LOG4J_PROPERTIES,e);
- }
- }
- else {
- errorLog("Unable to determine file for "+LOG4J_PROPERTIES,null);
- }
- return result;
- }
-
- /**
- * Returns a File object to the configuration file or null if it cannot be found.
- *
- * @return
- */
- private File getLogPropertiesFile() {
- File home = applicationConfiguration.getApplicationHomeDir();
- File startup = applicationConfiguration.getStartupDir();
- File result=null;
- if (home!=null) {
- File file = new File(new File(home, ApplicationConfiguration.CONF_DIR), LOG4J_PROPERTIES);
- if (file.exists()) {
- result=file;
- }
- }
- if (result==null && startup!=null) {
- File file = new File(new File(startup, ApplicationConfiguration.CONF_DIR), LOG4J_PROPERTIES);
- if (file.exists()) {
- result=file;
- }
- }
- return result;
- }
-
- private void errorLog(String message, Throwable exception) {
- System.out.println(message);
- if (exception!=null) {
- exception.printStackTrace();
- }
-
- }
-
- /**
- * Sets the applicationConfiguration.
- *
- * @param applicationConfiguration the new value of applicationConfiguration
- */
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml b/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml
deleted file mode 100644
index 86cb988..0000000
--- a/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <service ref="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml
----------------------------------------------------------------------
diff --git a/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml b/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml
deleted file mode 100644
index db9645e..0000000
--- a/taverna-app-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="applicationConfiguration" class="uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl" />
- <bean id="log4JConfiguration" class="uk.org.taverna.configuration.app.impl.Log4JConfiguration" init-method="prepareLog4J">
- <property name="applicationConfiguration">
- <ref local="applicationConfiguration" />
- </property>
- </bean>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/.project
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/.project b/taverna-configuration-api/.project
deleted file mode 100644
index 38755c1..0000000
--- a/taverna-configuration-api/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>taverna-configuration-api</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/pom.xml b/taverna-configuration-api/pom.xml
deleted file mode 100644
index a2b6460..0000000
--- a/taverna-configuration-api/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-configuration-api</artifactId>
- <name>Apache Taverna Configuration API</name>
- <packaging>bundle</packaging>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.csv</artifactId>
- <version>${apache.commons.csv.version}</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>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-osgi/blob/2f5a0e94/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/AbstractConfigurable.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/AbstractConfigurable.java b/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/AbstractConfigurable.java
deleted file mode 100644
index a00938f..0000000
--- a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/AbstractConfigurable.java
+++ /dev/null
@@ -1,184 +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 uk.org.taverna.configuration;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.csv.CSVParser;
-import org.apache.commons.csv.CSVPrinter;
-import org.apache.log4j.Logger;
-
-/**
- * A utility abstract class that simplifies implementing a Configurable.
- * <br>
- * <p>A concrete version of this class needs to define the name,category,
- * UUID string and the set of default values.</p>
- *
- * @author Stuart Owen
- *
- */
-public abstract class AbstractConfigurable implements Configurable {
-
- private Map<String,String> propertyMap = new HashMap<String, String>();
-
- private static Logger logger = Logger.getLogger(AbstractConfigurable.class);
-
- public static final String DELETED_VALUE_CODE = "~~DELETED~~";
-
- private ConfigurationManager configurationManager;
-
- public Set<String> getKeys() {
- return getInternalPropertyMap().keySet();
- }
-
- /**
- * Constructs the AbstractConfigurable by either reading from a previously stored set of properties,
- * or by using the default values which results in them being stored for subsequent usage.
- */
- public AbstractConfigurable(ConfigurationManager configurationManager) {
- this.configurationManager = configurationManager;
- try {
- configurationManager.populate(this);
- } catch (Exception e) {
- logger.error("There was an error reading the properties for the Configurable:"+getFilePrefix(),e);
- }
- }
-
- public synchronized String getProperty(String key) {
- String val = getInternalPropertyMap().get(key);
- if (val==null) val=getDefaultProperty(key);
- if (DELETED_VALUE_CODE.equals(val)) val=null;
- return val;
- }
-
- public String getDefaultProperty(String key) {
- return getDefaultPropertyMap().get(key);
- }
-
- protected void store() {
- try {
- configurationManager.store(this);
- } catch (Exception e) {
- logger.error("There was an error storing the new configuration for: "+this.getFilePrefix(),e);
- }
- }
-
- public void clear() {
- getInternalPropertyMap().clear();
- }
-
- public synchronized void setProperty(String key, String value) {
- Object oldValue = getInternalPropertyMap().get(key);
- if (value==null) {
- deleteProperty(key);
- }
- else {
- getInternalPropertyMap().put(key,value);
- }
- if (value==null || !value.equals(oldValue)) {
- store();
- }
- }
-
- /**
- * Provides access to the internal map.
- * <br>
- * Note that this map will contain entries for deleted values that also have corresponding default values.
- * For this reason using this map directly is discouraged, and #getProperty(String)} should be used instead.
- * @return
- */
- public Map<String, String> getInternalPropertyMap() {
- return propertyMap;
- }
-
-
- public void restoreDefaults() {
- propertyMap.clear();
- propertyMap.putAll(getDefaultPropertyMap());
- store();
- }
-
- public void deleteProperty(String key) {
- if (getDefaultPropertyMap().containsKey(key)) {
- propertyMap.put(key, DELETED_VALUE_CODE);
- }
- else {
- propertyMap.remove(key);
- }
- }
-
- /**
- * Returns an unmodifiable List<String> for the given key. Internally the value is stored as a single String, but converted to a list when calling this method.
- * <br>
- * The list is unmodifiable to prevent the mistake of trying <pre>getPropertyStringList(..).add("new element");</pre> which will not affect the stored
- * list. For the property to be updated this{@link #setPropertyStringList(String, List)} must be used.
- */
- public List<String> getPropertyStringList(String key) {
- String value = getProperty(key);
- if (value!=null) {
- return Collections.unmodifiableList(fromListText(value));
- }
- else {
- return null;
- }
- }
-
- private List<String> fromListText(String property) {
- List<String> result = new ArrayList<String>();
- if (property.length()>0) { //an empty string as assumed to be an empty list, rather than a list with 1 empty string in it!
- StringReader reader = new StringReader(property);
- CSVParser csvReader = new CSVParser(reader);
- try {
- for (String v : csvReader.getLine()) {
- result.add(v);
- }
- } catch (IOException e) {
- logger.error("Exception occurred parsing CSV properties:"+property,e);
- }
- }
- return result;
- }
-
- /**
- * Set a value that is known to be a list. The value can be retrieved using this{@link #getPropertyStringList(String)}
- * <br>
- * Within the file, the value is stored as a single Comma Separated Value
- */
- public void setPropertyStringList(String key, List<String> value) {
- setProperty(key, toListText(value));
- }
-
- private String toListText(List<String> values) {
- StringWriter writer = new StringWriter();
- CSVPrinter csvWriter = new CSVPrinter(writer);
- csvWriter.println(values.toArray(new String[]{}));
- return writer.getBuffer().toString().trim();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/Configurable.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/Configurable.java b/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/Configurable.java
deleted file mode 100644
index b9b0642..0000000
--- a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/Configurable.java
+++ /dev/null
@@ -1,118 +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 uk.org.taverna.configuration;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * An interface that defines an Object as being configurable.
- * It supports the core properties that allows this items configuration to be stored and re-populated by the ConfigurationManager
- *
- * @author Stuart Owen
- *
- */
-public interface Configurable {
-
- /**
- * @return a Map containing the default value/key pairs of the configured properties
- */
- Map<String,String> getDefaultPropertyMap();
- /**
- * @return a globally unique identifier that ensures that when stored this items configuration details will never clash with another
- */
- String getUUID();
-
- /**
- * @return a friendly name for the item
- */
- String getDisplayName();
-
- /**
- * return a file-system suitable prefix
- */
- String getFilePrefix();
-
- /**
- * @return a String defining the category of configurations that this item belongs to.
- */
- String getCategory();
- /**
- * Restore the default property map
- */
- void restoreDefaults();
-
- /**
- * Provides the default property for a given key
- *
- * @param key
- * @return
- */
- String getDefaultProperty(String key);
-
- Set<String> getKeys();
-
- void clear();
-
- /**
- * Provides access to the internal map.
- * <br>
- * Note that this map may contain internal identifiers for deleted entries for deleted values that also have corresponding default values.
- * For this reason using this map directly is discouraged, and #getProperty(String)} should be used instead.
- * @return
- */
- Map<String, String> getInternalPropertyMap();
-
- /**
- * Looks up the property for the given key.
- * <br>
- * Using this method is preferable to using the property map directly.
- * @param key
- * @return the String represented by the key, the default value, or null
- */
- String getProperty(String key);
-
- /**
- * Overwrites or applies a new value against the given key in the property map.
- * <br>
- * Setting a value to null is equivalent to calling this{@link #deleteProperty(String)}
- * <br>
- * If the value is new, or changed, the the property map is stored.
- * <br>
- * Using this method is preferable to using the property map directly.
- * @param key
- * @param value
- */
- void setProperty(String key, String value);
-
- /**
- * Deletes a property value for a given key.
- * <br>
- * Subsequent calls to this{@link #getProperty(String)} will return null.
- * @param key
- */
- void deleteProperty(String key);
-
- public List<String> getPropertyStringList(String key);
-
- public void setPropertyStringList(String key, List<String>value);
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationManager.java b/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationManager.java
deleted file mode 100644
index 11ca22a..0000000
--- a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationManager.java
+++ /dev/null
@@ -1,51 +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 uk.org.taverna.configuration;
-
-/**
- * Handles the configuration for a {@link Configurable} object
- *
- * @author David Withers
- */
-public interface ConfigurationManager {
-
- /**
- * Write out the properties configuration to disk based on the UUID of the
- * {@link Configurable}
- * <br>
- * Default values are not stored within the file, but only those that have been changed or deleted.
- *
- * @param configurable
- * @throws Exception
- */
- public void store(Configurable configurable) throws Exception;
-
- /**
- * Loads the configuration details from disk or from memory and populates the provided Configurable
- *
- * @param configurable
- * @return
- * @throws Exception
- * if there are no configuration details available
- */
- public void populate(Configurable configurable) throws Exception;
-
-}
\ No newline at end of file
[2/5] incubator-taverna-osgi git commit: temporarily empty repository
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-osgi-schemas/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-osgi-schemas/pom.xml b/taverna-osgi-schemas/pom.xml
deleted file mode 100644
index 853ff16..0000000
--- a/taverna-osgi-schemas/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-osgi-schemas</artifactId>
- <name>Apache Taverna OSGi XML Schemas</name>
- <packaging>bundle</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-osgi-schemas/src/main/resources/ApplicationPlugin.xsd
----------------------------------------------------------------------
diff --git a/taverna-osgi-schemas/src/main/resources/ApplicationPlugin.xsd b/taverna-osgi-schemas/src/main/resources/ApplicationPlugin.xsd
deleted file mode 100644
index 180c8c2..0000000
--- a/taverna-osgi-schemas/src/main/resources/ApplicationPlugin.xsd
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<xs:schema xmlns="http://ns.taverna.org.uk/2013/application/plugin"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:versions="http://ns.taverna.org.uk/2013/application/versions"
- xmlns:ap="http://ns.taverna.org.uk/2013/application/profile"
- xmlns:plugin="http://ns.taverna.org.uk/2013/application/plugin"
- xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0"
- targetNamespace="http://ns.taverna.org.uk/2013/application/plugin"
- elementFormDefault="qualified">
-
- <xs:annotation>
- <xs:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="uk.org.taverna.commons.plugin.xml.jaxb" />
- </jxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:import namespace="http://ns.taverna.org.uk/2013/application/versions"
- schemaLocation="ApplicationVersions.xsd" />
-
- <xs:import namespace="http://ns.taverna.org.uk/2013/application/profile"
- schemaLocation="ApplicationProfile.xsd" />
-
- <xs:element name="pluginInfo">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="id" type="xs:string" />
- <xs:element name="name" type="xs:string" />
- <xs:element name="description" type="xs:string" />
- <xs:element name="organization" type="xs:string" />
- <xs:element name="version" type="versions:semanticVersion" />
- <xs:element name="bundle" type="ap:bundleInfo" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="pluginVersions">
- <xs:complexContent>
- <xs:extension base="versions:versions">
- <xs:sequence>
- <xs:element name="organization" type="xs:string" />
- <xs:element name="pluginSiteUrl" type="xs:string" minOccurs="0" />
- </xs:sequence>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:element name="plugins">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="plugin" type="pluginVersions"
- minOccurs="1" maxOccurs="unbounded">
- <xs:unique name="versionUnique">
- <xs:selector
- xpath="versions:previousVersion/versions:version|versions:latestVersion/versions:version" />
- <xs:field xpath="." />
- </xs:unique>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:unique name="versionsIdUnique">
- <xs:selector xpath="plugin:versions/versions:id" />
- <xs:field xpath="." />
- </xs:unique>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-osgi-schemas/src/main/resources/ApplicationProfile.xsd
----------------------------------------------------------------------
diff --git a/taverna-osgi-schemas/src/main/resources/ApplicationProfile.xsd b/taverna-osgi-schemas/src/main/resources/ApplicationProfile.xsd
deleted file mode 100644
index 78073a2..0000000
--- a/taverna-osgi-schemas/src/main/resources/ApplicationProfile.xsd
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<xs:schema xmlns="http://ns.taverna.org.uk/2013/application/profile"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:versions="http://ns.taverna.org.uk/2013/application/versions"
- xmlns:ap="http://ns.taverna.org.uk/2013/application/profile" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
- jxb:version="1.0" targetNamespace="http://ns.taverna.org.uk/2013/application/profile"
- elementFormDefault="qualified">
-
- <xs:annotation>
- <xs:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="uk.org.taverna.commons.profile.xml.jaxb" />
- </jxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:import namespace="http://ns.taverna.org.uk/2013/application/versions"
- schemaLocation="ApplicationVersions.xsd" />
-
- <xs:complexType name="frameworkConfiguration">
- <xs:attribute name="name" type="xs:string" use="required" />
- <xs:attribute name="value" type="xs:string" use="required" />
- </xs:complexType>
-
- <xs:complexType name="bundleInfo">
- <xs:sequence>
- <xs:element name="fileName" type="xs:anyURI" minOccurs="0" />
- </xs:sequence>
- <xs:attribute name="symbolicName" type="xs:string" use="required" />
- <xs:attribute name="version" type="versions:semanticVersion"
- use="required" />
- </xs:complexType>
-
- <xs:complexType name="updates">
- <xs:sequence>
- <xs:element name="updateSite" type="xs:anyURI" />
- <xs:element name="updatesFile" type="xs:string" />
- <xs:element name="libDirectory" type="xs:string" />
- <xs:element name="pluginSite" type="xs:string" />
- <xs:element name="pluginsFile" type="xs:string" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:element name="applicationProfile">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="id" type="xs:string" />
- <xs:element name="name" type="xs:string" />
- <xs:element name="version" type="versions:semanticVersion" />
- <xs:element name="updates" type="updates" />
- <xs:element name="frameworkConfiguration" type="frameworkConfiguration"
- minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="bundle" type="bundleInfo" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- <xs:unique name="symbolicNameUnique">
- <xs:selector xpath="ap:bundles/ap:bundle"></xs:selector>
- <xs:field xpath="@symbolicName"></xs:field>
- </xs:unique>
- </xs:element>
-
- <xs:element name="updateSite">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="versions" type="versions:versions">
- <xs:unique name="versionUnique">
- <xs:selector
- xpath="versions:previousVersion/versions:version|versions:latestVersion/versions:version" />
- <xs:field xpath="." />
- </xs:unique>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-osgi-schemas/src/main/resources/ApplicationVersions.xsd
----------------------------------------------------------------------
diff --git a/taverna-osgi-schemas/src/main/resources/ApplicationVersions.xsd b/taverna-osgi-schemas/src/main/resources/ApplicationVersions.xsd
deleted file mode 100644
index 706423c..0000000
--- a/taverna-osgi-schemas/src/main/resources/ApplicationVersions.xsd
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<xs:schema xmlns="http://ns.taverna.org.uk/2013/application/versions"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:versions="http://ns.taverna.org.uk/2013/application/versions"
- xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0"
- targetNamespace="http://ns.taverna.org.uk/2013/application/versions"
- elementFormDefault="qualified">
-
- <xs:annotation>
- <xs:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="uk.org.taverna.commons.versions.xml.jaxb" />
- </jxb:schemaBindings>
- </xs:appinfo>
- </xs:annotation>
-
- <xs:simpleType name="semanticVersion">
- <xs:annotation>
- <xs:documentation>A semantic version.</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="[0-9]+\.[0-9]+(\.[0-9]+(\.[0-9A-Za-z_-]+)?)?" />
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="version">
- <xs:sequence>
- <xs:element name="version" type="semanticVersion" />
- <xs:element name="file" type="xs:string" />
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="versions">
- <xs:sequence>
- <xs:element name="id" type="xs:string" />
- <xs:element name="name" type="xs:string" />
- <xs:element name="description" type="xs:string" />
- <xs:element name="latestVersion" type="version" minOccurs="1"
- maxOccurs="1" />
- <xs:element name="previousVersion" type="version"
- minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-plugin-api/pom.xml b/taverna-plugin-api/pom.xml
deleted file mode 100644
index 1e7ed02..0000000
--- a/taverna-plugin-api/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <packaging>bundle</packaging>
- <artifactId>taverna-plugin-api</artifactId>
- <name>Apache Taverna Plugin API</name>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-app-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/Plugin.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/Plugin.java b/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/Plugin.java
deleted file mode 100644
index e9ea0a4..0000000
--- a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/Plugin.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin;
-
-import java.io.File;
-import java.util.Set;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * A plugin adds functionality to the application by providing implementations of application
- * services.
- *
- * @author David Withers
- */
-public interface Plugin {
-
- public static enum State {
- UNINSTALLED, INSTALLED, STARTED, STOPPED
- }
-
- public String getId();
-
- public String getName();
-
- public String getDescription();
-
- public String getOrganization();
-
- public Version getVersion();
-
- /**
- * Returns the state of the plugin.
- *
- * @return the state of the plugin
- */
- public State getState();
-
- /**
- * Starts the plugin and sets the state to STARTED.
- * <p>
- * If the plugin state is STARTED this method will have no effect.
- * <p>
- * All plugin bundles are not currently started will be started.
- *
- * @throws PluginException
- * if the plugin state is UNINSTALLED or any of the plugin bundles cannot be started
- */
- public void start() throws PluginException;
-
- /**
- * Stops the plugin and sets the state to STOPPED.
- * <p>
- * If the plugin state is not STARTED this method will have no effect.
- * <p>
- * All plugin bundles not used elsewhere will be stopped.
- *
- * @throws PluginException
- * if any of the plugin bundles cannot be stopped
- */
- public void stop() throws PluginException;
-
- public void uninstall() throws PluginException;
-
- public File getFile();
-
- public Set<Bundle> getBundles();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginException.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginException.java b/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginException.java
deleted file mode 100644
index 6bc3fe0..0000000
--- a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin;
-
-/**
- *
- *
- * @author David Withers
- */
-public class PluginException extends Exception {
-
- public PluginException() {
- }
-
- public PluginException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public PluginException(String message) {
- super(message);
- }
-
- public PluginException(Throwable cause) {
- super(cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginManager.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginManager.java b/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginManager.java
deleted file mode 100644
index e9b2f83..0000000
--- a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginManager.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin;
-
-import java.io.File;
-import java.util.List;
-
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginVersions;
-
-/**
- * Manages installing plugins and checking for plugin updates.
- *
- * @author David Withers
- */
-public interface PluginManager {
-
- public static final String EVENT_TOPIC_ROOT = "uk/org/taverna/commons/plugin/PluginManager/";
- public static final String PLUGIN_INSTALLED = EVENT_TOPIC_ROOT + "PLUGIN_INSTALLED";
- public static final String PLUGIN_UNINSTALLED = EVENT_TOPIC_ROOT + "PLUGIN_UNINSTALLED";
- public static final String UPDATES_AVAILABLE = EVENT_TOPIC_ROOT + "UPDATES_AVAILABLE";
-
- /**
- * Loads plugins from the system and user plugin directories.
- * <p>
- * If the plugins are not already installed they will be installed and started.
- *
- * @throws PluginException
- */
- public void loadPlugins() throws PluginException;
-
- /**
- * Check if there are new versions of installed plugins available.
- * <p>
- * If updates are available and event with topic {@link UPDATES_AVAILABLE} will be posted.
- *
- * @throws PluginException
- */
- public void checkForUpdates() throws PluginException;
-
- /**
- * Returns updated versions of installed plugins.
- * <p>
- * Only plugins that the user has permission to update are returned.
- *
- * @return
- */
- public List<PluginVersions> getPluginUpdates() throws PluginException;
-
- /**
- * Returns new plugins available from all plugin sites.
- *
- * @return new plugins available from all plugin sites.
- * @throws PluginException
- */
- public List<PluginVersions> getAvailablePlugins() throws PluginException;
-
- /**
- * Returns all the installed plugins.
- *
- * @return
- * @throws PluginException
- */
- public List<Plugin> getInstalledPlugins() throws PluginException;
-
- /**
- * Installs a plugin from a plugin file.
- *
- * @param pluginFile
- * the file to install the plugin from
- * @return the installed plugin
- * @throws PluginException
- */
- public Plugin installPlugin(File pluginFile) throws PluginException;
-
- /**
- * Installs a plugin from an update site.
- *
- * @param pluginSiteURL
- * @param pluginFile
- * @return
- * @throws PluginException
- */
- public Plugin installPlugin(String pluginSiteURL, String pluginFile) throws PluginException;
-
- public Plugin updatePlugin(PluginVersions pluginVersions) throws PluginException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSite.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSite.java b/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSite.java
deleted file mode 100644
index 54f8e3b..0000000
--- a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSite.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin;
-
-/**
- * A plugin site specifies the location of a site that contains plugins.
- * <p>
- * There are two types of plugin site:
- * <dl>
- * <dt>SYSTEM</dt>
- * <dd>plugin sites specified by the application profile</dd>
- * <dt>USER</dt>
- * <dd>plugin sites that can be added and removed by the user</dd>
- * </dl>
- *
- * @author David Withers
- */
-public interface PluginSite {
-
- public static enum PluginSiteType {
- SYSTEM, USER
- };
-
- /**
- * Returns the name of the plugin site.
- *
- * @return the name of the plugin site
- */
- public String getName();
-
- /**
- * Returns the URL of the plugin site.
- *
- * @return the URL of the plugin site
- */
- public String getUrl();
-
- /**
- * Returns the type of the plugin site.
- * <p>
- * The type is either {@code SYSTEM} or {@code USER}
- *
- * @return the type of the plugin site
- */
- public PluginSiteType getType();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSiteManager.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSiteManager.java b/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSiteManager.java
deleted file mode 100644
index 8cd32b5..0000000
--- a/taverna-plugin-api/src/main/java/uk/org/taverna/commons/plugin/PluginSiteManager.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin;
-
-import java.net.URL;
-import java.util.List;
-
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginVersions;
-
-/**
- * Manages plugin sites.
- *
- * @author David Withers
- */
-public interface PluginSiteManager {
-
- /**
- * Returns all the managed plugin sites.
- * <p>
- * If there are no plugin sites an empty list is returned.
- *
- * @return all the managed plugin sites
- * @throws PluginException
- */
- public List<PluginSite> getPluginSites();
-
- /**
- * Contacts the plugin site at the specified URL and return a new plugin site.
- *
- * @param pluginSiteURL the plugin site URL
- * @throws PluginException if there is a problem contacting the plugin site
- */
- public PluginSite createPluginSite(URL pluginSiteURL) throws PluginException;
-
- /**
- * Adds a plugin site.
- * <p>
- * If the plugin site already exists this method does nothing.
- *
- * @param pluginSite the plugin site to add
- * @throws PluginException
- */
- public void addPluginSite(PluginSite pluginSite) throws PluginException;
-
- /**
- * Removes a plugin site.
- * <p>
- * If the plugin site does not exist this method does nothing.
- *
- * @param pluginSite the plugin site to remove
- * @throws PluginException
- */
- public void removePluginSite(PluginSite pluginSite) throws PluginException;
-
- /**
- * Returns all the plugins available at the specified plugin site.
- * <p>
- * If no plugins are available an empty list is returned.
- *
- * @param pluginSite
- * the plugin site to contact
- * @return all the plugins available at the specified plugin site
- * @throws PluginException
- * if there is a plroblem contacting the plugin site
- */
- public List<PluginVersions> getPlugins(PluginSite pluginSite) throws PluginException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/pom.xml b/taverna-plugin-impl/pom.xml
deleted file mode 100644
index 488e777..0000000
--- a/taverna-plugin-impl/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-plugin-impl</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Plugin Implementation</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>uk.org.taverna.commons.plugin;provide:=true,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-plugin-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-download-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-app-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${osgi.core.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>${mockito.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginDirectoryWatcher.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginDirectoryWatcher.java b/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginDirectoryWatcher.java
deleted file mode 100644
index 9419d4e..0000000
--- a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginDirectoryWatcher.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import java.io.File;
-
-import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
-import org.apache.commons.io.monitor.FileAlterationMonitor;
-import org.apache.commons.io.monitor.FileAlterationObserver;
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.commons.plugin.Plugin;
-import uk.org.taverna.commons.plugin.PluginException;
-
-/**
- * Watches a plugin directory and adds or removes plugins when plugin files are added or removed
- * from the directory.
- *
- * @author David Withers
- */
-public class PluginDirectoryWatcher extends FileAlterationListenerAdaptor {
-
- private static final Logger logger = Logger.getLogger(PluginDirectoryWatcher.class);
-
- private final PluginManagerImpl pluginManager;
- private final File directory;
-
- private FileAlterationMonitor monitor;
-
- public PluginDirectoryWatcher(PluginManagerImpl pluginManager, File directory) {
- this.pluginManager = pluginManager;
- this.directory = directory;
- FileAlterationObserver observer = new FileAlterationObserver(directory);
- observer.addListener(this);
- monitor = new FileAlterationMonitor();
- monitor.addObserver(observer);
- }
-
- /**
- * Starts watching the plugin directory.
- *
- * @throws PluginException
- */
- public void start() throws PluginException {
- try {
- monitor.start();
- } catch (Exception e) {
- throw new PluginException(String.format("Error starting watch on %1$s.",
- directory.getAbsolutePath()), e);
- }
- }
-
- /**
- * Stops watching the plugin directory.
- *
- * @throws PluginException
- */
- public void stop() throws PluginException {
- try {
- monitor.stop();
- } catch (Exception e) {
- throw new PluginException(String.format("Error stopping watch on %1$s.",
- directory.getAbsolutePath()), e);
- }
- }
-
- @Override
- public void onFileCreate(File file) {
- try {
- Plugin plugin = pluginManager.installPlugin(file);
- plugin.start();
- } catch (PluginException e) {
- logger.warn("Error loading plugin file " + file, e);
- }
- }
-
- @Override
- public void onFileChange(File file) {
- onFileDelete(file);
- onFileCreate(file);
- }
-
- @Override
- public void onFileDelete(File file) {
- pluginManager.uninstallPlugin(file);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginImpl.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginImpl.java b/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginImpl.java
deleted file mode 100644
index 5f31472..0000000
--- a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import static uk.org.taverna.commons.plugin.Plugin.State.STARTED;
-import static uk.org.taverna.commons.plugin.Plugin.State.STOPPED;
-import static uk.org.taverna.commons.plugin.Plugin.State.UNINSTALLED;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-import uk.org.taverna.commons.plugin.Plugin;
-import uk.org.taverna.commons.plugin.PluginException;
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginInfo;
-
-/**
- * @author David Withers
- */
-public class PluginImpl implements Plugin {
-
- private static final Logger logger = Logger.getLogger(PluginImpl.class);
-
- private PluginManagerImpl pluginManager;
-
- private State state = UNINSTALLED;
-
- private File file;
- private String id, name, description, organization;
- private Version version;
- private Set<Bundle> bundles = new HashSet<Bundle>();
-
- public PluginImpl(PluginManagerImpl pluginManager, File file, PluginInfo pluginInfo) {
- this.pluginManager = pluginManager;
- this.file = file;
- id = pluginInfo.getId();
- name = pluginInfo.getName();
- description = pluginInfo.getDescription();
- organization = pluginInfo.getOrganization();
- version = Version.parseVersion(pluginInfo.getVersion());
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getOrganization() {
- return organization;
- }
-
- @Override
- public Version getVersion() {
- return version;
- }
-
- @Override
- public State getState() {
- return state;
- }
-
- void setState(State state) {
- this.state = state;
- }
-
- @Override
- public void start() throws PluginException {
- if (state == STARTED) {
- return;
- }
- if (state == UNINSTALLED) {
- throw new PluginException("Cannot start an uninstalled plugin");
- }
- List<Bundle> startedBundles = new ArrayList<Bundle>();
- for (Bundle bundle : getBundles()) {
- if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) == null) {
- if (bundle.getState() != Bundle.ACTIVE) {
- try {
- bundle.start();
- startedBundles.add(bundle);
- } catch (BundleException e) {
- // clean up by stopping bundles already started
- for (Bundle startedBundle : startedBundles) {
- try {
- startedBundle.stop();
- } catch (BundleException ex) {
- logger.warn("Error unistalling bundle", ex);
- }
- }
- throw new PluginException(String.format("Error starting bundle %1$s",
- bundle.getSymbolicName()), e);
- }
- }
- }
- }
- }
-
- @Override
- public void stop() throws PluginException {
- if (state == STARTED) {
- List<Plugin> installedPlugins = pluginManager.getInstalledPlugins();
- for (Bundle bundle : getBundles()) {
- // check if bundle is used by other plugins
- boolean bundleUsed = false;
- for (Plugin installedPlugin : installedPlugins) {
- if (!installedPlugin.equals(this) && installedPlugin.getState() == STARTED) {
- if (installedPlugin.getBundles().contains(bundle)) {
- bundleUsed = true;
- break;
- }
- }
- }
- if (!bundleUsed) {
- try {
- logger.info("Stopping bundle " + bundle.getSymbolicName());
- bundle.stop();
- } catch (BundleException e) {
- logger.warn(
- String.format("Error stopping bundle %1$s for plugin %2$s",
- bundle.getSymbolicName(), getName()), e);
- }
- }
- }
- state = STOPPED;
- }
- }
-
- @Override
- public void uninstall() throws PluginException {
- if (state != UNINSTALLED) {
- pluginManager.uninstallPlugin(this);
- state = UNINSTALLED;
- }
- }
-
- @Override
- public File getFile() {
- return file;
- }
-
- @Override
- public Set<Bundle> getBundles() {
- return bundles;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginManagerImpl.java b/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginManagerImpl.java
deleted file mode 100644
index 364551c..0000000
--- a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginManagerImpl.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.log4j.Logger;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Version;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-
-import uk.org.taverna.commons.download.DownloadException;
-import uk.org.taverna.commons.download.DownloadManager;
-import uk.org.taverna.commons.plugin.Plugin;
-import uk.org.taverna.commons.plugin.Plugin.State;
-import uk.org.taverna.commons.plugin.PluginException;
-import uk.org.taverna.commons.plugin.PluginManager;
-import uk.org.taverna.commons.plugin.PluginSite;
-import uk.org.taverna.commons.plugin.PluginSiteManager;
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginInfo;
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginVersions;
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * PluginManager implementation.
- *
- * @author David Withers
- */
-public class PluginManagerImpl implements PluginManager {
-
- private static final String DIGEST_ALGORITHM = "MD5";
- private static final String PLUGIN_FILE_NAME = "META-INF/taverna/plugin.xml";
-
- private static final Logger logger = Logger.getLogger(PluginManagerImpl.class);
-
- private EventAdmin eventAdmin;
- private ApplicationConfiguration applicationConfiguration;
- private BundleContext bundleContext;
- private DownloadManager downloadManager;
- private PluginSiteManager pluginSiteManager;
-
- private Map<String, Plugin> installedPlugins = new TreeMap<String, Plugin>();
- private Map<String, PluginVersions> availablePlugins = new TreeMap<String, PluginVersions>();
- private Map<String, PluginVersions> pluginUpdates = new TreeMap<String, PluginVersions>();
-
- private boolean updateAvailablePlugins = true;
-
- private Map<File, PluginDirectoryWatcher> pluginDirectoryWatchers = new HashMap<File, PluginDirectoryWatcher>();
-
- private Set<Bundle> installedBundles = new HashSet<Bundle>();
-
- private Unmarshaller unmarshaller;
-
- public PluginManagerImpl() throws PluginException {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance(PluginInfo.class);
- unmarshaller = jaxbContext.createUnmarshaller();
- } catch (JAXBException e) {
- throw new PluginException("Error creating JAXBContext", e);
- }
- }
-
- @Override
- public void checkForUpdates() throws PluginException {
- boolean updatesFound = false;
- synchronized (pluginUpdates) {
- pluginUpdates.clear();
- for (PluginSite pluginSite : pluginSiteManager.getPluginSites()) {
- List<PluginVersions> plugins = pluginSiteManager.getPlugins(pluginSite);
- for (PluginVersions plugin : plugins) {
- if (installedPlugins.containsKey(plugin.getId())) {
- Plugin installedPlugin = installedPlugins.get(plugin.getId());
- if (installedPlugin.getFile().canWrite()) {
- Version latestVersion = Version.parseVersion(plugin.getLatestVersion()
- .getVersion());
- if (latestVersion.compareTo(installedPlugin.getVersion()) > 0) {
- pluginUpdates.put(plugin.getId(), plugin);
- updatesFound = true;
- }
- }
- }
- }
- }
- }
- if (updatesFound) {
- postEvent(PluginManager.UPDATES_AVAILABLE);
- }
- }
-
- @Override
- public List<PluginVersions> getPluginUpdates() throws PluginException {
- synchronized (pluginUpdates) {
- return new ArrayList<PluginVersions>(pluginUpdates.values());
- }
- }
-
- @Override
- public void loadPlugins() throws PluginException {
- loadPlugins(applicationConfiguration.getSystemPluginDir());
- loadPlugins(applicationConfiguration.getUserPluginDir());
- }
-
- @Override
- public List<PluginVersions> getAvailablePlugins() throws PluginException {
- if (updateAvailablePlugins) {
- synchronized (availablePlugins) {
- availablePlugins = new HashMap<String, PluginVersions>();
- for (PluginSite pluginSite : pluginSiteManager.getPluginSites()) {
- List<PluginVersions> plugins = pluginSiteManager.getPlugins(pluginSite);
- for (PluginVersions plugin : plugins) {
- if (!installedPlugins.containsKey(plugin.getId())) {
- availablePlugins.put(plugin.getId(), plugin);
- }
- }
- }
- }
- updateAvailablePlugins = false;
- }
- return new ArrayList<PluginVersions>(availablePlugins.values());
- }
-
- @Override
- public List<Plugin> getInstalledPlugins() throws PluginException {
- return new ArrayList<Plugin>(installedPlugins.values());
- }
-
- @Override
- public Plugin installPlugin(File pluginFile) throws PluginException {
- // check if already installed
- synchronized (installedPlugins) {
- for (Plugin plugin : installedPlugins.values()) {
- if (plugin.getFile().equals(pluginFile)) {
- return plugin;
- }
- }
- // check plugin file
- if (pluginFile.exists()) {
- new PluginException(String.format("Plugin file %1$s does not exist", pluginFile));
- }
- if (pluginFile.isFile()) {
- new PluginException(String.format("Plugin file %1$s is not a file", pluginFile));
- }
- if (!pluginFile.canRead()) {
- new PluginException(String.format("Plugin file %1$s is not readable", pluginFile));
- }
- // install plugin from plugin file
- logger.info(String.format("Installing plugin from '%s'", pluginFile));
- JarFile jarFile;
- try {
- jarFile = new JarFile(pluginFile);
- } catch (IOException e) {
- throw new PluginException(String.format("Error reading plugin file %1$s",
- pluginFile), e);
- }
- Plugin plugin = installPlugin(jarFile);
- installedPlugins.put(plugin.getId(), plugin);
- availablePlugins.remove(plugin.getId());
- postEvent(PluginManager.PLUGIN_INSTALLED);
- return plugin;
- }
- }
-
- @Override
- public Plugin installPlugin(String pluginSiteURL, String pluginFileName) throws PluginException {
- File pluginFile = getPluginFile(pluginSiteURL, pluginFileName);
- return installPlugin(pluginFile);
- }
-
- @Override
- public Plugin updatePlugin(PluginVersions pluginVersions) throws PluginException {
- String pluginId = pluginVersions.getId();
- String pluginSiteUrl = pluginVersions.getPluginSiteUrl();
- String pluginFile = pluginVersions.getLatestVersion().getFile();
- Plugin plugin = installedPlugins.get(pluginId);
- plugin.stop();
- Plugin newPlugin;
- try {
- newPlugin = installPlugin(pluginSiteUrl, pluginFile);
- } catch (PluginException e) {
- plugin.start();
- throw new PluginException("Failed to update plugin " + pluginId, e);
- }
- synchronized (pluginUpdates) {
- pluginUpdates.remove(pluginId);
- }
- uninstallPlugin(plugin);
- return newPlugin;
- }
-
- void uninstallPlugin(File pluginFile) {
- synchronized (installedPlugins) {
- for (Plugin plugin : installedPlugins.values()) {
- if (plugin.getFile().equals(pluginFile)) {
- uninstallPlugin(plugin);
- break;
- }
- }
- }
- }
-
- void uninstallPlugin(Plugin plugin) {
- synchronized (installedPlugins) {
- if (installedPlugins.containsKey(plugin.getId())) {
- for (Bundle bundle : plugin.getBundles()) {
- if (installedBundles.contains(bundle)) {
- // check if bundle is used by other plugins
- boolean bundleInUse = false;
- for (Plugin installedPlugin : installedPlugins.values()) {
- if (!installedPlugin.equals(plugin)) {
- if (installedPlugin.getBundles().contains(bundle)) {
- bundleInUse = true;
- break;
- }
- }
- }
- if (!bundleInUse) {
- try {
- logger.info("Uninstalling bundle " + bundle.getSymbolicName());
- bundle.uninstall();
- installedBundles.remove(bundle);
- System.out.println("Remove " + bundle.getSymbolicName());
- } catch (BundleException e) {
- logger.warn(String.format(
- "Error uninstalling bundle %1$s for plugin %2$s",
- bundle.getSymbolicName(), plugin.getName()), e);
- }
- }
- }
- }
- installedPlugins.remove(plugin.getId());
- pluginUpdates.remove(plugin.getId());
- updateAvailablePlugins = true;
- postEvent(PluginManager.PLUGIN_UNINSTALLED);
- }
- }
- }
-
- public void loadPlugins(File pluginDir) throws PluginException {
- if (checkPluginDirectory(pluginDir, false)) {
- for (File pluginFile : pluginDir.listFiles()) {
- if (pluginFile.isFile() && pluginFile.canRead() && !pluginFile.isHidden()) {
- try {
- installPlugin(pluginFile).start();
- } catch (PluginException e) {
- logger.warn(String.format("Error loading plugin from '%s'", pluginFile), e);
- }
- }
- }
- }
- startWatchingPluginDirectory(pluginDir);
- }
-
- private Plugin installPlugin(JarFile jarFile) throws PluginException {
- PluginInfo pluginInfo = getPluginInfo(jarFile);
-
- PluginImpl plugin = new PluginImpl(this, new File(jarFile.getName()), pluginInfo);
-
- // check bundles exist in jar
- for (BundleInfo bundleInfo : pluginInfo.getBundle()) {
- // find the bundle in the plugin jar
- JarEntry entry = jarFile.getJarEntry(bundleInfo.getFileName());
- if (entry == null) {
- throw new PluginException(String.format(
- "Plugin file '%1$s' does not contain bundle file '%2$s'.",
- jarFile.getName(), bundleInfo.getFileName()));
- }
- }
-
- // install plugin bundles
- Set<Bundle> pluginBundles = plugin.getBundles();
- for (BundleInfo bundleInfo : pluginInfo.getBundle()) {
- Bundle installedBundle = getInstalledBundle(bundleInfo);
- if (installedBundle == null) {
- // install the bundle from the jar
- JarEntry entry = jarFile.getJarEntry(bundleInfo.getFileName());
- String bundleURL = jarEntryToURL(jarFile, entry);
- try {
- Bundle bundle = bundleContext.installBundle(bundleURL);
- pluginBundles.add(bundle);
- installedBundles.add(bundle);
- System.out.println("Add " + bundle.getSymbolicName());
- } catch (BundleException e) {
- // clean up by removing bundles already installed
- for (Bundle bundle : pluginBundles) {
- try {
- bundle.uninstall();
- installedBundles.remove(bundle);
- } catch (BundleException ex) {
- logger.warn("Error unistalling bundle", ex);
- }
- }
- throw new PluginException(String.format("Error installing bundle file %1$s",
- bundleURL), e);
- }
- } else {
- pluginBundles.add(installedBundle);
- }
- }
- plugin.setState(State.INSTALLED);
- return plugin;
- }
-
- private Bundle getInstalledBundle(BundleInfo bundleInfo) {
- for (Bundle installedBundle : bundleContext.getBundles()) {
- if (installedBundle.getSymbolicName().equals(bundleInfo.getSymbolicName())) {
- org.osgi.framework.Version installedVersion = installedBundle.getVersion();
- if (installedVersion
- .equals(new org.osgi.framework.Version(bundleInfo.getVersion()))) {
- return installedBundle;
- }
- }
- }
- return null;
- }
-
- public PluginInfo getPluginInfo(JarFile jarFile) throws PluginException {
- // TODO check manifest for non standard plugin info file
- JarEntry pluginEntry = jarFile.getJarEntry(PLUGIN_FILE_NAME);
- if (pluginEntry == null) {
- throw new PluginException(String.format(
- "Plugin file '%1$s' does not contain a %2$s file.", jarFile.getName(),
- PLUGIN_FILE_NAME));
- }
- try {
- InputStream inputStream = jarFile.getInputStream(pluginEntry);
- return (PluginInfo) unmarshaller.unmarshal(inputStream);
- } catch (JAXBException e) {
- throw new PluginException(String.format("Error reading plugin file %1$s from %2$s",
- pluginEntry, jarFile.getName()), e);
- } catch (IOException e) {
- throw new PluginException(String.format("Error reading plugin file %1$s from %2$s",
- pluginEntry, jarFile.getName()), e);
- }
- }
-
- private File getPluginFile(String pluginSiteURL, String pluginFileName) throws PluginException {
- File pluginFile = new File(getPluginDirectory(), pluginFileName);
- String pluginFileURL = pluginSiteURL + "/" + pluginFileName;
- try {
- downloadManager.download(new URL(pluginFileURL), pluginFile, DIGEST_ALGORITHM);
- } catch (DownloadException e) {
- throw new PluginException("Error downloading plugin file " + pluginFile, e);
- } catch (MalformedURLException e) {
- throw new PluginException("Invalid plugin file URL " + pluginFileURL, e);
- }
- return pluginFile;
- }
-
- public void startWatchingPluginDirectory(File pluginDir) throws PluginException {
- if (!pluginDirectoryWatchers.containsKey(pluginDir)) {
- pluginDirectoryWatchers.put(pluginDir, new PluginDirectoryWatcher(this, pluginDir));
- }
- pluginDirectoryWatchers.get(pluginDir).start();
- }
-
- public void stopWatchingPluginDirectory(File pluginDir) throws PluginException {
- if (pluginDirectoryWatchers.containsKey(pluginDir)) {
- pluginDirectoryWatchers.get(pluginDir).stop();
- }
- }
-
- private File getPluginDirectory() throws PluginException {
- File systemPluginsDir = applicationConfiguration.getSystemPluginDir();
- if (checkPluginDirectory(systemPluginsDir, true)) {
- return systemPluginsDir;
- }
- File userPluginsDir = applicationConfiguration.getUserPluginDir();
- if (checkPluginDirectory(userPluginsDir, true)) {
- return userPluginsDir;
- }
- throw new PluginException("No plugin directory avaliable");
- }
-
- public void setEventAdmin(EventAdmin eventAdmin) {
- this.eventAdmin = eventAdmin;
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- public void setDownloadManager(DownloadManager downloadManager) {
- this.downloadManager = downloadManager;
- }
-
- public void setPluginSiteManager(PluginSiteManager pluginSiteManager) {
- this.pluginSiteManager = pluginSiteManager;
- }
-
- private boolean checkPluginDirectory(File pluginDirectory, boolean checkWritable) {
- if (pluginDirectory == null) {
- return false;
- }
- if (!pluginDirectory.exists()) {
- logger.debug(String.format("Plugin directory %1$s does not exist", pluginDirectory));
- return false;
- }
- if (!pluginDirectory.isDirectory()) {
- logger.warn(String.format("Plugin directory %1$s is not a directory", pluginDirectory));
- return false;
- }
- if (!pluginDirectory.canRead()) {
- logger.debug(String.format("Plugin directory %1$s is not readable", pluginDirectory));
- return false;
- }
- if (checkWritable && !pluginDirectory.canWrite()) {
- logger.debug(String.format("Plugin directory %1$s is not writeable", pluginDirectory));
- return false;
- }
- return true;
- }
-
- private String jarEntryToURL(JarFile jarFile, JarEntry jarEntry) {
- File file = new File(jarFile.getName());
- return "jar:" + file.toURI() + "!/" + jarEntry.getName();
- }
-
- private void postEvent(String topic) {
- Event event = new Event(topic, new HashMap());
- eventAdmin.postEvent(event);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteImpl.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteImpl.java b/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteImpl.java
deleted file mode 100644
index 6458341..0000000
--- a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import uk.org.taverna.commons.plugin.PluginSite;
-
-/**
- * PluginSite implementation.
- *
- * @author David Withers
- */
-public class PluginSiteImpl implements PluginSite {
-
- private String name, url;
-
- private PluginSiteType type;
-
- public PluginSiteImpl() {
- }
-
- public PluginSiteImpl(String name, String url) {
- this(name, url, PluginSiteType.USER);
- }
-
- public PluginSiteImpl(String name, String url, PluginSiteType type) {
- this.name = name;
- this.url = url;
- this.type = type;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- @Override
- public PluginSiteType getType() {
- return type;
- }
-
- public void setType(PluginSiteType type) {
- this.type = type;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImpl.java b/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImpl.java
deleted file mode 100644
index 1634d98..0000000
--- a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImpl.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.commons.download.DownloadException;
-import uk.org.taverna.commons.download.DownloadManager;
-import uk.org.taverna.commons.plugin.PluginException;
-import uk.org.taverna.commons.plugin.PluginSite;
-import uk.org.taverna.commons.plugin.PluginSite.PluginSiteType;
-import uk.org.taverna.commons.plugin.PluginSiteManager;
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginVersions;
-import uk.org.taverna.commons.plugin.xml.jaxb.Plugins;
-import uk.org.taverna.commons.profile.xml.jaxb.Updates;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * PluginSiteManager implementation.
- *
- * @author David Withers
- */
-public class PluginSiteManagerImpl implements PluginSiteManager {
-
- private static final String PLUGIN_SITES_FILE = "plugin-sites.xml";
- private static final String DIGEST_ALGORITHM = "MD5";
- private static final String PLUGINS_FILE = "plugins.xml";
-
- private static final Logger logger = Logger.getLogger(PluginSiteManagerImpl.class);
-
- private ApplicationConfiguration applicationConfiguration;
- private DownloadManager downloadManager;
-
- private Unmarshaller unmarshaller;
- private Marshaller marshaller;
-
- private List<PluginSite> pluginSites;
-
- public PluginSiteManagerImpl() throws PluginException {
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance(Plugins.class, PluginSites.class);
- unmarshaller = jaxbContext.createUnmarshaller();
- marshaller = jaxbContext.createMarshaller();
- } catch (JAXBException e) {
- throw new PluginException("Error creating JAXBContext", e);
- }
- }
-
- @Override
- public List<PluginSite> getPluginSites() {
- if (pluginSites == null) {
- readPluginSitesFile();
- if (pluginSites == null) {
- pluginSites = new ArrayList<PluginSite>();
- pluginSites.addAll(getSystemPluginSites());
- }
- }
- return pluginSites;
- }
-
- @Override
- public PluginSite createPluginSite(URL pluginSiteURL) throws PluginException {
- try {
- File tempFile = File.createTempFile("plugins", null);
- tempFile.deleteOnExit();
- URL pluginFileURL = new URL(pluginSiteURL + "/" + PLUGINS_FILE);
- downloadManager.download(pluginFileURL, tempFile, DIGEST_ALGORITHM);
- return new PluginSiteImpl("", pluginSiteURL.toExternalForm());
- } catch (MalformedURLException e) {
- throw new PluginException(String.format("Invalid plugin site URL %1$s", pluginSiteURL), e);
- } catch (DownloadException e) {
- throw new PluginException(String.format("Error contacting plugin site at %1$s", pluginSiteURL), e);
- } catch (IOException e) {
- throw new PluginException(String.format("Error contacting plugin site at %1$s", pluginSiteURL), e);
- }
- }
-
- @Override
- public void addPluginSite(PluginSite pluginSite) throws PluginException {
- getPluginSites().add(pluginSite);
- writePluginSitesFile();
- }
-
- @Override
- public void removePluginSite(PluginSite pluginSite) throws PluginException {
- getPluginSites().remove(pluginSite);
- writePluginSitesFile();
- }
-
- @Override
- public List<PluginVersions> getPlugins(PluginSite pluginSite) throws PluginException {
- List<PluginVersions> plugins = new ArrayList<PluginVersions>();
- try {
- URL pluginSiteURL = new URL(pluginSite.getUrl() + "/" + PLUGINS_FILE);
- File pluginsFile = new File(getDataDirectory(), PLUGINS_FILE);
- downloadManager.download(pluginSiteURL, pluginsFile, DIGEST_ALGORITHM);
- Plugins pluginsXML = (Plugins) unmarshaller.unmarshal(pluginsFile);
- for (PluginVersions plugin : pluginsXML.getPlugin()) {
- plugin.setPluginSiteUrl(pluginSite.getUrl());
- plugins.add(plugin);
- }
- } catch (MalformedURLException e) {
- throw new PluginException(String.format("Plugin site %1$s has an invalid location",
- pluginSite.getName()), e);
- } catch (DownloadException e) {
- throw new PluginException(String.format("Error downloading from plugin site %1$s",
- pluginSite.getName()), e);
- } catch (JAXBException e) {
- throw new PluginException(String.format("Error getting plugins from plugin site %1$s",
- pluginSite.getName()), e);
- }
- return plugins;
- }
-
- private List<PluginSite> getSystemPluginSites() {
- List<PluginSite> systemPluginSites = new ArrayList<PluginSite>();
- Updates updates = applicationConfiguration.getApplicationProfile().getUpdates();
- systemPluginSites
- .add(new PluginSiteImpl("", updates.getPluginSite(), PluginSiteType.SYSTEM));
- return systemPluginSites;
- }
-
- private void writePluginSitesFile() {
- File pluginSitesFile = new File(getDataDirectory(), PLUGIN_SITES_FILE);
- try {
- marshaller.marshal(pluginSites, pluginSitesFile);
- } catch (JAXBException e) {
- logger.error("Error writing file " + pluginSitesFile, e);
- }
- }
-
- private void readPluginSitesFile() {
- File pluginSitesFile = new File(getDataDirectory(), PLUGIN_SITES_FILE);
- if (pluginSitesFile.exists()) {
- try {
- pluginSites = new ArrayList<PluginSite>();
- PluginSites pluginSitesStore = (PluginSites) unmarshaller
- .unmarshal(pluginSitesFile);
- for (PluginSiteImpl pluginSiteImpl : pluginSitesStore.getPluginSites()) {
- pluginSites.add(pluginSiteImpl);
- }
- } catch (JAXBException e) {
- logger.error("Error reading file " + pluginSitesFile, e);
- }
- }
- }
-
- private File getDataDirectory() {
- return new File(applicationConfiguration.getApplicationHomeDir(), "plugin-data");
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
- public void setDownloadManager(DownloadManager downloadManager) {
- this.downloadManager = downloadManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSites.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSites.java b/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSites.java
deleted file mode 100644
index 1e5203f..0000000
--- a/taverna-plugin-impl/src/main/java/uk/org/taverna/commons/plugin/impl/PluginSites.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- *
- * @author David Withers
- */
-@XmlRootElement
-public class PluginSites {
-
- private List<PluginSiteImpl> pluginSites;
-
- public List<PluginSiteImpl> getPluginSites() {
- if (pluginSites == null) {
- pluginSites = new ArrayList<PluginSiteImpl>();
- }
- return pluginSites;
- }
-
- public void setPluginSites(List<PluginSiteImpl> pluginSites) {
- this.pluginSites = pluginSites;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context-osgi.xml b/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context-osgi.xml
deleted file mode 100644
index cd235f5..0000000
--- a/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context-osgi.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <service ref="pluginManager" interface="uk.org.taverna.commons.plugin.PluginManager" />
- <service ref="pluginSiteManager" interface="uk.org.taverna.commons.plugin.PluginSiteManager" />
-
- <reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
- <reference id="downloadManager" interface="uk.org.taverna.commons.download.DownloadManager" />
-
- <reference id="eventAdmin" interface="org.osgi.service.event.EventAdmin" />
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context.xml
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context.xml b/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context.xml
deleted file mode 100644
index 7315a1b..0000000
--- a/taverna-plugin-impl/src/main/resources/META-INF/spring/plugin-context.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
-
- <!-- <osgix:cm-properties id="cfg.with.defaults" persistent-id="uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl">
- <prop key="checkIntervalSeconds">300</prop>
- </osgix:cm-properties> -->
-
- <bean id="pluginManager" class="uk.org.taverna.commons.plugin.impl.PluginManagerImpl">
- <property name="eventAdmin" ref="eventAdmin" />
- <property name="applicationConfiguration" ref="applicationConfiguration" />
- <property name="bundleContext" ref="bundleContext" />
- <property name="downloadManager" ref="downloadManager" />
- <property name="pluginSiteManager">
- <ref local="pluginSiteManager" />
- </property>
-
- </bean>
-
- <bean id="pluginSiteManager"
- class="uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl">
- <property name="applicationConfiguration" ref="applicationConfiguration" />
- <property name="downloadManager" ref="downloadManager" />
- <!-- <osgix:managed-properties persistent-id="uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl" /> -->
- </bean>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteImplTest.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteImplTest.java b/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteImplTest.java
deleted file mode 100644
index 02ccb6e..0000000
--- a/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteImplTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package uk.org.taverna.commons.plugin.impl;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import uk.org.taverna.commons.plugin.PluginSite.PluginSiteType;
-
-public class PluginSiteImplTest {
-
- PluginSiteImpl pluginSiteImpl;
- String name, url;
- PluginSiteType type;
-
- @Before
- public void setUp() throws Exception {
- name = "test name";
- url = "test url";
- type = PluginSiteType.SYSTEM;
- pluginSiteImpl = new PluginSiteImpl(name, url, type);
- }
-
- @Test
- public void testPluginSiteImpl() {
- pluginSiteImpl = new PluginSiteImpl();
- }
-
- @Test
- public void testPluginSiteImplStringStringPluginSiteType() {
- pluginSiteImpl = new PluginSiteImpl(null, null, null);
- pluginSiteImpl = new PluginSiteImpl("", "", PluginSiteType.USER);
- }
-
- @Test
- public void testGetName() {
- assertEquals(name, pluginSiteImpl.getName());
- assertEquals(name, pluginSiteImpl.getName());
- }
-
- @Test
- public void testSetName() {
- pluginSiteImpl.setName("name");
- assertEquals("name", pluginSiteImpl.getName());
- }
-
- @Test
- public void testGetUrl() {
- assertEquals(url, pluginSiteImpl.getUrl());
- assertEquals(url, pluginSiteImpl.getUrl());
- }
-
- @Test
- public void testSetUrl() {
- pluginSiteImpl.setName("http://www.example.com/");
- assertEquals("http://www.example.com/", pluginSiteImpl.getName());
- }
-
- @Test
- public void testGetType() {
- assertEquals(type, pluginSiteImpl.getType());
- assertEquals(type, pluginSiteImpl.getType());
- }
-
- @Test
- public void testSetType() {
- pluginSiteImpl.setType(PluginSiteType.USER);
- assertEquals(PluginSiteType.USER, pluginSiteImpl.getType());
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImplTest.java
----------------------------------------------------------------------
diff --git a/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImplTest.java b/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImplTest.java
deleted file mode 100644
index 0ca9485..0000000
--- a/taverna-plugin-impl/src/test/java/uk/org/taverna/commons/plugin/impl/PluginSiteManagerImplTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.plugin.impl;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.commons.download.DownloadException;
-import uk.org.taverna.commons.download.DownloadManager;
-import uk.org.taverna.commons.plugin.PluginException;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class PluginSiteManagerImplTest {
-
- private PluginSiteManagerImpl pluginSiteManager;
- private ApplicationConfiguration applicationConfiguration;
- private DownloadManager downloadManager;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- pluginSiteManager = new PluginSiteManagerImpl();
- applicationConfiguration = mock(ApplicationConfiguration.class);
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#PluginSiteManagerImpl()}.
- * @throws Exception
- */
- @Test
- public void testPluginSiteManagerImpl() throws Exception {
- new PluginSiteManagerImpl();
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#getPluginSites()}.
- */
- @Test
- public void testGetPluginSites() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#createPluginSite(java.net.URL)}.
- * @throws DownloadException
- */
- @Test
- public void testCreatePluginSite() throws Exception {
- downloadManager = mock(DownloadManager.class);
- doNothing().when(downloadManager).download(new URL("file:///"), null, "");
-
- pluginSiteManager.setDownloadManager(downloadManager);
-
- pluginSiteManager.createPluginSite(new URL("file:///"));
-
- }
-
- @Test(expected=PluginException.class)
- public void testCreatePluginSiteDownloadException() throws Exception {
- downloadManager = mock(DownloadManager.class);
- doThrow(DownloadException.class).when(downloadManager).download(new URL("file:///"), null, "");
-
- pluginSiteManager.setDownloadManager(downloadManager);
-
- pluginSiteManager.createPluginSite(new URL("file:///"));
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#addPluginSite(uk.org.taverna.commons.plugin.PluginSite)}.
- */
- @Test
- public void testAddPluginSite() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#removePluginSite(uk.org.taverna.commons.plugin.PluginSite)}.
- */
- @Test
- public void testRemovePluginSite() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#getPlugins(uk.org.taverna.commons.plugin.PluginSite)}.
- */
- @Test
- public void testGetPlugins() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#setApplicationConfiguration(uk.org.taverna.configuration.app.ApplicationConfiguration)}.
- */
- @Test
- public void testSetApplicationConfiguration() {
- fail("Not yet implemented");
- }
-
- /**
- * Test method for {@link uk.org.taverna.commons.plugin.impl.PluginSiteManagerImpl#setDownloadManager(uk.org.taverna.commons.download.DownloadManager)}.
- */
- @Test
- public void testSetDownloadManager() {
- fail("Not yet implemented");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-update-api/pom.xml b/taverna-update-api/pom.xml
deleted file mode 100644
index 2b70a7d..0000000
--- a/taverna-update-api/pom.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-update-api</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Update API</name>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateException.java
----------------------------------------------------------------------
diff --git a/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateException.java b/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateException.java
deleted file mode 100644
index 54019fc..0000000
--- a/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.update;
-
-/**
- * Thrown when an update fails.
- *
- * @author David Withers
- */
-public class UpdateException extends Exception {
-
- private static final long serialVersionUID = -5852543170339969041L;
-
- public UpdateException() {
- }
-
- public UpdateException(String message) {
- super(message);
- }
-
- public UpdateException(Throwable cause) {
- super(cause);
- }
-
- public UpdateException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateManager.java
----------------------------------------------------------------------
diff --git a/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateManager.java b/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateManager.java
deleted file mode 100644
index 29415cc..0000000
--- a/taverna-update-api/src/main/java/uk/org/taverna/commons/update/UpdateManager.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.update;
-
-/**
- * Manager for updating Tavana Applications.
- *
- * @author David Withers
- */
-public interface UpdateManager {
-
- public boolean checkForUpdates() throws UpdateException;
-
- public boolean update() throws UpdateException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-update-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-update-impl/pom.xml b/taverna-update-impl/pom.xml
deleted file mode 100644
index ee081a2..0000000
--- a/taverna-update-impl/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-update-impl</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Update Implementation</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>uk.org.taverna.commons.update;provide:=true,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-update-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-download-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-app-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${osgi.core.version}</version>
- </dependency>
- </dependencies>
-</project>
[4/5] incubator-taverna-osgi git commit: temporarily empty repository
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationUIFactory.java b/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationUIFactory.java
deleted file mode 100644
index 8ff0e8f..0000000
--- a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/ConfigurationUIFactory.java
+++ /dev/null
@@ -1,29 +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 uk.org.taverna.configuration;
-
-import javax.swing.JPanel;
-
-public interface ConfigurationUIFactory {
- public boolean canHandle(String uuid);
- public JPanel getConfigurationPanel();
- public Configurable getConfigurable();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/package.html
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/package.html b/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/package.html
deleted file mode 100644
index cff8d0a..0000000
--- a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Contains classes related to general configuration management.
-</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/proxy/HttpProxyConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/proxy/HttpProxyConfiguration.java b/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/proxy/HttpProxyConfiguration.java
deleted file mode 100644
index 0fa686b..0000000
--- a/taverna-configuration-api/src/main/java/uk/org/taverna/configuration/proxy/HttpProxyConfiguration.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.configuration.proxy;
-
-import uk.org.taverna.configuration.Configurable;
-
-/**
- * The HttpProxyConfiguration handles the configuration of HTTP
- * proxy when Taverna is launched.
- *
- * @author David Withers
- */
-public interface HttpProxyConfiguration extends Configurable {
-
- /**
- * The acceptable values for which proxy values to use
- */
- public static String USE_SYSTEM_PROPERTIES_OPTION = "useSystemProperties";
- public static String USE_NO_PROXY_OPTION = "useNoProxy";
- public static String USE_SPECIFIED_VALUES_OPTION = "useSpecifiedValues";
-
- /**
- * The key within the Properties where the value will indicate which set of
- * proxy values to use
- */
- public static String PROXY_USE_OPTION = "proxyUseOption";
-
- /**
- * The keys within the Properties for the ad hoc Taverna proxy settings
- */
- public static String TAVERNA_PROXY_HOST = "tavernaProxyHost";
- public static String TAVERNA_PROXY_PORT = "tavernaProxyPort";
- public static String TAVERNA_PROXY_USER = "tavernaProxyUser";
- public static String TAVERNA_PROXY_PASSWORD = "tavernaProxyPassword";
- public static String TAVERNA_NON_PROXY_HOSTS = "tavernaNonProxyHosts";
-
- /**
- * The keys within the Properties for the System proxy settings
- */
- public static String SYSTEM_PROXY_HOST = "systemProxyHost";
- public static String SYSTEM_PROXY_PORT = "systemProxyPort";
- public static String SYSTEM_PROXY_USER = "systemProxyUser";
- public static String SYSTEM_PROXY_PASSWORD = "systemProxyPassword";
- public static String SYSTEM_NON_PROXY_HOSTS = "systemNonProxyHosts";
-
- /**
- * The keys within the System Properties that are used for specifying HTTP
- * proxy information
- */
- public static String PROXY_HOST = "http.proxyHost";
- public static String PROXY_PORT = "http.proxyPort";
- public static String PROXY_USER = "http.proxyUser";
- public static String PROXY_PASSWORD = "http.proxyPassword";
- public static String NON_PROXY_HOSTS = "http.nonProxyHosts";
-
- /**
- * Change the System Proxy settings according to the property values.
- */
- public void changeProxySettings();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/AbstractConfigurableTest.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/AbstractConfigurableTest.java b/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/AbstractConfigurableTest.java
deleted file mode 100644
index d679188..0000000
--- a/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/AbstractConfigurableTest.java
+++ /dev/null
@@ -1,244 +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 uk.org.taverna.configuration;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class AbstractConfigurableTest {
-
- private ConfigurationManager manager;
-
- private DummyConfigurable dummyConfigurable;
-
- @Before
- public void setup() throws Exception {
- dummyConfigurable = new DummyConfigurable(manager);
- File f = new File(System.getProperty("java.io.tmpdir"));
- File configTestsDir = new File(f,"configTests");
- if (!configTestsDir.exists()) configTestsDir.mkdir();
- final File d = new File(configTestsDir,UUID.randomUUID().toString());
- d.mkdir();
- manager = new ConfigurationManager() {
- private Map<String, Map<String, String>> store = new HashMap<String, Map<String, String>>();
- @Override
- public void store(Configurable configurable) throws Exception {
- if (configurable != null) {
- store.put(configurable.getUUID(), new HashMap<String, String>(configurable.getInternalPropertyMap()));
- }
- }
-
- @Override
- public void populate(Configurable configurable) throws Exception {
- Map<String, String> map = store.get(configurable.getUUID());
- if (map != null) {
- configurable.clear();
- for (Entry<String, String> entry : map.entrySet()) {
- configurable.setProperty(entry.getKey(), entry.getValue());
- }
- }
- }
-
- };
- dummyConfigurable.restoreDefaults();
- }
-
- @Test
- public void testName() {
- assertEquals("Wrong name","dummyName",dummyConfigurable.getDisplayName());
- }
-
- @Test
- public void testCategory() {
- assertEquals("Wrong category","test",dummyConfigurable.getCategory());
- }
-
- @Test
- public void testUUID() {
- assertEquals("Wrong uuid","cheese",dummyConfigurable.getUUID());
- }
-
- @Test
- public void testGetProperty() {
- assertEquals("Should be john","john",dummyConfigurable.getProperty("name"));
- }
-
- @Test
- public void testSetProperty() {
- assertEquals("Should be blue","blue",dummyConfigurable.getProperty("colour"));
- assertNull("Should be null",dummyConfigurable.getProperty("new"));
-
- dummyConfigurable.setProperty("colour", "red");
- dummyConfigurable.setProperty("new", "new value");
-
- assertEquals("Should be red","red",dummyConfigurable.getProperty("colour"));
- assertEquals("Should be new value","new value",dummyConfigurable.getProperty("new"));
- }
-
- @Test
- public void testDeleteValue() {
- assertEquals("Should be blue","blue",dummyConfigurable.getProperty("colour"));
- assertNull("Should be null",dummyConfigurable.getProperty("new"));
-
- dummyConfigurable.setProperty("new", "new value");
-
- assertEquals("Should be new value","new value",dummyConfigurable.getProperty("new"));
-
- dummyConfigurable.deleteProperty("new");
- dummyConfigurable.deleteProperty("colour");
-
- assertNull("Should be null",dummyConfigurable.getProperty("new"));
- assertNull("Should be null",dummyConfigurable.getProperty("colour"));
- }
-
- @Test
- public void testDeleteValueBySettingNull() {
- assertEquals("Should be blue","blue",dummyConfigurable.getProperty("colour"));
- assertNull("Should be null",dummyConfigurable.getProperty("new"));
-
- dummyConfigurable.setProperty("new", "new value");
-
- assertEquals("Should be new value","new value",dummyConfigurable.getProperty("new"));
-
- dummyConfigurable.setProperty("new",null);
- dummyConfigurable.setProperty("colour",null);
-
- assertNull("Should be null",dummyConfigurable.getProperty("new"));
- assertNull("Should be null",dummyConfigurable.getProperty("colour"));
- }
-
- @Test
- public void testRestoreDefaults() {
- assertEquals("There should be 2 values",2,dummyConfigurable.getInternalPropertyMap().size());
-
- dummyConfigurable.setProperty("colour", "red");
- dummyConfigurable.setProperty("new", "new value");
-
- assertEquals("There should be 3 values",3,dummyConfigurable.getInternalPropertyMap().size());
-
- dummyConfigurable.restoreDefaults();
-
- assertEquals("There should be 2 values",2,dummyConfigurable.getInternalPropertyMap().size());
-
- assertEquals("Should be john","john",dummyConfigurable.getProperty("name"));
- assertEquals("Should be john","blue",dummyConfigurable.getProperty("colour"));
- }
-
- @Test
- public void testList() throws Exception {
- AbstractConfigurable c = dummyConfigurable;
- c.getInternalPropertyMap().clear();
- c.setPropertyStringList("list", new ArrayList<String>());
-
- manager.store(c);
- assertTrue("Should be an instanceof a list",c.getPropertyStringList("list") instanceof List);
- assertEquals("there should be 0 items",0,c.getPropertyStringList("list").size());
- manager.populate(c);
-
- assertTrue("Should be an instanceof a list",c.getPropertyStringList("list") instanceof List);
- assertEquals("there should be 0 items",0,c.getPropertyStringList("list").size());
-
- List<String> list = new ArrayList<String>(c.getPropertyStringList("list"));
- list.add("fred");
- c.setPropertyStringList("list", list);
- assertEquals("there should be 1 item",1,c.getPropertyStringList("list").size());
-
- manager.store(c);
- assertEquals("there should be 1 item",1,c.getPropertyStringList("list").size());
- manager.populate(c);
-
- assertEquals("there should be 1 item",1,c.getPropertyStringList("list").size());
- assertEquals("item should be fred","fred",c.getPropertyStringList("list").get(0));
-
- c.getInternalPropertyMap().clear();
- c.setProperty("list", "a,b,c");
- assertEquals("There should be 3 items in the list",3,c.getPropertyStringList("list").size());
- assertEquals("Item 1 should be a","a",c.getPropertyStringList("list").get(0));
- assertEquals("Item 1 should be b","b",c.getPropertyStringList("list").get(1));
- assertEquals("Item 1 should be c","c",c.getPropertyStringList("list").get(2));
-
- }
-
- @Test
- public void testListNotThere() throws Exception {
- AbstractConfigurable c = dummyConfigurable;
- c.getInternalPropertyMap().clear();
- assertNull("the property should be null",c.getProperty("sdflhsdfhsdfjkhsdfkhsdfkhsdfjkh"));
- assertNull("the list should be null if the property doesn't exist",c.getPropertyStringList("sdflhsdfhsdfjkhsdfkhsdfkhsdfjkh"));
- }
-
- @Test
- public void testListDelimeters() throws Exception {
- AbstractConfigurable c = dummyConfigurable;
- c.getInternalPropertyMap().clear();
- c.setPropertyStringList("list", new ArrayList<String>());
-
- assertTrue("Should be an instanceof a list",c.getPropertyStringList("list") instanceof List);
- assertEquals("there should be 0 items",0,((List<String>)c.getPropertyStringList("list")).size());
-
- List<String> list = new ArrayList<String>(c.getPropertyStringList("list"));
- list.add("a,b,c");
- c.setPropertyStringList("list",list);
- assertEquals("there should be 1 items",1,((List<String>)c.getPropertyStringList("list")).size());
-
- list = new ArrayList<String>(c.getPropertyStringList("list"));
- list.add("d");
- c.setPropertyStringList("list",list);
- assertEquals("there should be 2 items",2,((List<String>)c.getPropertyStringList("list")).size());
- assertEquals("The first item should be a,b,c","a,b,c",c.getPropertyStringList("list").get(0));
- assertEquals("The second item should be d","d",c.getPropertyStringList("list").get(1));
-
- manager.store(c);
- assertEquals("there should be 2 items",2,((List<String>)c.getPropertyStringList("list")).size());
- assertEquals("The first item should be a,b,c","a,b,c",c.getPropertyStringList("list").get(0));
- assertEquals("The second item should be d","d",c.getPropertyStringList("list").get(1));
-
- manager.populate(c);
- assertEquals("there should be 2 items",2,((List<String>)c.getPropertyStringList("list")).size());
-
- assertEquals("The first item should be a,b,c","a,b,c",c.getPropertyStringList("list").get(0));
- assertEquals("The second item should be d","d",c.getPropertyStringList("list").get(1));
-
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testUnmodifiable() throws Exception {
-
- AbstractConfigurable c = dummyConfigurable;
- c.getInternalPropertyMap().clear();
- c.setPropertyStringList("list", new ArrayList<String>());
- c.getPropertyStringList("list").add("fred");
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/DummyConfigurable.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/DummyConfigurable.java b/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/DummyConfigurable.java
deleted file mode 100644
index 1f77ca6..0000000
--- a/taverna-configuration-api/src/test/java/uk/org/taverna/configuration/DummyConfigurable.java
+++ /dev/null
@@ -1,65 +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 uk.org.taverna.configuration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-
-public class DummyConfigurable extends AbstractConfigurable {
-
- public DummyConfigurable(ConfigurationManager configurationManager) {
- super(configurationManager);
- }
-
- Map<String,String> defaults = null;
-
- public String getCategory() {
- return "test";
- }
-
- public Map<String, String> getDefaultPropertyMap() {
- if (defaults==null) {
- defaults = new HashMap<String, String>();
- defaults.put("name","john");
- defaults.put("colour","blue");
- }
- return defaults;
- }
-
- public String getUUID() {
- return "cheese";
- }
-
- public String getDisplayName() {
- return "dummyName";
- }
-
- public String getFilePrefix() {
- return "dummyPrefix";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/.project
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/.project b/taverna-configuration-impl/.project
deleted file mode 100644
index 2bd6978..0000000
--- a/taverna-configuration-impl/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>taverna-configuration-impl</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/pom.xml b/taverna-configuration-impl/pom.xml
deleted file mode 100644
index 79143c9..0000000
--- a/taverna-configuration-impl/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-configuration-impl</artifactId>
- <name>Apache Taverna Configuration implementation</name>
- <packaging>bundle</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>
- uk.org.taverna.configuration;provide:=true,
- uk.org.taverna.configuration.proxy;provide:=true,*
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-app-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
-<!--
- <dependency>
- <groupId>net.sf.taverna</groupId>
- <artifactId>wsdl-generic</artifactId>
- <version>${wsdl.generic.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis</groupId>
- <artifactId>com.springsource.org.apache.axis</artifactId>
- <version>${axis.version}</version>
- </dependency>
- -->
-
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-configuration-api</artifactId>
- <version>${project.parent.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/impl/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/impl/ConfigurationManagerImpl.java b/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/impl/ConfigurationManagerImpl.java
deleted file mode 100644
index 823155c..0000000
--- a/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/impl/ConfigurationManagerImpl.java
+++ /dev/null
@@ -1,153 +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 uk.org.taverna.configuration.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * Handles the configuration for a {@link Configurable} object
- *
- * @author Ian Dunlop
- * @author Stuart Owen
- */
-public class ConfigurationManagerImpl implements ConfigurationManager {
-
- private static final Logger logger = Logger.getLogger(ConfigurationManagerImpl.class);
-
- private File baseConfigLocation;
-
- public ConfigurationManagerImpl(ApplicationConfiguration applicationConfiguration) {
- File home = applicationConfiguration.getApplicationHomeDir();
- File config = new File(home,"conf");
- if (!config.exists()) {
- config.mkdir();
- }
- setBaseConfigLocation(config);
- }
-
- /**
- * Write out the properties configuration to disk based on the UUID of the
- * {@link Configurable}
- * <br>
- * Default values are not stored within the file, but only those that have been changed or deleted.
- *
- * @param configurable
- * @throws Exception
- */
- @Override
- public void store(Configurable configurable) throws Exception {
- try {
-
- Map<String, String> propertyMap = configurable.getInternalPropertyMap();
- Properties props = new Properties();
- for (String key : propertyMap.keySet()) {
- if (!propertyMap.get(key).equals(configurable.getDefaultProperty(key))) {
- props.put(key, propertyMap.get(key));
- }
- }
- File configFile = new File(baseConfigLocation,generateFilename(configurable));
- logger.info("Storing configuration for "+configurable.getFilePrefix()+" to "+configFile.getAbsolutePath());
- props.store(new FileOutputStream(configFile), "");
- } catch (Exception e) {
- throw new Exception("Configuration storage failed: " + e);
- }
- }
-
-
-
- /**
- * Loads the configuration details from disk or from memory and populates the provided Configurable
- *
- * @param configurable
- * @return
- * @throws Exception
- * if there are no configuration details available
- */
- @Override
- public void populate(Configurable configurable)
- throws Exception {
- try {
- File configFile = new File(baseConfigLocation,generateFilename(configurable));
- if (configFile.exists()) {
- Properties props = new Properties();
- props.load(new FileInputStream(configFile));
- configurable.clear();
- for (Object key : props.keySet()) {
- configurable.setProperty(key.toString(), props.getProperty(key.toString()));
- }
- }
- else {
- logger.info("Config file for "+configurable.getFilePrefix()+" not yet created. Creating with default values.");
- configurable.restoreDefaults();
- store(configurable);
- }
-
- } catch (Exception e) {
- logger.error("There was a error reading the configuration file for "+configurable.getFilePrefix()+", using defaults",e);
- configurable.restoreDefaults();
- }
- }
-
- protected String generateFilename(Configurable configurable) {
- return configurable.getFilePrefix()+"-"+configurable.getUUID() + ".config";
- }
-
- public boolean isBaseLocationSet() {
- return baseConfigLocation!=null;
- }
-
- /**
- * Where the config files are being stored
- *
- * @return
- * @throws Exception
- */
- public File getBaseConfigLocation() throws Exception {
- if (isBaseLocationSet()) {
- return baseConfigLocation;
- } else {
- throw new Exception("Set location first");
- }
- }
-
- /**
- * Where should the config files be stored
- *
- * @return
- * @throws Exception
- */
- public void setBaseConfigLocation(File baseConfigLocation) {
- // TODO if this is a different place than before then copy all the
- // config files to this new place
- this.baseConfigLocation = baseConfigLocation;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/proxy/impl/HttpProxyConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/proxy/impl/HttpProxyConfigurationImpl.java b/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/proxy/impl/HttpProxyConfigurationImpl.java
deleted file mode 100644
index ddcdf65..0000000
--- a/taverna-configuration-impl/src/main/java/uk/org/taverna/configuration/proxy/impl/HttpProxyConfigurationImpl.java
+++ /dev/null
@@ -1,166 +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 uk.org.taverna.configuration.proxy.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-//import org.apache.axis.AxisProperties;
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
-
-/**
- * The HttpProxyConfiguration handles the configuration of HTTP
- * proxy when Taverna is launched.
- *
- * @author alanrw
- * @author David Withers
- */
-public class HttpProxyConfigurationImpl extends AbstractConfigurable implements
- HttpProxyConfiguration {
-
- private Map<String, String> defaultPropertyMap;
-
- /**
- * A Properties that holds the original System settings for HTTP proxy. They
- * need to be copied as they are overwritten if something other than those
- * System settings are used.
- */
- private Properties originalSystemSettings;
-
- private static Logger logger = Logger.getLogger(HttpProxyConfigurationImpl.class);
-
- /**
- * Read the original System settings. Read the configuration file and set
- * the proxy settings accordingly.
- */
- private HttpProxyConfigurationImpl(ConfigurationManager configurationManager) {
- super(configurationManager);
- changeProxySettings();
- }
-
- /**
- * Return the original System property value for the specified key. Null of
- * no such property existed.
- *
- * @param key
- * @return
- */
- public String getOriginalSystemSetting(String key) {
- if (originalSystemSettings == null) {
- originalSystemSettings = new Properties();
- originalSystemSettings.putAll(System.getProperties());
- }
- return originalSystemSettings.getProperty(key);
- }
-
- @Override
- public void changeProxySettings() {
- String option = getProperty(PROXY_USE_OPTION);
- if (option.equals(USE_SYSTEM_PROPERTIES_OPTION)) {
- changeSystemProperty(PROXY_HOST, getOriginalSystemSetting(PROXY_HOST));
- changeSystemProperty(PROXY_PORT, getOriginalSystemSetting(PROXY_PORT));
- changeSystemProperty(PROXY_USER, getOriginalSystemSetting(PROXY_USER));
- changeSystemProperty(PROXY_PASSWORD, getOriginalSystemSetting(PROXY_PASSWORD));
- changeSystemProperty(NON_PROXY_HOSTS, getOriginalSystemSetting(NON_PROXY_HOSTS));
- } else if (option.equals(USE_NO_PROXY_OPTION)) {
- changeSystemProperty(PROXY_HOST, null);
- changeSystemProperty(PROXY_PORT, null);
- changeSystemProperty(PROXY_USER, null);
- changeSystemProperty(PROXY_PASSWORD, null);
- changeSystemProperty(NON_PROXY_HOSTS, null);
- } else if (option.equals(USE_SPECIFIED_VALUES_OPTION)) {
- changeSystemProperty(PROXY_HOST, getProperty(TAVERNA_PROXY_HOST));
- changeSystemProperty(PROXY_PORT, getProperty(TAVERNA_PROXY_PORT));
- changeSystemProperty(PROXY_USER, getProperty(TAVERNA_PROXY_USER));
- changeSystemProperty(PROXY_PASSWORD, getProperty(TAVERNA_PROXY_PASSWORD));
- changeSystemProperty(NON_PROXY_HOSTS, getProperty(TAVERNA_NON_PROXY_HOSTS));
- }
- logger.info(PROXY_HOST + " is " + System.getProperty(PROXY_HOST));
- logger.info(PROXY_PORT + " is " + System.getProperty(PROXY_PORT));
- logger.info(PROXY_USER + " is " + System.getProperty(PROXY_USER));
- logger.info(NON_PROXY_HOSTS + " is " + System.getProperty(NON_PROXY_HOSTS));
- }
-
- /**
- * Change the specified System property to the given value. If the value is
- * null then the property is cleared.
- *
- * @param key
- * @param value
- */
- private void changeSystemProperty(String key, String value) {
- if ((value == null) || value.equals("")) {
- System.clearProperty(key);
- } else {
- System.setProperty(key, value);
- }
- //AxisProperties.setProperty(key, (value == null ? "" : value));
- }
-
- @Override
- public Map<String, String> getDefaultPropertyMap() {
- if (defaultPropertyMap == null) {
- defaultPropertyMap = new HashMap<String, String>();
- defaultPropertyMap.put(PROXY_USE_OPTION, USE_SYSTEM_PROPERTIES_OPTION);
- String proxyHost = getOriginalSystemSetting(PROXY_HOST);
- defaultPropertyMap.put(SYSTEM_PROXY_HOST, proxyHost == null ? "" : proxyHost);
- String proxyPort = getOriginalSystemSetting(PROXY_PORT);
- defaultPropertyMap.put(SYSTEM_PROXY_PORT, proxyPort == null ? "" : proxyPort);
- String proxyUser = getOriginalSystemSetting(PROXY_USER);
- defaultPropertyMap.put(SYSTEM_PROXY_USER, proxyUser == null ? "" : proxyUser);
- String proxyPassword = getOriginalSystemSetting(PROXY_PASSWORD);
- defaultPropertyMap.put(SYSTEM_PROXY_PASSWORD, proxyPassword == null ? "" : proxyPassword);
- String nonProxyHosts = getOriginalSystemSetting(NON_PROXY_HOSTS);
- defaultPropertyMap.put(SYSTEM_NON_PROXY_HOSTS, nonProxyHosts == null ? "" : nonProxyHosts);
- defaultPropertyMap.put(TAVERNA_PROXY_HOST, "");
- defaultPropertyMap.put(TAVERNA_PROXY_PORT, "");
- defaultPropertyMap.put(TAVERNA_PROXY_USER, "");
- defaultPropertyMap.put(TAVERNA_PROXY_PASSWORD, "");
- defaultPropertyMap.put(TAVERNA_NON_PROXY_HOSTS, "");
- }
- return defaultPropertyMap;
- }
-
- @Override
- public String getUUID() {
- return "B307A902-F292-4D2F-B8E7-00CC983982B6";
- }
-
- @Override
- public String getDisplayName() {
- return "HTTP proxy";
- }
-
- @Override
- public String getFilePrefix() {
- return "HttpProxy";
- }
-
- @Override
- public String getCategory() {
- return "general";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml b/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml
deleted file mode 100644
index 0236d73..0000000
--- a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context-osgi.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <service ref="configurationManager" interface="uk.org.taverna.configuration.ConfigurationManager" />
- <service ref="httpProxyConfiguration" interface="uk.org.taverna.configuration.proxy.HttpProxyConfiguration" />
-
- <reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml b/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml
deleted file mode 100644
index c797a8d..0000000
--- a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-context.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="configurationManager" class="uk.org.taverna.configuration.impl.ConfigurationManagerImpl" >
- <constructor-arg name="applicationConfiguration" ref="applicationConfiguration" />
- </bean>
-
- <bean id="httpProxyConfiguration" class="uk.org.taverna.configuration.proxy.impl.HttpProxyConfigurationImpl">
- <constructor-arg name="configurationManager" ref="configurationManager" />
- </bean>
-
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/ConfigurationManagerImplTest.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/ConfigurationManagerImplTest.java b/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/ConfigurationManagerImplTest.java
deleted file mode 100644
index e09ffb6..0000000
--- a/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/ConfigurationManagerImplTest.java
+++ /dev/null
@@ -1,182 +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 uk.org.taverna.configuration.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-import java.util.UUID;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.DummyConfigurable;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-public class ConfigurationManagerImplTest {
-
- private File configFile;
-
- private ConfigurationManagerImpl manager;
-
- private DummyConfigurable dummyConfigurable;
-
- @Before
- public void setup() throws Exception {
- dummyConfigurable = new DummyConfigurable(manager);
- File f = new File(System.getProperty("java.io.tmpdir"));
- File configTestsDir = new File(f, "configTests");
- if (!configTestsDir.exists())
- configTestsDir.mkdir();
- final File d = new File(configTestsDir, UUID.randomUUID().toString());
- d.mkdir();
- manager = new ConfigurationManagerImpl(new ApplicationConfiguration() {
- public File getApplicationHomeDir() {
- return d;
- }
-
- public String getName() {
- return null;
- }
-
- public String getTitle() {
- return null;
- }
-
- public File getStartupDir() {
- return null;
- }
-
- public File getUserPluginDir() {
- return null;
- }
-
- public File getSystemPluginDir() {
- return null;
- }
-
- public File getLogFile() {
- return null;
- }
-
- public File getLogDir() {
- return null;
- }
-
- public Properties getProperties() {
- return null;
- }
-
- @Override
- public ApplicationProfile getApplicationProfile() {
- // TODO Auto-generated method stub
- return null;
- }
- });
- configFile = new File(d, "conf/"+manager.generateFilename(dummyConfigurable));
- dummyConfigurable.restoreDefaults();
- }
-
- @Test
- public void testStore() throws Exception {
- Configurable conf = dummyConfigurable;
- manager.store(conf);
- assertTrue(configFile.exists());
- }
-
- @Test
- public void testDefaultValues() throws Exception {
- Configurable conf = dummyConfigurable;
- assertEquals("name should equal john", "john", conf.getProperty("name"));
- manager.store(conf);
- Properties props = new Properties();
- props.load(new FileInputStream(configFile));
- assertFalse("stored properties should not contain the default value",
- props.containsKey("name"));
- manager.populate(conf);
- assertEquals("default property name should still exist after re-populating", "john",
- conf.getProperty("name"));
- }
-
- @Test
- public void testRemoveNotDefaultValue() throws Exception {
- Configurable conf = dummyConfigurable;
- conf.setProperty("hhh", "iii");
- manager.store(conf);
- Properties props = new Properties();
- props.load(new FileInputStream(configFile));
- assertEquals("The stored file should contain the new entry", "iii", props.get("hhh"));
- conf.deleteProperty("hhh");
- manager.store(conf);
- manager.populate(conf);
- assertNull("The removed value should no longer exist", conf.getProperty("hhh"));
- props.clear();
- props.load(new FileInputStream(configFile));
- assertNull("The stored file should no longer contain the deleted entry", props.get("hhh"));
- }
-
- @Test
- public void testNewValues() throws Exception {
- Configurable conf = dummyConfigurable;
- conf.setProperty("country", "france");
- assertEquals("country should equal france", "france", conf.getProperty("country"));
- manager.store(conf);
- Properties props = new Properties();
- props.load(new FileInputStream(configFile));
- assertTrue("stored properties should contain the default value",
- props.containsKey("country"));
- assertEquals("stored property country should equal france", "france",
- props.getProperty("country"));
- manager.populate(conf);
- assertEquals("default property name should still exist after re-populating", "france",
- conf.getProperty("country"));
- }
-
- @Test
- public void testDeleteDefaultProperty() throws Exception {
- AbstractConfigurable conf = dummyConfigurable;
- assertEquals("name should equal john", "john", conf.getProperty("name"));
- conf.deleteProperty("name");
- manager.store(conf);
- manager.populate(conf);
- assertNull("value for name should be null", conf.getProperty("name"));
-
- Properties props = new Properties();
- props.load(new FileInputStream(configFile));
- assertTrue("Key name should be in stored props because its a deleted default value",
- props.containsKey("name"));
- assertEquals("name should have the special value to indicate its been deleted",
- AbstractConfigurable.DELETED_VALUE_CODE, props.getProperty("name"));
- }
-
- @Test
- public void testFilename() {
- assertTrue(configFile.getAbsolutePath().endsWith("dummyPrefix-cheese.config"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory1.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory1.java b/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory1.java
deleted file mode 100644
index 3cbd1ae..0000000
--- a/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory1.java
+++ /dev/null
@@ -1,126 +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 uk.org.taverna.configuration.impl;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-public class DummyUIFactory1 implements ConfigurationUIFactory {
-
- public boolean canHandle(String uuid) {
- return getConfigurable().getUUID().equals(uuid);
- }
-
- public Configurable getConfigurable() {
- return new DummyConfigurable1();
- }
-
- public JPanel getConfigurationPanel() {
- return new JPanel();
- }
-
- static class DummyConfigurable1 implements Configurable {
-
- public void deleteProperty(String key) {
- // TODO Auto-generated method stub
-
- }
-
- public String getCategory() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<String, String> getDefaultPropertyMap() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getProperty(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<String, String> getInternalPropertyMap() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getPropertyStringList(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getUUID() {
- return "123";
- }
-
- public void restoreDefaults() {
- // TODO Auto-generated method stub
-
- }
-
- public void setProperty(String key, String value) {
- // TODO Auto-generated method stub
-
- }
-
- public void setPropertyStringList(String key, List<String> value) {
- // TODO Auto-generated method stub
-
- }
-
- public String getDefaultProperty(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void clear() {
- // TODO Auto-generated method stub
-
- }
-
- public Set<String> getKeys() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getDisplayName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getFilePrefix() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory2.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory2.java b/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory2.java
deleted file mode 100644
index b6b3269..0000000
--- a/taverna-configuration-impl/src/test/java/uk/org/taverna/configuration/impl/DummyUIFactory2.java
+++ /dev/null
@@ -1,126 +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 uk.org.taverna.configuration.impl;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-public class DummyUIFactory2 implements ConfigurationUIFactory {
-
- public boolean canHandle(String uuid) {
- return getConfigurable().getUUID().equals(uuid);
- }
-
- public Configurable getConfigurable() {
- return new DummyConfigurable2();
- }
-
- public JPanel getConfigurationPanel() {
- // TODO Auto-generated method stub
- return null;
- }
-
- static class DummyConfigurable2 implements Configurable {
-
- public void deleteProperty(String key) {
- // TODO Auto-generated method stub
-
- }
-
- public String getCategory() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<String, String> getDefaultPropertyMap() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getProperty(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<String, String> getInternalPropertyMap() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getPropertyStringList(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getUUID() {
- return "456";
- }
-
- public void restoreDefaults() {
- // TODO Auto-generated method stub
-
- }
-
- public void setProperty(String key, String value) {
- // TODO Auto-generated method stub
-
- }
-
- public void setPropertyStringList(String key, List<String> value) {
- // TODO Auto-generated method stub
-
- }
-
- public String getDefaultProperty(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void clear() {
- // TODO Auto-generated method stub
-
- }
-
- public Set<String> getKeys() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getDisplayName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getFilePrefix() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-download-api/pom.xml b/taverna-download-api/pom.xml
deleted file mode 100644
index b5dbcd7..0000000
--- a/taverna-download-api/pom.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <packaging>bundle</packaging>
- <artifactId>taverna-download-api</artifactId>
- <name>Apache Taverna Download API</name>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadException.java
----------------------------------------------------------------------
diff --git a/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadException.java b/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadException.java
deleted file mode 100644
index 83c5e74..0000000
--- a/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.download;
-
-/**
- *
- *
- * @author David Withers
- */
-public class DownloadException extends Exception {
-
- public DownloadException() {
- }
-
- public DownloadException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public DownloadException(String message) {
- super(message);
- }
-
- public DownloadException(Throwable cause) {
- super(cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadManager.java
----------------------------------------------------------------------
diff --git a/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadManager.java b/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadManager.java
deleted file mode 100644
index a94389c..0000000
--- a/taverna-download-api/src/main/java/uk/org/taverna/commons/download/DownloadManager.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.download;
-
-import java.io.File;
-import java.net.URL;
-
-/**
- * Download Manager for handling file download and checking the integrity of the download.
- *
- * @author David Withers
- */
-public interface DownloadManager {
-
- /**
- * Downloads a file from a URL.
- * <p>
- * The destination file will be created if it does not exist. If it does exist it will be
- * overwritten.
- *
- * @param source
- * the file to download
- * @param destination
- * the file to write to
- * @throws DownloadException
- * if
- * <ul>
- * <li>the source does not exist</li> <li>the source cannot be downloaded</li> <li>
- * the destination is not a file</li> <li>the destination cannot be written to</li>
- * </ul>
- */
- public void download(URL source, File destination) throws DownloadException;
-
- /**
- * Downloads a file from a URL and checks the integrity of the download by downloading and
- * verifying the a checksum using the specified algorithm.
- * <p>
- * Every implementation is required to support the following standard algorithms:
- * <ul>
- * <li>MD5</li>
- * <li>SHA-1</li>
- * <li>SHA-256</li>
- * </ul>
- * <p>
- * The checksum source will be calculated by appending the algorithm name to the source. e.g.
- * for an MD5 algorithm and a source of http://www.example.com/test.xml the checksum will be
- * downloaded from http://www.example.com/test.xml.md5
- *
- * @param source
- * the file to download
- * @param destination
- * the file to write to
- * @param digestAlgorithm
- * the digest algorithm to use
- * @throws DownloadException
- * if
- * <ul>
- * <li>the source does not exist</li> <li>the digest source does not exist</li> <li>
- * the source cannot be downloaded</li> <li>the destination cannot be written to
- * </li> <li>the destination is not a file</li> <li>the checksums do no match</li>
- * </ul>
- */
- public void download(URL source, File destination, String digestAlgorithm)
- throws DownloadException;
-
- /**
- * Downloads a file from a URL and checks the integrity of the download by downloading and
- * verifying the a checksum using the specified algorithm.
- * <p>
- * Every implementation is required to support the following standard algorithms:
- * <ul>
- * <li>MD5</li>
- * <li>SHA-1</li>
- * <li>SHA-256</li>
- * </ul>
- * <p>
- *
- * @param source
- * the file to download
- * @param destination
- * the file to write to
- * @param digestAlgorithm
- * the digest algorithm to use
- * @param digestSource
- * the digest file to check
- * @throws DownloadException
- * if
- * <ul>
- * <li>the source does not exist</li> <li>the digest source does not exist</li>
- * <li> the source cannot be downloaded</li> <li>the destination cannot be
- * written to</li> <li>the destination is not a file</li> <li>the digestSource
- * does not exist</li> <li>the checksums do no match</li>
- * </ul>
- */
- public void download(URL source, File destination, String digestAlgorithm, URL digestSource)
- throws DownloadException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-download-impl/pom.xml b/taverna-download-impl/pom.xml
deleted file mode 100644
index c472494..0000000
--- a/taverna-download-impl/pom.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <packaging>bundle</packaging>
- <artifactId>taverna-download-impl</artifactId>
- <name>Apache Taverna Download implementation</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>uk.org.taverna.commons.download;provide:=true,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-download-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons.codec.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-impl/src/main/java/uk/org/taverna/commons/download/impl/DownloadManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-download-impl/src/main/java/uk/org/taverna/commons/download/impl/DownloadManagerImpl.java b/taverna-download-impl/src/main/java/uk/org/taverna/commons/download/impl/DownloadManagerImpl.java
deleted file mode 100644
index 5fc42d9..0000000
--- a/taverna-download-impl/src/main/java/uk/org/taverna/commons/download/impl/DownloadManagerImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package uk.org.taverna.commons.download.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.commons.download.DownloadException;
-import uk.org.taverna.commons.download.DownloadManager;
-
-/**
- *
- *
- * @author David Withers
- */
-public class DownloadManagerImpl implements DownloadManager {
-
- private static final Logger logger = Logger.getLogger(DownloadManagerImpl.class);
-
- public void download(URL source, File destination) throws DownloadException {
- download(source, destination, null);
- }
-
- public void download(URL source, File destination, String digestAlgorithm) throws DownloadException {
- // TODO Use MessageDigest when Java 7 available
- if (digestAlgorithm != null && !digestAlgorithm.equals("MD5")) {
- throw new IllegalArgumentException("Only MD5 supported");
- }
- URL digestSource = null;
- if (digestAlgorithm != null) {
- try {
- digestSource = new URL(source.toString() + mapAlgorithmToFileExtension(digestAlgorithm));
- } catch (MalformedURLException e) {
- throw new DownloadException("Error creating digest URL", e);
- }
- }
- download(source, destination, digestAlgorithm, digestSource);
- }
-
- public void download(URL source, File destination, String digestAlgorithm, URL digestSource)
- throws DownloadException {
- // TODO Use MessageDigest when Java 7 available
- if (digestAlgorithm != null && !digestAlgorithm.equals("MD5")) {
- throw new IllegalArgumentException("Only MD5 supported");
- }
- // download the file
- File tempFile;
- try {
- tempFile = File.createTempFile("DownloadManager", "tmp");
- tempFile.deleteOnExit();
- logger.info(String.format("Downloading %1$s to %2$s", source, tempFile));
- FileUtils.copyURLToFile(source, tempFile, 30, 30);
- } catch (IOException e) {
- throw new DownloadException(String.format("Error downloading %1$s to %2$s.", source, destination), e);
- }
- if (digestSource != null) {
- // download the digest file
- File digestFile;
- try {
- digestFile = File.createTempFile("DownloadManager", "tmp");
- digestFile.deleteOnExit();
- logger.info(String.format("Downloading %1$s to %2$s", digestSource, digestFile));
- FileUtils.copyURLToFile(digestSource, digestFile, 30, 30);
- } catch (IOException e) {
- throw new DownloadException(String.format("Error checking digest for %1$s.", source), e);
- }
- // check the digest matches
- try {
- String digestString1 = DigestUtils.md5Hex(new FileInputStream(tempFile));
- String digestString2 = FileUtils.readFileToString(digestFile);
- if (!digestString1.equals(digestString2)) {
- throw new DownloadException(String.format(
- "Error downloading file: digsests not equal. (%1$s != %2$s)",
- digestString1, digestString2));
- }
- } catch (IOException e) {
- throw new DownloadException(String.format("Error checking digest for %1$s", destination),
- e);
- }
- }
- // copy file to destination
- try {
- logger.info(String.format("Copying %1$s to %2$s", tempFile, destination));
- FileUtils.copyFile(tempFile, destination);
- } catch (IOException e) {
- throw new DownloadException(String.format("Error downloading %1$s to %2$s.", source, destination), e);
- }
-
- }
-
- private String mapAlgorithmToFileExtension(String algorithm) {
- return "." + algorithm.toLowerCase().replaceAll("-", "");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-impl/src/main/resources/META-INF/spring/download-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-download-impl/src/main/resources/META-INF/spring/download-context-osgi.xml b/taverna-download-impl/src/main/resources/META-INF/spring/download-context-osgi.xml
deleted file mode 100644
index 305de8f..0000000
--- a/taverna-download-impl/src/main/resources/META-INF/spring/download-context-osgi.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <service ref="downloadManager" interface="uk.org.taverna.commons.download.DownloadManager" />
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-download-impl/src/main/resources/META-INF/spring/download-context.xml
----------------------------------------------------------------------
diff --git a/taverna-download-impl/src/main/resources/META-INF/spring/download-context.xml b/taverna-download-impl/src/main/resources/META-INF/spring/download-context.xml
deleted file mode 100644
index 8213b00..0000000
--- a/taverna-download-impl/src/main/resources/META-INF/spring/download-context.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="downloadManager" class="uk.org.taverna.commons.download.impl.DownloadManagerImpl" />
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/pom.xml b/taverna-maven-plugin/pom.xml
deleted file mode 100644
index cf7c17c..0000000
--- a/taverna-maven-plugin/pom.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
- </parent>
- <prerequisites>
- <maven>3.2.0</maven>
- </prerequisites>
- <artifactId>taverna-maven-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <name>Apache Taverna Maven Plugin</name>
- <description>A Maven plugin for packaging and deploying Taverna plugins</description>
- <properties>
- <maven.version>3.2.3</maven.version>
- <mavenArchiverVersion>2.5</mavenArchiverVersion>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>3.3</version>
- <configuration>
- <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
- <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
- </configuration>
- <executions>
- <execution>
- <id>mojo-descriptor</id>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-aether-provider</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-annotations</artifactId>
- <version>3.3</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-osgi</artifactId>
- <version>0.2.0</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-osgi-schemas</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bndlib</artifactId>
- <version>2.0.0.20130123-133441</version>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugin-testing</groupId>
- <artifactId>maven-plugin-testing-harness</artifactId>
- <version>3.2.0</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractDeployMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractDeployMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractDeployMojo.java
deleted file mode 100644
index d3e98cf..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractDeployMojo.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import java.io.File;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Abstract Mojo for deploying artifacts.
- *
- * @author David Withers
- */
-public abstract class AbstractDeployMojo extends AbstractWagonMojo {
-
- @Component
- protected MavenProject project;
-
- /**
- * Directory containing the generated Taverna plugin.
- */
- @Parameter(defaultValue = "${project.build.directory}", required = true)
- protected File buildDirectory;
-
- @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
- protected File outputDirectory;
-
- @Parameter(defaultValue = "${project.artifact}", required = true, readonly = true)
- protected Artifact artifact;
-
- @Parameter(defaultValue = "${project.distributionManagementArtifactRepository}", required = true, readonly = true)
- protected ArtifactRepository deploymentRepository;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractWagonMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractWagonMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractWagonMojo.java
deleted file mode 100644
index a74166a..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractWagonMojo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import org.apache.maven.artifact.manager.WagonManager;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.observers.Debug;
-
-/**
- * Abstract Mojo for using the wagon.
- *
- * @author David Withers
- */
-public abstract class AbstractWagonMojo extends AbstractMojo {
-
- @Component
- protected WagonManager wagonManager;
-
- /**
- * Disconnect the wagon.
- *
- * @param wagon
- * the wagon to disconnect
- * @param debug
- */
- protected void disconnectWagon(Wagon wagon, Debug debug) {
- if (getLog().isDebugEnabled()) {
- wagon.removeTransferListener(debug);
- wagon.removeSessionListener(debug);
- }
- try {
- wagon.disconnect();
- } catch (ConnectionException e) {
- getLog().error("Error disconnecting wagon - ignored", e);
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/BundleArtifact.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/BundleArtifact.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/BundleArtifact.java
deleted file mode 100644
index 0226a07..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/BundleArtifact.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import org.apache.maven.artifact.Artifact;
-
-/**
- *
- *
- * @author David Withers
- */
-public class BundleArtifact {
-
- private Artifact artifact;
- private String symbolicName;
- private String version;
-
- public BundleArtifact(Artifact artifact, String symbolicName, String version) {
- this.artifact = artifact;
- this.symbolicName = symbolicName;
- this.version = version;
- }
-
- public Artifact getArtifact() {
- return artifact;
- }
-
- public void setArtifact(Artifact artifact) {
- this.artifact = artifact;
- }
-
- public String getSymbolicName() {
- return symbolicName;
- }
-
- public void setSymbolicName(String symbolicName) {
- this.symbolicName = symbolicName;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
-}
[3/5] incubator-taverna-osgi git commit: temporarily empty repository
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/MavenOsgiUtils.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/MavenOsgiUtils.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/MavenOsgiUtils.java
deleted file mode 100644
index 6901119..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/MavenOsgiUtils.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import org.apache.maven.RepositoryUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.DefaultDependencyResolutionRequest;
-import org.apache.maven.project.DependencyResolutionException;
-import org.apache.maven.project.DependencyResolutionResult;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectDependenciesResolver;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.util.filter.ScopeDependencyFilter;
-
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-import aQute.bnd.header.Attrs;
-import aQute.bnd.header.OSGiHeader;
-import aQute.bnd.header.Parameters;
-import aQute.bnd.osgi.Constants;
-import aQute.bnd.version.Version;
-import aQute.bnd.version.VersionRange;
-
-/**
- * @author David Withers
- */
-public class MavenOsgiUtils {
-
- private final MavenProject project;
- private final RepositorySystemSession repositorySystemSession;
- private final ProjectDependenciesResolver projectDependenciesResolver;
- private final Log log;
-
- private Set<String> javaPackages;
- private Set<String> systemPackages;
-
- public MavenOsgiUtils(MavenProject project, RepositorySystemSession repositorySystemSession,
- ProjectDependenciesResolver projectDependenciesResolver, Log log) {
- this(project, repositorySystemSession, projectDependenciesResolver, new HashSet<String>(),
- log);
- }
-
- public MavenOsgiUtils(MavenProject project, RepositorySystemSession repositorySystemSession,
- ProjectDependenciesResolver projectDependenciesResolver, Set<String> systemPackages,
- Log log) {
- this.project = project;
- this.repositorySystemSession = repositorySystemSession;
- this.projectDependenciesResolver = projectDependenciesResolver;
- this.systemPackages = systemPackages;
- this.log = log;
- javaPackages = Utils.getJavaPackages(log);
- }
-
- public Set<BundleArtifact> getBundleDependencies(String... scopes)
- throws MojoExecutionException {
- ScopeDependencyFilter scopeFilter = new ScopeDependencyFilter(Arrays.asList(scopes), null);
-
- DefaultDependencyResolutionRequest dependencyResolutionRequest = new DefaultDependencyResolutionRequest(
- project, repositorySystemSession);
- dependencyResolutionRequest.setResolutionFilter(scopeFilter);
-
- DependencyResolutionResult dependencyResolutionResult;
- try {
- dependencyResolutionResult = projectDependenciesResolver
- .resolve(dependencyResolutionRequest);
- } catch (DependencyResolutionException ex) {
- throw new MojoExecutionException(ex.getMessage(), ex);
- }
-
- DependencyNode dependencyGraph = dependencyResolutionResult.getDependencyGraph();
- if (dependencyGraph != null) {
- checkBundleDependencies(dependencyGraph.getChildren());
- return getBundleArtifacts(dependencyGraph.getChildren());
- } else {
- return new HashSet<BundleArtifact>();
- }
- }
-
- public Set<BundleArtifact> getBundleArtifacts(List<DependencyNode> nodes) {
- Set<BundleArtifact> bundleArtifacts = new HashSet<BundleArtifact>();
- for (DependencyNode node : nodes) {
- Artifact artifact = RepositoryUtils.toArtifact(node.getDependency().getArtifact());
- String symbolicName = getManifestAttribute(artifact, Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null) {
- String version = getManifestAttribute(artifact, Constants.BUNDLE_VERSION);
- bundleArtifacts.add(new BundleArtifact(artifact, symbolicName, version));
- bundleArtifacts.addAll(getBundleArtifacts(node.getChildren()));
- } else {
- log.warn("Not an OSGi bundle : " + artifact.getId());
- }
- }
- return bundleArtifacts;
- }
-
- public Set<Artifact> getAllArtifacts(List<DependencyNode> nodes) {
- Set<Artifact> artifacts = new HashSet<Artifact>();
- for (DependencyNode node : nodes) {
- Artifact artifact = RepositoryUtils.toArtifact(node.getDependency().getArtifact());
- if (isBundle(artifact)) {
- artifacts.add(artifact);
- artifacts.addAll(getAllArtifacts(node.getChildren()));
- }
- }
- return artifacts;
- }
-
- public Set<Artifact> getArtifacts(List<DependencyNode> nodes) {
- Set<Artifact> artifacts = new HashSet<Artifact>();
- for (DependencyNode node : nodes) {
- Artifact artifact = RepositoryUtils.toArtifact(node.getDependency().getArtifact());
- if (isBundle(artifact)) {
- artifacts.add(artifact);
- }
- }
- return artifacts;
- }
-
- public List<BundleInfo> getBundles(Set<BundleArtifact> bundleDependencies)
- throws MojoExecutionException {
- List<BundleInfo> bundles = new ArrayList<BundleInfo>();
- for (BundleArtifact bundleArtifact : bundleDependencies) {
- Artifact artifact = bundleArtifact.getArtifact();
- BundleInfo bundle = new BundleInfo();
- bundle.setSymbolicName(bundleArtifact.getSymbolicName());
- bundle.setVersion(bundleArtifact.getVersion());
- bundle.setFileName(new File(artifact.getGroupId(), artifact.getFile().getName())
- .getPath());
- bundles.add(bundle);
- }
- Collections.sort(bundles, new BundleComparator());
- return bundles;
- }
-
- public Map<String, Set<PackageVersion>> getPackageDependencies(List<DependencyNode> nodes) {
- Map<String, Set<PackageVersion>> exportVersions = calculatePackageVersions(
- getAllArtifacts(nodes), true, false);
- return getPackageDependencies(getArtifacts(nodes), exportVersions);
- }
-
- public Map<String, Set<PackageVersion>> getPackageDependencies(Set<Artifact> requiredArtifacts,
- Map<String, Set<PackageVersion>> exportVersions) {
- Map<String, Set<PackageVersion>> importVersions = calculatePackageVersions(
- requiredArtifacts, false, true);
- Set<Artifact> newRequiredArtifacts = new HashSet<Artifact>();
- for (Entry<String, Set<PackageVersion>> entry : importVersions.entrySet()) {
- if (!javaPackages.contains(entry.getKey())) {
- String packageName = entry.getKey();
- Set<PackageVersion> importsVersions = entry.getValue();
- Set<PackageVersion> exportsVersions = exportVersions.get(packageName);
- if (exportVersions.containsKey(entry.getKey())) {
- for (Artifact artifact : getRequiredArtifacts(importsVersions, exportsVersions)) {
- if (!requiredArtifacts.contains(artifact)) {
- newRequiredArtifacts.add(artifact);
- }
- }
- }
- }
- }
- if (!newRequiredArtifacts.isEmpty()) {
- newRequiredArtifacts.addAll(requiredArtifacts);
- return getPackageDependencies(newRequiredArtifacts, exportVersions);
- }
- return importVersions;
- }
-
- /**
- * Returns the minimum set of artifacts required to satisfy the range of importVersions.
- *
- * @param importsVersions
- * the version ranges required for the package
- * @param exportVersions
- * the available versions for the package
- * @return the minimum set of artifacts required to satisfy the range of importVersions
- */
- private Set<Artifact> getRequiredArtifacts(Set<PackageVersion> importsVersions,
- Set<PackageVersion> exportVersions) {
- Set<Artifact> requiredArtifacts = new HashSet<Artifact>();
- List<Set<PackageVersion>> exportsSubsets = Utils.getSubsets(exportVersions);
- for (Set<PackageVersion> exportsSubset : exportsSubsets) {
- if (satisfiesImports(importsVersions, exportsSubset)) {
- for (PackageVersion exportVersion : exportsSubset) {
- requiredArtifacts.add(exportVersion.getArtifact());
- }
- break;
- }
- }
- return requiredArtifacts;
- }
-
- private boolean satisfiesImports(Set<PackageVersion> imports, Set<PackageVersion> exports) {
- for (PackageVersion importVersion : imports) {
- if (!satisfiesImport(importVersion, exports)) {
- return false;
- }
- }
- return true;
- }
-
- private boolean satisfiesImport(PackageVersion importVersion, Set<PackageVersion> exports) {
- for (PackageVersion exportVersion : exports) {
- if (importVersion.getVersionRange().includes(exportVersion.getVersionRange().getLow())) {
- return true;
- }
- }
- return false;
- }
-
- public void checkBundleDependencies(List<DependencyNode> nodes) {
- Map<Artifact, Set<Package>> unresolvedArtifacts = new HashMap<Artifact, Set<Package>>();
- Set<Artifact> artifacts = getAllArtifacts(nodes);
- Map<String, Set<PackageVersion>> exports = calculatePackageVersions(artifacts, true, false);
- for (Artifact artifact : artifacts) {
- if (isBundle(artifact)) {
- Parameters imports = getManifestAttributeParameters(artifact,
- Constants.IMPORT_PACKAGE);
- if (imports != null) {
- for (String packageName : imports.keySet()) {
- boolean exportMissing = true;
- VersionRange importRange = null;
- Attrs attrs = imports.get(packageName);
- if (isOptional(attrs)) {
- exportMissing = false;
- } else if (javaPackages.contains(packageName)
- || systemPackages.contains(packageName)
- || packageName.startsWith("org.osgi.")) {
- exportMissing = false;
- } else if (attrs == null || attrs.get(Constants.VERSION_ATTRIBUTE) == null) {
- if (exports.containsKey(packageName)) {
- exportMissing = false;
- }
- } else {
- importRange = getVersionRange(attrs);
- if (exports.containsKey(packageName)) {
- for (PackageVersion exportVersion : exports.get(packageName)) {
- if (importRange.includes(exportVersion.getVersionRange()
- .getLow())) {
- exportMissing = false;
- break;
- }
- }
- }
- }
- if (exportMissing) {
- if (!unresolvedArtifacts.containsKey(artifact)) {
- unresolvedArtifacts.put(artifact, new HashSet<Package>());
- }
- unresolvedArtifacts.get(artifact).add(
- new Package(packageName, importRange));
- }
- }
- }
- }
- }
- for (Entry<Artifact, Set<Package>> unresolvedArtifact : unresolvedArtifacts.entrySet()) {
- log.warn("Bundle : " + unresolvedArtifact.getKey().getId()
- + " has unresolved package dependencies:");
- for (Package unresolvedPackage : unresolvedArtifact.getValue()) {
- log.warn(" " + unresolvedPackage);
- }
- }
- }
-
- public Map<String, Set<PackageVersion>> calculatePackageVersions(Set<Artifact> artifacts,
- boolean export, boolean unique) {
- Map<String, Set<PackageVersion>> packageVersions = new HashMap<String, Set<PackageVersion>>();
- for (Artifact artifact : artifacts) {
- if (isBundle(artifact)) {
- Parameters packages = getManifestAttributeParameters(artifact,
- export ? Constants.EXPORT_PACKAGE : Constants.IMPORT_PACKAGE);
- if (packages != null) {
- for (String packageName : packages.keySet()) {
- if (!packageVersions.containsKey(packageName)) {
- packageVersions.put(packageName, new HashSet<PackageVersion>());
- }
- Set<PackageVersion> versions = packageVersions.get(packageName);
- VersionRange versionRange = getVersionRange(packages.get(packageName));
- boolean optional = isOptional(packages.get(packageName));
- if (unique) {
- // check if this version range is unique
- boolean uniqueVersion = true;
- for (PackageVersion version : versions) {
- if (equals(versionRange, version.getVersionRange())) {
- uniqueVersion = false;
- break;
- }
- }
- if (uniqueVersion) {
- versions.add(new PackageVersion(versionRange, artifact, optional));
- }
- } else {
- versions.add(new PackageVersion(versionRange, artifact, optional));
- }
- }
- }
- }
- }
- return packageVersions;
- }
-
- public Version getVersion(Attrs attrs) {
- if (attrs == null) {
- return Version.LOWEST;
- }
- return Version.parseVersion(attrs.get(Constants.VERSION_ATTRIBUTE));
- }
-
- public VersionRange getVersionRange(Attrs attrs) {
- if (attrs == null) {
- return new VersionRange("0");
- }
- String version = attrs.get(Constants.VERSION_ATTRIBUTE);
- if (version == null) {
- return new VersionRange("0");
- }
- return new VersionRange(version);
- }
-
- public boolean isBundle(Artifact artifact) {
- return getManifestAttribute(artifact, Constants.BUNDLE_SYMBOLICNAME) != null;
- }
-
- public boolean isOptional(Attrs attrs) {
- return attrs != null && "optional".equals(attrs.get(Constants.RESOLUTION_DIRECTIVE));
- }
-
- public boolean equals(VersionRange v1, VersionRange v2) {
- return v1 == v2 || v1.toString().equals(v2.toString());
- }
-
- public Parameters getManifestAttributeParameters(Artifact artifact, String attributeName) {
- String attributeValue = getManifestAttribute(artifact, attributeName);
- if (attributeValue != null) {
- return OSGiHeader.parseHeader(attributeValue);
- }
- return null;
- }
-
- public String getManifestAttribute(Artifact artifact, String attributeName) {
- Manifest manifest = getManifest(artifact);
- if (manifest != null) {
- Attributes mainAttributes = manifest.getMainAttributes();
- return mainAttributes.getValue(attributeName);
- }
- return null;
- }
-
- public Manifest getManifest(Artifact artifact) {
- if (artifact != null) {
- File file = artifact.getFile();
- if (file != null) {
- try {
- JarFile jarFile = new JarFile(artifact.getFile());
- return jarFile.getManifest();
- } catch (IOException e) {
- return null;
- }
- }
- }
- return null;
- }
-
- private final class BundleComparator implements Comparator<BundleInfo> {
-
- @Override
- public int compare(BundleInfo bundle1, BundleInfo bundle2) {
- return bundle1.getSymbolicName().compareTo(bundle2.getSymbolicName());
- }
-
- }
-
- // public static void main(String[] args) throws Exception {
- // MavenOsgiUtils mavenOsgiUtils = new MavenOsgiUtils();
- // Parameters exports = mavenOsgiUtils.getImports(new
- // File("/Users/david/Documents/workspace-trunk/taverna-plugin-impl/target/taverna-plugin-impl-0.1.0-SNAPSHOT.jar"));
- // for (String key : exports.keySet()) {
- // System.out.println(key + " " + mavenOsgiUtils.getVersionRange(exports.get(key)));
- // }
- // }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Package.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Package.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Package.java
deleted file mode 100644
index 5e4a5e5..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Package.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import aQute.bnd.version.VersionRange;
-
-/**
- * @author David Withers
- */
-public class Package {
-
- private String name;
- private VersionRange versionRange;
-
- public Package(String name, VersionRange versionRange) {
- this.name = name;
- this.versionRange = versionRange;
- }
-
- @Override
- public String toString() {
- if (versionRange == null) {
- return name;
- } else {
- return name + ";version=\"" + versionRange + "\"";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/PackageVersion.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/PackageVersion.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/PackageVersion.java
deleted file mode 100644
index 14e0dee..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/PackageVersion.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import org.apache.maven.artifact.Artifact;
-
-import aQute.bnd.version.VersionRange;
-
-/**
- *
- *
- * @author David Withers
- */
-public class PackageVersion {
-
- private VersionRange versionRange;
- private Artifact artifact;
- private boolean optional;
-
- public PackageVersion(VersionRange versionRange, Artifact artifact) {
- this(versionRange, artifact, false);
- }
-
- public PackageVersion(VersionRange versionRange, Artifact artifact, boolean optional) {
- this.versionRange = versionRange;
- this.artifact = artifact;
- this.optional = optional;
- }
-
- @Override
- public String toString() {
- return versionRange + (optional ? "" : "") + "(from " + artifact.getId() + ")";
- }
-
- public VersionRange getVersionRange() {
- return versionRange;
- }
-
- public void setVersionRange(VersionRange versionRange) {
- this.versionRange = versionRange;
- }
-
- public Artifact getArtifact() {
- return artifact;
- }
-
- public void setArtifact(Artifact artifact) {
- this.artifact = artifact;
- }
-
- public boolean isOptional() {
- return optional;
- }
-
- public void setOptional(boolean optional) {
- this.optional = optional;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployFileMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployFileMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployFileMojo.java
deleted file mode 100644
index cf2034b..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployFileMojo.java
+++ /dev/null
@@ -1,235 +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.maven.plugins;
-
-import static net.sf.taverna.t2.maven.plugins.TavernaPluginGenerateMojo.META_INF_TAVERNA;
-import static net.sf.taverna.t2.maven.plugins.TavernaPluginGenerateMojo.PLUGIN_FILE;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.UnsupportedProtocolException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.observers.Debug;
-import org.apache.maven.wagon.repository.Repository;
-
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginInfo;
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginVersions;
-import uk.org.taverna.commons.plugin.xml.jaxb.Plugins;
-import uk.org.taverna.commons.versions.xml.jaxb.Version;
-
-/**
- * Deploys the Taverna plugin using <code>scp</code> or <code>file</code> protocol to the site URL
- * specified.
- *
- * @author David Withers
- */
-@Mojo(name = "plugin-deploy-file", requiresProject=false, requiresDirectInvocation = true)
-public class TavernaPluginDeployFileMojo extends AbstractWagonMojo {
-
- private static final String PLUGIN_FILE_ENTRY = META_INF_TAVERNA + "/" + PLUGIN_FILE;
-
- private static final String PLUGINS_FILE = "plugins.xml";
-
- @Parameter(defaultValue = "http://updates.taverna.org.uk/workbench/3.0/dev/", required = true)
- protected String site;
-
- @Parameter(property = "file", required = true)
- protected File file;
-
- @Parameter(property = "url", required = true)
- protected String url;
-
- @Parameter(property = "serverId", required = true)
- protected String serverId;
-
- public void execute() throws MojoExecutionException {
- if (!file.exists()) {
- throw new MojoExecutionException("The Taverna Plugin file " + file
- + " does not exist");
- }
-
- JarFile pluginJarFile;
- try {
- pluginJarFile = new JarFile(file);
- } catch (ZipException e) {
- throw new MojoExecutionException(file + " is not a valid Taverna Plugin file", e);
- } catch (IOException e) {
- throw new MojoExecutionException("Error opening Taverna Plugin file: " + file, e);
- }
-
- ZipEntry pluginFileEntry = pluginJarFile.getJarEntry(PLUGIN_FILE_ENTRY);
- if (pluginFileEntry == null) {
- throw new MojoExecutionException(file
- + " is not a valid Taverna Plugin file, missing " + PLUGIN_FILE_ENTRY);
- }
-
- JAXBContext jaxbContext;
- try {
- jaxbContext = JAXBContext.newInstance(PluginInfo.class, Plugins.class);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error setting up JAXB context ", e);
- }
-
- PluginInfo plugin;
- try {
- InputStream inputStream = pluginJarFile.getInputStream(pluginFileEntry);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- plugin = (PluginInfo) unmarshaller.unmarshal(inputStream);
- inputStream.close();
- } catch (IOException e) {
- throw new MojoExecutionException("Error reading " + file, e);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + file, e);
- }
-
- getLog().debug("The Taverna plugin will be deployed to '" + url + "'");
-
- Repository repository = new Repository(serverId, url);
-
- // create the wagon
- Wagon wagon;
- try {
- wagon = wagonManager.getWagon(repository.getProtocol());
- } catch (UnsupportedProtocolException e) {
- throw new MojoExecutionException("Unsupported protocol: '" + repository.getProtocol()
- + "'", e);
- }
-
- Debug debug = new Debug();
- if (getLog().isDebugEnabled()) {
- wagon.addSessionListener(debug);
- wagon.addTransferListener(debug);
- }
-
- // connect to the plugin site
- try {
- wagon.connect(repository, wagonManager.getAuthenticationInfo(serverId),
- wagonManager.getProxy(repository.getProtocol()));
- } catch (ConnectionException e) {
- throw new MojoExecutionException("Error connecting to plugin site at " + url, e);
- } catch (AuthenticationException e) {
- throw new MojoExecutionException("Authentication error connecting to plugin site at "
- + url, e);
- }
-
- try {
- File pluginsFile = File.createTempFile("taverna", null);
-
- // fetch the plugins file
- Plugins plugins;
- try {
- Utils.downloadFile(PLUGINS_FILE, pluginsFile, wagon, getLog());
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- plugins = (Plugins) unmarshaller.unmarshal(pluginsFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + pluginsFile, e);
- }
- } catch (ResourceDoesNotExistException e) {
- getLog().info("Creating new plugins file");
- plugins = new Plugins();
- }
-
- String deployedPluginFile = plugin.getId() + "-" + plugin.getVersion() + ".jar";
-
- if (addPlugin(plugins, plugin, deployedPluginFile)) {
- // write the new plugin site file
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,
- TavernaPluginGenerateMojo.SCHEMA_LOCATION);
- marshaller.marshal(plugins, pluginsFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error writing " + PLUGINS_FILE, e);
- }
-
- // upload the plugin to the update site
- Utils.uploadFile(file, deployedPluginFile, wagon, getLog());
- // upload the plugin site file
- Utils.uploadFile(pluginsFile, PLUGINS_FILE, wagon, getLog());
- }
- } catch (IOException e) {
- throw new MojoExecutionException("Error writing " + PLUGINS_FILE, e);
- } finally {
- disconnectWagon(wagon, debug);
- }
- }
-
- private boolean addPlugin(Plugins plugins, PluginInfo pluginInfo, String pluginURL) {
- PluginVersions plugin = getPlugin(plugins, pluginInfo);
- Version latestVersion = plugin.getLatestVersion();
- if (latestVersion != null && latestVersion.getVersion().equals(pluginInfo.getVersion())) {
- getLog().error(
- String.format("%1$s version %2$s has already been deployed",
- pluginInfo.getName(), pluginInfo.getVersion()));
- return false;
- }
- Version newPluginVersion = new Version();
- newPluginVersion.setVersion(pluginInfo.getVersion());
- newPluginVersion.setFile(pluginURL);
-
- getLog().info(
- String.format("Adding %1$s version %2$s", pluginInfo.getName(),
- pluginInfo.getVersion()));
- if (plugin.getLatestVersion() != null) {
- plugin.getPreviousVersion().add(plugin.getLatestVersion());
- }
- plugin.setLatestVersion(newPluginVersion);
- return true;
- }
-
- private PluginVersions getPlugin(Plugins plugins, PluginInfo pluginInfo) {
- PluginVersions pluginVersions = null;
- for (PluginVersions existingPlugin : plugins.getPlugin()) {
- if (existingPlugin.getId().equals(pluginInfo.getId())) {
- pluginVersions = existingPlugin;
- break;
- }
- }
- if (pluginVersions == null) {
- pluginVersions = new PluginVersions();
- pluginVersions.setId(pluginInfo.getId());
- plugins.getPlugin().add(pluginVersions);
- }
- pluginVersions.setName(pluginInfo.getName());
- pluginVersions.setDescription(pluginInfo.getDescription());
- pluginVersions.setOrganization(pluginInfo.getOrganization());
- return pluginVersions;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployMojo.java
deleted file mode 100644
index 8ba1f3d..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginDeployMojo.java
+++ /dev/null
@@ -1,220 +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.maven.plugins;
-
-import java.io.File;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.UnsupportedProtocolException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.observers.Debug;
-import org.apache.maven.wagon.repository.Repository;
-
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginInfo;
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginVersions;
-import uk.org.taverna.commons.plugin.xml.jaxb.Plugins;
-import uk.org.taverna.commons.versions.xml.jaxb.Version;
-
-/**
- * Deploys the Taverna plugin using <code>scp</code> or <code>file</code> protocol to the site URL
- * specified in the <code><distributionManagement></code> section of the POM.
- *
- * @author David Withers
- */
-@Mojo(name = "plugin-deploy", defaultPhase = LifecyclePhase.DEPLOY)
-public class TavernaPluginDeployMojo extends AbstractDeployMojo {
-
- private static final String PLUGINS_FILE = "plugins.xml";
-
- private File tempDirectory;
-
- public void execute() throws MojoExecutionException {
- tempDirectory = new File(buildDirectory, TavernaProfileGenerateMojo.TAVERNA_TMP);
- tempDirectory.mkdirs();
- if (artifact == null) {
- throw new MojoExecutionException(
- "The Taverna Plugin does not exist, please run taverna:plugin-generate first");
- }
-
- File artifactFile = artifact.getFile();
- if (artifactFile == null) {
- throw new MojoExecutionException(
- "The Taverna Plugin does not exist, please run taverna:plugin-generate first");
- }
-
- File pluginDirectory = new File(outputDirectory, TavernaPluginGenerateMojo.META_INF_TAVERNA);
- File pluginFile = new File(pluginDirectory, TavernaPluginGenerateMojo.PLUGIN_FILE);
- if (!pluginFile.exists()) {
- throw new MojoExecutionException(
- "The Taverna Plugin does not exist, please run taverna:plugin-generate first");
- }
-
- JAXBContext jaxbContext;
- try {
- jaxbContext = JAXBContext.newInstance(PluginInfo.class, Plugins.class);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error setting up JAXB context ", e);
- }
-
- PluginInfo plugin;
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- plugin = (PluginInfo) unmarshaller.unmarshal(pluginFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + pluginFile, e);
- }
-
- if (deploymentRepository == null) {
- throw new MojoExecutionException(
- "Missing repository information in the distribution management element in the project.");
- }
-
- String url = deploymentRepository.getUrl();
- String id = deploymentRepository.getId();
-
- if (url == null) {
- throw new MojoExecutionException(
- "The URL to the Taverna plugin site is missing in the project descriptor.");
- }
- getLog().debug("The Taverna plugin will be deployed to '" + url + "'");
-
- Repository repository = new Repository(id, url);
-
- // create the wagon
- Wagon wagon;
- try {
- wagon = wagonManager.getWagon(repository.getProtocol());
- } catch (UnsupportedProtocolException e) {
- throw new MojoExecutionException("Unsupported protocol: '" + repository.getProtocol()
- + "'", e);
- }
-
- Debug debug = new Debug();
- if (getLog().isDebugEnabled()) {
- wagon.addSessionListener(debug);
- wagon.addTransferListener(debug);
- }
-
- // connect to the plugin site
- try {
- wagon.connect(repository, wagonManager.getAuthenticationInfo(id),
- wagonManager.getProxy(repository.getProtocol()));
- } catch (ConnectionException e) {
- throw new MojoExecutionException("Error connecting to plugin site at " + url, e);
- } catch (AuthenticationException e) {
- throw new MojoExecutionException("Authentication error connecting to plugin site at "
- + url, e);
- }
-
- try {
- String deployedPluginFile = project.getGroupId() + "." + project.getArtifactId() + "-"
- + plugin.getVersion() + ".jar";
-
- // fetch the plugins file
- Plugins plugins;
- File pluginsFile = new File(tempDirectory, PLUGINS_FILE);
- try {
- Utils.downloadFile(PLUGINS_FILE, pluginsFile, wagon, getLog());
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- plugins = (Plugins) unmarshaller.unmarshal(pluginsFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + pluginsFile, e);
- }
- } catch (ResourceDoesNotExistException e) {
- getLog().info("Creating new plugins file");
- plugins = new Plugins();
- }
-
- if (addPlugin(plugins, plugin, deployedPluginFile)) {
- // write the new plugin site file
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,
- TavernaPluginGenerateMojo.SCHEMA_LOCATION);
- marshaller.marshal(plugins, pluginsFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error writing " + PLUGINS_FILE, e);
- }
-
- // upload the plugin to the update site
- Utils.uploadFile(artifactFile, deployedPluginFile, wagon, getLog());
- // upload the plugin site file
- Utils.uploadFile(pluginsFile, PLUGINS_FILE, wagon, getLog());
- }
- } finally {
- disconnectWagon(wagon, debug);
- }
- }
-
- private boolean addPlugin(Plugins plugins, PluginInfo pluginInfo, String pluginURL) {
- PluginVersions plugin = getPlugin(plugins, pluginInfo);
- Version latestVersion = plugin.getLatestVersion();
- if (latestVersion != null && latestVersion.getVersion().equals(pluginInfo.getVersion())) {
- getLog().error(
- String.format("%1$s version %2$s has already been deployed", pluginInfo.getName(),
- pluginInfo.getVersion()));
- return false;
- }
- Version newPluginVersion = new Version();
- newPluginVersion.setVersion(pluginInfo.getVersion());
- newPluginVersion.setFile(pluginURL);
-
- getLog().info(
- String.format("Adding %1$s version %2$s", pluginInfo.getName(), pluginInfo.getVersion()));
- if (plugin.getLatestVersion() != null) {
- plugin.getPreviousVersion().add(plugin.getLatestVersion());
- }
- plugin.setLatestVersion(newPluginVersion);
- return true;
- }
-
- private PluginVersions getPlugin(Plugins plugins, PluginInfo pluginInfo) {
- PluginVersions pluginVersions = null;
- for (PluginVersions existingPlugin : plugins.getPlugin()) {
- if (existingPlugin.getId().equals(pluginInfo.getId())) {
- pluginVersions = existingPlugin;
- break;
- }
- }
- if (pluginVersions == null) {
- pluginVersions = new PluginVersions();
- pluginVersions.setId(pluginInfo.getId());
- plugins.getPlugin().add(pluginVersions);
- }
- pluginVersions.setName(pluginInfo.getName());
- pluginVersions.setDescription(pluginInfo.getDescription());
- pluginVersions.setOrganization(pluginInfo.getOrganization());
- return pluginVersions;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojo.java
deleted file mode 100644
index 0ec94f4..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojo.java
+++ /dev/null
@@ -1,142 +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.maven.plugins;
-
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Organization;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectDependenciesResolver;
-import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-import org.apache.maven.shared.osgi.Maven2OsgiConverter;
-import org.eclipse.aether.RepositorySystemSession;
-
-import uk.org.taverna.commons.plugin.xml.jaxb.PluginInfo;
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-
-/**
- * Generates a Taverna plugin definition file.
- *
- * @author David Withers
- */
-@Mojo(name = "plugin-generate", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.RUNTIME)
-public class TavernaPluginGenerateMojo extends AbstractMojo {
-
- public static final String PLUGIN_FILE = "plugin.xml";
-
- public static final String META_INF_TAVERNA = "META-INF/taverna";
-
- public static final String SCHEMA_LOCATION = "http://ns.taverna.org.uk/2013/application/plugin http://localhost/2013/application/plugin/ApplicationPlugin.xsd";
-
- @Component
- private MavenProject project;
-
- @Component
- private ProjectDependenciesResolver projectDependenciesResolver;
-
- @Parameter(defaultValue = "${repositorySystemSession}", readonly = true)
- private RepositorySystemSession repositorySystemSession;
-
- @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
- protected File outputDirectory;
-
- @Parameter(defaultValue = "${project.description}", required = true)
- protected String description;
-
- @Parameter(defaultValue = "${project.organization}", required = true)
- protected Organization organization;
-
- private MavenOsgiUtils osgiUtils;
-
- private Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- try {
- osgiUtils = new MavenOsgiUtils(project, repositorySystemSession,
- projectDependenciesResolver, getLog());
- createPluginDefinition();
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error generating Taverna plugin", e);
- }
- }
-
- /**
- * Generates the Taverna plugin definition file.
- *
- * @return the <code>File</code> that the Taverna plugin definition has been written to
- * @throws JAXBException
- * @throws MojoExecutionException
- */
- private File createPluginDefinition() throws JAXBException, MojoExecutionException {
- String groupId = project.getGroupId();
- String artifactId = project.getArtifactId();
- String version = maven2OsgiConverter.getVersion(project.getVersion());
- if (version.endsWith("SNAPSHOT")) {
- version = version.substring(0, version.indexOf("SNAPSHOT")) + Utils.timestamp();
- }
-
- File pluginDirectory = new File(outputDirectory, META_INF_TAVERNA);
- pluginDirectory.mkdirs();
- File pluginFile = new File(pluginDirectory, PLUGIN_FILE);
-
- PluginInfo pluginInfo = new PluginInfo();
- pluginInfo.setId(groupId + "." + artifactId);
- pluginInfo.setName(project.getName());
- pluginInfo.setVersion(version);
- pluginInfo.setDescription(description);
- pluginInfo.setOrganization(organization.getName());
-
- Set<BundleArtifact> bundleDependencies = osgiUtils.getBundleDependencies(
- Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME);
-
- List<BundleInfo> runtimeBundles = osgiUtils.getBundles(bundleDependencies);
- if (!runtimeBundles.isEmpty()) {
- List<BundleInfo> bundles = pluginInfo.getBundle();
- for (BundleInfo bundle : runtimeBundles) {
- bundles.add(bundle);
- }
- }
-
- JAXBContext jaxbContext = JAXBContext.newInstance(PluginInfo.class);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, SCHEMA_LOCATION);
- marshaller.marshal(pluginInfo, pluginFile);
-
- return pluginFile;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginPrepareBundlesMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginPrepareBundlesMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginPrepareBundlesMojo.java
deleted file mode 100644
index 497151f..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaPluginPrepareBundlesMojo.java
+++ /dev/null
@@ -1,84 +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.maven.plugins;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectDependenciesResolver;
-import org.eclipse.aether.RepositorySystemSession;
-
-/**
- * Prepares the plugin OSGi bundles.
- *
- * @author David Withers
- */
-@Mojo(name = "plugin-prepare-bundles", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.RUNTIME)
-public class TavernaPluginPrepareBundlesMojo extends AbstractMojo {
-
- @Component
- private MavenProject project;
-
- @Component
- private ProjectDependenciesResolver projectDependenciesResolver;
-
- @Parameter(defaultValue = "${repositorySystemSession}", readonly = true)
- private RepositorySystemSession repositorySystemSession;
-
- /**
- * The directory where the plugin OSGi bundles file will be put.
- */
- @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
- protected File outputDirectory;
-
- private MavenOsgiUtils osgiUtils;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- osgiUtils = new MavenOsgiUtils(project, repositorySystemSession,
- projectDependenciesResolver, getLog());
- outputDirectory.mkdirs();
-
- Set<BundleArtifact> bundleDependencies = osgiUtils.getBundleDependencies(
- Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME);
- try {
- for (BundleArtifact bundleArtifact : bundleDependencies) {
- Artifact artifact = bundleArtifact.getArtifact();
- FileUtils.copyFileToDirectory(bundleArtifact.getArtifact().getFile(), new File(
- outputDirectory, artifact.getGroupId()));
- }
- } catch (IOException e) {
- throw new MojoExecutionException("Error copying dependecies to archive directory", e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileDeployMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileDeployMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileDeployMojo.java
deleted file mode 100644
index fce4ded..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileDeployMojo.java
+++ /dev/null
@@ -1,275 +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.maven.plugins;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.UnsupportedProtocolException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.observers.Debug;
-import org.apache.maven.wagon.repository.Repository;
-
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-import uk.org.taverna.commons.profile.xml.jaxb.UpdateSite;
-import uk.org.taverna.commons.versions.xml.jaxb.Version;
-import uk.org.taverna.commons.versions.xml.jaxb.Versions;
-
-/**
- * Deploys the application profile using <code>scp</code> or <code>file</code> protocol to the site
- * URL specified in the <code><distributionManagement></code> section of the POM.
- *
- * @author David Withers
- */
-@Mojo(name = "profile-deploy", defaultPhase = LifecyclePhase.DEPLOY)
-public class TavernaProfileDeployMojo extends AbstractDeployMojo {
-
- private static final String UPDATES_FILE = "updates.xml";
-
- private File tempDirectory;
-
- public void execute() throws MojoExecutionException {
- tempDirectory = new File(buildDirectory, TavernaProfileGenerateMojo.TAVERNA_TMP);
- tempDirectory.mkdirs();
- if (artifact == null) {
- throw new MojoExecutionException(
- "The application profile does not exist, please run taverna:profile-generate first");
- }
-
- File artifactFile = artifact.getFile();
- if (artifactFile == null) {
- throw new MojoExecutionException(
- "The application profile does not exist, please run taverna:profile-generate first");
- }
-
- JAXBContext jaxbContext;
- try {
- jaxbContext = JAXBContext.newInstance(ApplicationProfile.class, UpdateSite.class);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error setting up JAXB context ", e);
- }
-
- ApplicationProfile applicationProfile;
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- applicationProfile = (ApplicationProfile) unmarshaller.unmarshal(artifactFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + artifactFile, e);
- }
-
- if (deploymentRepository == null) {
- throw new MojoExecutionException(
- "Missing repository information in the distribution management element in the project.");
- }
-
- String url = deploymentRepository.getUrl();
- String id = deploymentRepository.getId();
-
- if (url == null) {
- throw new MojoExecutionException(
- "The URL to the update site is missing in the project descriptor.");
- }
- getLog().debug("The Taverna application will be deployed to '" + url + "'");
-
- Repository repository = new Repository(id, url);
-
- // create the wagon
- Wagon wagon;
- try {
- wagon = wagonManager.getWagon(repository.getProtocol());
- } catch (UnsupportedProtocolException e) {
- throw new MojoExecutionException("Unsupported protocol: '" + repository.getProtocol()
- + "'", e);
- }
-
- Debug debug = new Debug();
- if (getLog().isDebugEnabled()) {
- wagon.addSessionListener(debug);
- wagon.addTransferListener(debug);
- }
-
- // connect to the update site
- try {
- wagon.connect(repository, wagonManager.getAuthenticationInfo(id),
- wagonManager.getProxy(repository.getProtocol()));
- } catch (ConnectionException e) {
- throw new MojoExecutionException("Error connecting to " + url, e);
- } catch (AuthenticationException e) {
- throw new MojoExecutionException("Authentication error connecting to " + url, e);
- }
-
- try {
- // upload the application profile to the update site
- String deployedProfileFile = "ApplicationProfile" + "-" + applicationProfile.getVersion()
- + ".xml";
- Utils.uploadFile(artifactFile, deployedProfileFile, wagon, getLog());
-
- // fetch the applications file
- UpdateSite updateSite;
- File updatesFile = new File(tempDirectory, UPDATES_FILE);
- try {
- Utils.downloadFile(UPDATES_FILE, updatesFile, wagon, getLog());
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- updateSite = (UpdateSite) unmarshaller
- .unmarshal(updatesFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + updatesFile, e);
- }
- } catch(ResourceDoesNotExistException e) {
- getLog().info("Creating new application versions file");
- updateSite = new UpdateSite();
- Versions versions = new Versions();
- versions.setId(applicationProfile.getId());
- versions.setName(applicationProfile.getName());
- updateSite.setVersions(versions);
- }
-
- Version latestVersion = updateSite.getVersions().getLatestVersion();
- if (latestVersion != null) {
- File latestProfileFile = new File(tempDirectory, "ApplicationProfile-" + latestVersion.getVersion()
- + ".xml");
- try {
- Utils.downloadFile(latestVersion.getFile(), latestProfileFile, wagon, getLog());
- } catch (ResourceDoesNotExistException e) {
- throw new MojoExecutionException(latestVersion.getFile() + " does not exist", e);
- }
- ApplicationProfile latestProfile;
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- latestProfile = (ApplicationProfile) unmarshaller.unmarshal(latestProfileFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error reading " + latestProfileFile, e);
- }
- Set<BundleInfo> requiredBundles = getRequiredBundles(latestProfile, applicationProfile);
- if (requiredBundles.isEmpty()) {
- getLog().warn("No new bundles to upload");
- } else {
- // upload new bundles to the update site
- uploadBundles(requiredBundles, wagon);
- }
- }
-
- if (addApplicationVersion(updateSite.getVersions(), applicationProfile,
- deployedProfileFile)) {
- // write the new application versions list
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, TavernaProfileGenerateMojo.SCHEMA_LOCATION);
- marshaller.marshal(updateSite, updatesFile);
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error writing " + UPDATES_FILE, e);
- }
-
- // upload the new application versions list to the update site
- Utils.uploadFile(updatesFile, UPDATES_FILE, wagon, getLog());
- }
- }
- finally {
- disconnectWagon(wagon, debug);
- }
- }
-
- /**
- * Adds an new application version to the application versions if the version doesn't already
- * exist.
- *
- * @param applicationVersions
- * the ApplicationVersions document
- * @param applicationProfile
- * the applicationProfile
- * @param profileURL
- * @return true if a new version was added to the ApplicationVersions document; false if the
- * version already exits
- */
- private boolean addApplicationVersion(Versions applicationVersions,
- ApplicationProfile applicationProfile, String profileURL) {
- Version latestVersion = applicationVersions.getLatestVersion();
- if (latestVersion != null
- && latestVersion.getVersion().equals(applicationProfile.getVersion())) {
- getLog().error(
- String.format("%1$s version %2$s has already been deployed",
- applicationProfile.getName(), applicationProfile.getVersion()));
- return false;
- }
-
- Version newApplicationVersion = new Version();
- newApplicationVersion.setVersion(applicationProfile.getVersion());
- newApplicationVersion.setFile(profileURL);
-
- getLog().info(
- String.format("Adding %1$s version %2$s", applicationProfile.getName(),
- applicationProfile.getVersion()));
- if (applicationVersions.getLatestVersion() != null) {
- applicationVersions.getPreviousVersion().add(applicationVersions.getLatestVersion());
- }
- applicationVersions.setLatestVersion(newApplicationVersion);
- return true;
- }
-
- /**
- * @param requiredBundles
- * @throws MojoExecutionException
- */
- private void uploadBundles(Set<BundleInfo> requiredBundles, Wagon wagon) throws MojoExecutionException {
- File libDirectory = new File(tempDirectory, "lib");
- for (BundleInfo bundle : requiredBundles) {
- Utils.uploadFile(new File(libDirectory, bundle.getFileName()), "lib/" + bundle.getFileName(), wagon, getLog());
- }
- }
-
- private Set<BundleInfo> getRequiredBundles(ApplicationProfile currentProfile,
- ApplicationProfile newProfile) {
- Set<BundleInfo> requiredBundles = new HashSet<BundleInfo>();
- Map<String, BundleInfo> currentBundles = new HashMap<String, BundleInfo>();
- for (BundleInfo bundle : currentProfile.getBundle()) {
- currentBundles.put(bundle.getSymbolicName(), bundle);
- }
- for (BundleInfo bundle : newProfile.getBundle()) {
- if (currentBundles.containsKey(bundle.getSymbolicName())) {
- BundleInfo currentBundle = currentBundles.get(bundle.getSymbolicName());
- if (!bundle.getVersion().equals(currentBundle.getVersion())) {
- requiredBundles.add(bundle);
- }
- } else {
- requiredBundles.add(bundle);
- }
- }
- return requiredBundles;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileGenerateMojo.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileGenerateMojo.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileGenerateMojo.java
deleted file mode 100644
index 1a0e9a0..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/TavernaProfileGenerateMojo.java
+++ /dev/null
@@ -1,221 +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.maven.plugins;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectDependenciesResolver;
-import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-import org.apache.maven.shared.osgi.Maven2OsgiConverter;
-import org.eclipse.aether.RepositorySystemSession;
-
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-import uk.org.taverna.commons.profile.xml.jaxb.FrameworkConfiguration;
-import uk.org.taverna.commons.profile.xml.jaxb.Updates;
-
-/**
- * Generates an application profile file.
- *
- * @author David Withers
- */
-@Mojo(name = "profile-generate", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.RUNTIME)
-public class TavernaProfileGenerateMojo extends AbstractMojo {
-
- public static final String SYSTEM_PACKAGES = "org.osgi.framework.system.packages.extra";
-
- public static final String SCHEMA_LOCATION = "http://ns.taverna.org.uk/2013/application/profile http://localhost/2013/application/profile/ApplicationProfile.xsd";
-
- public static final String TAVERNA_TMP = "taverna-tmp";
-
- public static final String APPLICATION_PROFILE_FILE = "ApplicationProfile.xml";
-
- @Component
- private MavenProject project;
-
- @Component
- private ProjectDependenciesResolver projectDependenciesResolver;
-
- @Parameter(defaultValue = "${repositorySystemSession}", readonly = true)
- private RepositorySystemSession repositorySystemSession;
-
- /**
- * The directory where the generated <code>ApplicationProfile.xml</code> file will be put.
- */
- @Parameter(defaultValue = "${project.build.directory}", required = true)
- protected File outputDirectory;
-
- @Parameter(defaultValue = "SNAPSHOT")
- private String buildNumber;
-
- @Parameter
- private List<FrameworkConfiguration> frameworkConfigurations;
-
- @Parameter(required = true)
- private String updateSite;
-
- @Parameter(defaultValue = "updates.xml")
- private String updatesFile;
-
- @Parameter(defaultValue = "lib")
- private String libDirectory;
-
- @Parameter(required = true)
- private String pluginSite;
-
- @Parameter(defaultValue = "plugins.xml")
- private String pluginsFile;
-
- private Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-
- private MavenOsgiUtils osgiUtils;
-
- private File tempDirectory;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- try {
- osgiUtils = new MavenOsgiUtils(project, repositorySystemSession,
- projectDependenciesResolver, getSystemPackages(), getLog());
- tempDirectory = new File(outputDirectory, TAVERNA_TMP);
-
- File profileFile = createApplicationProfile();
- project.getArtifact().setFile(profileFile);
-
- copyDependencies();
-
- } catch (JAXBException e) {
- throw new MojoExecutionException("Error generating application profile", e);
- }
- }
-
- private void copyDependencies() throws MojoExecutionException {
- File libDirectory = new File(tempDirectory, "lib");
- libDirectory.mkdirs();
-
- try {
- for (Artifact artifact : project.getArtifacts()) {
- FileUtils.copyFileToDirectory(artifact.getFile(),
- new File(libDirectory, artifact.getGroupId()));
- }
- } catch (IOException e) {
- throw new MojoExecutionException("Error copying dependecies to lib directory", e);
- }
-
- }
-
- /**
- * Generates the application profile file.
- *
- * @return the <code>File</code> that the application profile has been written to
- * @throws JAXBException
- * if the application profile cannot be created
- * @throws MojoExecutionException
- */
- private File createApplicationProfile() throws JAXBException, MojoExecutionException {
- String groupId = project.getGroupId();
- String artifactId = project.getArtifactId();
- String version = maven2OsgiConverter.getVersion(project.getVersion());
- if (version.endsWith("SNAPSHOT")) {
- version = version.substring(0, version.indexOf("SNAPSHOT")) + buildNumber;
- }
-
- tempDirectory.mkdirs();
- File applicationProfileFile = new File(tempDirectory, APPLICATION_PROFILE_FILE);
-
- ApplicationProfile applicationProfile = new ApplicationProfile();
- applicationProfile.setId(groupId + "." + artifactId);
- applicationProfile.setName(project.getName());
- applicationProfile.setVersion(version);
-
- Updates updates = new Updates();
- updates.setUpdateSite(updateSite);
- updates.setUpdatesFile(updatesFile);
- updates.setLibDirectory(libDirectory);
- updates.setPluginSite(pluginSite);
- updates.setPluginsFile(pluginsFile);
- applicationProfile.setUpdates(updates);
-
- List<FrameworkConfiguration> frameworkConfiguration = applicationProfile
- .getFrameworkConfiguration();
- for (FrameworkConfiguration configuration : frameworkConfigurations) {
- frameworkConfiguration.add(configuration);
- }
-
- Set<BundleArtifact> bundleDependencies = osgiUtils.getBundleDependencies(
- Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME);
- List<BundleInfo> runtimeBundles = osgiUtils.getBundles(bundleDependencies);
- if (!runtimeBundles.isEmpty()) {
- List<BundleInfo> bundles = applicationProfile.getBundle();
- for (BundleInfo bundle : runtimeBundles) {
- bundles.add(bundle);
- }
- }
-
- JAXBContext jaxbContext = JAXBContext.newInstance(ApplicationProfile.class);
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, SCHEMA_LOCATION);
- marshaller.marshal(applicationProfile, applicationProfileFile);
-
- return applicationProfileFile;
- }
-
- private Set<String> getSystemPackages() {
- Set<String> systemPackages = new HashSet<String>();
- if (frameworkConfigurations != null) {
- for (FrameworkConfiguration configuration : frameworkConfigurations) {
- if (SYSTEM_PACKAGES.equals(configuration.getName())) {
- String packagesString = configuration.getValue();
- if (packagesString != null) {
- String[] packages = packagesString.split(",");
- for (String packageString : packages) {
- String[] packageProperties = packageString.split(";");
- if (packageProperties.length > 0) {
- systemPackages.add(packageProperties[0]);
- }
- }
- }
- }
- }
- }
- return systemPackages;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Utils.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Utils.java b/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Utils.java
deleted file mode 100644
index 82f5fee..0000000
--- a/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/Utils.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.maven.plugins;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-
-/**
- * @author David Withers
- */
-public class Utils {
-
- public static String uploadFile(File file, String resourceName, Wagon wagon, Log log)
- throws MojoExecutionException {
- String resourceUrl = getResourceUrl(wagon, resourceName);
- File digestFile = new File(file.getPath() + ".md5");
- try {
- String digestString = DigestUtils.md5Hex(new FileInputStream(file));
- FileUtils.writeStringToFile(digestFile, digestString);
- } catch (IOException e) {
- throw new MojoExecutionException(
- String.format("Error generating digest for %1$s", file), e);
- }
- try {
- log.info(String.format("Uploading %1$s to %2$s", file, resourceUrl));
- wagon.put(file, resourceName);
- wagon.put(digestFile, resourceName + ".md5");
- } catch (TransferFailedException e) {
- throw new MojoExecutionException(String.format("Error transferring %1$s to %2$s", file,
- resourceUrl), e);
- } catch (ResourceDoesNotExistException e) {
- throw new MojoExecutionException(String.format("%1$s does not exist", resourceUrl), e);
- } catch (AuthorizationException e) {
- throw new MojoExecutionException(String.format(
- "Authentication error transferring %1$s to %2$s", file, resourceUrl), e);
- }
- return resourceUrl;
- }
-
- public static void downloadFile(String resourceName, File file, Wagon wagon, Log log)
- throws MojoExecutionException, ResourceDoesNotExistException {
- String resourceUrl = getResourceUrl(wagon, resourceName);
- File digestFile = new File(file.getPath() + ".md5");
- try {
- log.info(String.format("Downloading %1$s to %2$s", resourceUrl, file));
- wagon.get(resourceName, file);
- wagon.get(resourceName + ".md5", digestFile);
- } catch (TransferFailedException e) {
- throw new MojoExecutionException(String.format("Error transferring %1$s to %2$s",
- resourceUrl, file), e);
- } catch (AuthorizationException e) {
- throw new MojoExecutionException(String.format(
- "Authentication error transferring %1$s to %2$s", resourceUrl, file), e);
- }
- try {
- String digestString1 = DigestUtils.md5Hex(new FileInputStream(file));
- String digestString2 = FileUtils.readFileToString(digestFile);
- if (!digestString1.equals(digestString2)) {
- throw new MojoExecutionException(String.format(
- "Error downloading file: digsests not equal. (%1$s != %2$s)",
- digestString1, digestString2));
- }
- } catch (IOException e) {
- throw new MojoExecutionException(String.format("Error checking digest for %1$s", file),
- e);
- }
- }
-
- public static String getResourceUrl(Wagon wagon, String resourceName) {
- StringBuilder urlBuilder = new StringBuilder(wagon.getRepository().getUrl());
- for (String part : resourceName.split("/")) {
- urlBuilder.append('/');
- urlBuilder.append(URLEncoder.encode(part));
- }
- return urlBuilder.toString();
- }
-
- public static String timestamp() {
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmm");
- return dateFormat.format(new Date());
- }
-
- public static Set<String> getJavaPackages(Log log) {
- Set<String> javaPackages = new HashSet<String>();
- InputStream resource = Utils.class.getClassLoader().getResourceAsStream("java7-packages");
- if (resource != null) {
- BufferedReader reader = new BufferedReader(new InputStreamReader(resource));
- try {
- String line = reader.readLine();
- while (line != null) {
- if (!line.isEmpty()) {
- javaPackages.add(line.trim());
- }
- line = reader.readLine();
- }
- } catch (IOException e) {
- log.warn(
- "Problem while reading to readinf java package list from resource file java7-packages",
- e);
- }
- } else {
- log.warn("Unable to read java package list from resource file java7-packages");
- }
- return javaPackages;
- }
-
- public static <T> List<Set<T>> getSubsets(Set<T> set) {
- List<Set<T>> subsets = new ArrayList<Set<T>>();
- List<T> list = new ArrayList<T>(set);
- int numOfSubsets = 1 << set.size();
- for (int i = 0; i < numOfSubsets; i++){
- Set<T> subset = new HashSet<T>();
- for (int j = 0; j < numOfSubsets; j++){
- if (((i>>j) & 1) == 1) {
- subset.add(list.get(j));
- }
- }
- if (!subset.isEmpty()) {
- subsets.add(subset);
- }
- }
- Collections.sort(subsets, new Comparator<Set<T>>() {
- @Override
- public int compare(Set<T> o1, Set<T> o2) {
- return o1.size() - o2.size();
- }
- });
- return subsets;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/resources/META-INF/plexus/components.xml
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/taverna-maven-plugin/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index d458176..0000000
--- a/taverna-maven-plugin/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>taverna-plugin</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
- </implementation>
- <configuration>
- <phases>
- <generate-resources>org.apache.taverna.osgi:taverna-maven-plugin:plugin-generate</generate-resources>
- <prepare-package>org.apache.taverna.osgi:taverna-maven-plugin:plugin-prepare-bundles</prepare-package>
- <package>org.apache.maven.plugins:maven-jar-plugin:jar</package>
- <deploy>org.apache.taverna.osgi:taverna-maven-plugin:plugin-deploy</deploy>
- </phases>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>taverna-application</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
- </implementation>
- <configuration>
- <phases>
- <generate-resources>org.apache.taverna.osgi:taverna-maven-plugin:profile-generate</generate-resources>
- <deploy>org.apache.taverna.osgi:taverna-maven-plugin:profile-deploy</deploy>
- </phases>
- </configuration>
- </component>
- </components>
-</component-set>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/main/resources/java7-packages
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/main/resources/java7-packages b/taverna-maven-plugin/src/main/resources/java7-packages
deleted file mode 100644
index 032c7dd..0000000
--- a/taverna-maven-plugin/src/main/resources/java7-packages
+++ /dev/null
@@ -1,209 +0,0 @@
-java.applet
-java.awt
-java.awt.color
-java.awt.datatransfer
-java.awt.dnd
-java.awt.event
-java.awt.font
-java.awt.geom
-java.awt.im
-java.awt.im.spi
-java.awt.image
-java.awt.image.renderable
-java.awt.print
-java.beans
-java.beans.beancontext
-java.io
-java.lang
-java.lang.annotation
-java.lang.instrument
-java.lang.invoke
-java.lang.management
-java.lang.ref
-java.lang.reflect
-java.math
-java.net
-java.nio
-java.nio.channels
-java.nio.channels.spi
-java.nio.charset
-java.nio.charset.spi
-java.nio.file
-java.nio.file.attribute
-java.nio.file.spi
-java.rmi
-java.rmi.activation
-java.rmi.dgc
-java.rmi.registry
-java.rmi.server
-java.security
-java.security.acl
-java.security.cert
-java.security.interfaces
-java.security.spec
-java.sql
-java.text
-java.text.spi
-java.util
-java.util.concurrent
-java.util.concurrent.atomic
-java.util.concurrent.locks
-java.util.jar
-java.util.logging
-java.util.prefs
-java.util.regex
-java.util.spi
-java.util.zip
-javax.accessibility
-javax.activation
-javax.activity
-javax.annotation
-javax.annotation.processing
-javax.crypto
-javax.crypto.interfaces
-javax.crypto.spec
-javax.imageio
-javax.imageio.event
-javax.imageio.metadata
-javax.imageio.plugins.bmp
-javax.imageio.plugins.jpeg
-javax.imageio.spi
-javax.imageio.stream
-javax.jws
-javax.jws.soap
-javax.lang.model
-javax.lang.model.element
-javax.lang.model.type
-javax.lang.model.util
-javax.management
-javax.management.loading
-javax.management.modelmbean
-javax.management.monitor
-javax.management.openmbean
-javax.management.relation
-javax.management.remote
-javax.management.remote.rmi
-javax.management.timer
-javax.naming
-javax.naming.directory
-javax.naming.event
-javax.naming.ldap
-javax.naming.spi
-javax.net
-javax.net.ssl
-javax.print
-javax.print.attribute
-javax.print.attribute.standard
-javax.print.event
-javax.rmi
-javax.rmi.CORBA
-javax.rmi.ssl
-javax.script
-javax.security.auth
-javax.security.auth.callback
-javax.security.auth.kerberos
-javax.security.auth.login
-javax.security.auth.spi
-javax.security.auth.x500
-javax.security.cert
-javax.security.sasl
-javax.sound.midi
-javax.sound.midi.spi
-javax.sound.sampled
-javax.sound.sampled.spi
-javax.sql
-javax.sql.rowset
-javax.sql.rowset.serial
-javax.sql.rowset.spi
-javax.swing
-javax.swing.border
-javax.swing.colorchooser
-javax.swing.event
-javax.swing.filechooser
-javax.swing.plaf
-javax.swing.plaf.basic
-javax.swing.plaf.metal
-javax.swing.plaf.multi
-javax.swing.plaf.nimbus
-javax.swing.plaf.synth
-javax.swing.table
-javax.swing.text
-javax.swing.text.html
-javax.swing.text.html.parser
-javax.swing.text.rtf
-javax.swing.tree
-javax.swing.undo
-javax.tools
-javax.transaction
-javax.transaction.xa
-javax.xml
-javax.xml.bind
-javax.xml.bind.annotation
-javax.xml.bind.annotation.adapters
-javax.xml.bind.attachment
-javax.xml.bind.helpers
-javax.xml.bind.util
-javax.xml.crypto
-javax.xml.crypto.dom
-javax.xml.crypto.dsig
-javax.xml.crypto.dsig.dom
-javax.xml.crypto.dsig.keyinfo
-javax.xml.crypto.dsig.spec
-javax.xml.datatype
-javax.xml.namespace
-javax.xml.parsers
-javax.xml.soap
-javax.xml.stream
-javax.xml.stream.events
-javax.xml.stream.util
-javax.xml.transform
-javax.xml.transform.dom
-javax.xml.transform.sax
-javax.xml.transform.stax
-javax.xml.transform.stream
-javax.xml.validation
-javax.xml.ws
-javax.xml.ws.handler
-javax.xml.ws.handler.soap
-javax.xml.ws.http
-javax.xml.ws.soap
-javax.xml.ws.spi
-javax.xml.ws.spi.http
-javax.xml.ws.wsaddressing
-javax.xml.xpath
-org.ietf.jgss
-org.omg.CORBA
-org.omg.CORBA_2_3
-org.omg.CORBA_2_3.portable
-org.omg.CORBA.DynAnyPackage
-org.omg.CORBA.ORBPackage
-org.omg.CORBA.portable
-org.omg.CORBA.TypeCodePackage
-org.omg.CosNaming
-org.omg.CosNaming.NamingContextExtPackage
-org.omg.CosNaming.NamingContextPackage
-org.omg.Dynamic
-org.omg.DynamicAny
-org.omg.DynamicAny.DynAnyFactoryPackage
-org.omg.DynamicAny.DynAnyPackage
-org.omg.IOP
-org.omg.IOP.CodecFactoryPackage
-org.omg.IOP.CodecPackage
-org.omg.Messaging
-org.omg.PortableInterceptor
-org.omg.PortableInterceptor.ORBInitInfoPackage
-org.omg.PortableServer
-org.omg.PortableServer.CurrentPackage
-org.omg.PortableServer.POAManagerPackage
-org.omg.PortableServer.POAPackage
-org.omg.PortableServer.portable
-org.omg.PortableServer.ServantLocatorPackage
-org.omg.SendingContext
-org.omg.stub.java.rmi
-org.w3c.dom
-org.w3c.dom.bootstrap
-org.w3c.dom.events
-org.w3c.dom.ls
-org.xml.sax
-org.xml.sax.ext
-org.xml.sax.helpers
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/test/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojoTest.java
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/test/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojoTest.java b/taverna-maven-plugin/src/test/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojoTest.java
deleted file mode 100644
index 6f21fb1..0000000
--- a/taverna-maven-plugin/src/test/java/net/sf/taverna/t2/maven/plugins/TavernaPluginGenerateMojoTest.java
+++ /dev/null
@@ -1,80 +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.maven.plugins;
-
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Unit tests for TavernaPluginGenerateMojo.
- *
- * @author David Withers
- */
-public class TavernaPluginGenerateMojoTest extends AbstractMojoTestCase {
-
- private TavernaPluginGenerateMojo tavernaPluginGenerateMojo;
-
- /**
- * @throws java.lang.Exception
- */
- @Ignore
- public void setUp() throws Exception {
-// super.setUp();
-//
-// File pluginXml = new File( getBasedir(), "src/test/resources/unit/plugin-config.xml" );
-// tavernaPluginGenerateMojo = (TavernaPluginGenerateMojo) lookupMojo( "plugin-generate", pluginXml );
-//
-// MavenProject mavenProject = (MavenProject) getVariableValueFromObject(tavernaPluginGenerateMojo, "project");
-//
-// Artifact artifact = new DefaultArtifact("net.sf.taverna.t2", "example-plugin", VersionRange
-// .createFromVersion("0.1.0"), "compile", "jar", "", null);
-// artifact.setRepository(new DefaultArtifactRepository("id1",
-// "http://www.mygrid.org.uk/maven/repository", new DefaultRepositoryLayout()));
-// mavenProject.setArtifact(artifact);
-//
-//
-// Artifact dependency = new DefaultArtifact("com.example.test", "test-artifact", VersionRange
-// .createFromVersion("1.3.5"), "compile", "jar", "", null);
-// dependency.setGroupId("com.example.test");
-// dependency.setArtifactId("test-artifact");
-// dependency.setVersion("1.3.5");
-// dependency.setRepository(new DefaultArtifactRepository("id2",
-// "http://www.example.com/maven/repository", new DefaultRepositoryLayout()));
-// mavenProject.setDependencyArtifacts(Collections.singleton(dependency));
-//
-// MavenSession session = new MavenSession(getContainer(), (RepositorySystemSession) null, (MavenExecutionRequest) null, (MavenExecutionResult) null);
-// setVariableValueToObject(tavernaPluginGenerateMojo, "session", session);
- }
-
- /**
- * Test method for
- * {@link net.sf.taverna.t2.maven.plugins.TavernaPluginGenerateMojo#execute()}
- *
- * @throws Exception
- */
- @Test
- @Ignore
- public void testExecute() throws Exception {
-// tavernaPluginGenerateMojo.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-osgi/blob/2f5a0e94/taverna-maven-plugin/src/test/resources/unit/plugin-config.xml
----------------------------------------------------------------------
diff --git a/taverna-maven-plugin/src/test/resources/unit/plugin-config.xml b/taverna-maven-plugin/src/test/resources/unit/plugin-config.xml
deleted file mode 100644
index 0d23438..0000000
--- a/taverna-maven-plugin/src/test/resources/unit/plugin-config.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<project>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-maven-plugin</artifactId>
- <configuration>
- <buildDirectory>${basedir}/target/test/unit</buildDirectory>
- <project>
- <groupId>com.example</groupId>
- <artifactId>example-plugin</artifactId>
- <version>0.1.0</version>
- <name>Example Plugin</name>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>