SLC Repo building
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 13 Feb 2015 15:33:58 +0000 (15:33 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 13 Feb 2015 15:33:58 +0000 (15:33 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@7844 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

52 files changed:
dep/org.argeo.slc.dep.backend/bnd.bnd [new file with mode: 0644]
dep/org.argeo.slc.dep.backend/pom.xml
dep/org.argeo.slc.dep.minimal/bnd.bnd [new file with mode: 0644]
dep/org.argeo.slc.dep.minimal/pom.xml
dep/pom.xml
org.argeo.slc.core/bin/log4j.properties [deleted file]
org.argeo.slc.repo/src/org/argeo/slc/repo/ArtifactDistribution.java
org.argeo.slc.repo/src/org/argeo/slc/repo/ArtifactIndexer.java
org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionFactory.java
org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionIndexer.java
org.argeo.slc.repo/src/org/argeo/slc/repo/PdeSourcesIndexer.java
org.argeo.slc.repo/src/org/argeo/slc/repo/RepoUtils.java
org.argeo.slc.repo/src/org/argeo/slc/repo/RpmIndexer.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/ConvertPoms_01_03.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/GenerateBinaries.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/ImportMavenDependencies.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/IndexDistribution.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/MavenConventionsUtils.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/MavenProxyServiceImpl.java
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/Migration_01_03.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/ArchiveWrapper.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/BndWrapper.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/ImportBundlesZip.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/MavenWrapper.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/NormalizeGroup.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/OsgiFactoryImpl.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/ProcessDistribution.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/UriWrapper.java
org.argeo.slc.support/.classpath
org.argeo.slc.support/ext/test/org/argeo/slc/aether/AetherUtilsTest.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/AetherTemplate.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/AetherUtils.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/ArtifactIdComparator.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/ConsoleRepositoryListener.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/ConsoleTransferListener.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/SimpleArtifactDescriptorReader.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/SimpleVersionRangeResolver.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/SimpleVersionResolver.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/osgi/OsgiVersion.java [new file with mode: 0644]
org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java [new file with mode: 0644]
pom.xml
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/AetherTemplate.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/AetherUtils.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ArtifactIdComparator.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ConsoleRepositoryListener.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ConsoleTransferListener.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleArtifactDescriptorReader.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleVersionRangeResolver.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleVersionResolver.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/osgi/OsgiVersion.java [deleted file]
runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java [deleted file]
runtime/org.argeo.slc.support.aether/src/test/java/org/argeo/slc/aether/AetherUtilsTest.java [deleted file]

diff --git a/dep/org.argeo.slc.dep.backend/bnd.bnd b/dep/org.argeo.slc.dep.backend/bnd.bnd
new file mode 100644 (file)
index 0000000..e69de29
index 82b0bbd67ca6f4973244ca09b726371f39a0d9ba..3224adba0c87b2e6a638277f36dbd8f066b9b416 100644 (file)
                <!-- Extensions -->
                <dependency>
                        <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.support.simple</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.support.ant</artifactId>
+                       <artifactId>org.argeo.slc.support</artifactId>
                        <version>2.1.1-SNAPSHOT</version>
                </dependency>
 
                <!-- SLC Repo -->
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.repo</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.rpmfactory</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.server.repo</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.server.repo.webapp</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.repo</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.factory</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.server.repo</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.server.repo.webapp</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
 
                <!-- Node -->
                <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
+                       <groupId>org.argeo.commons</groupId>
                        <artifactId>org.argeo.security.dep.node</artifactId>
                        <version>${version.argeo-commons}</version>
                        <type>pom</type>
diff --git a/dep/org.argeo.slc.dep.minimal/bnd.bnd b/dep/org.argeo.slc.dep.minimal/bnd.bnd
new file mode 100644 (file)
index 0000000..e69de29
index 48ed7aabebd364fc131d7858f556c1bcea630f69..513a626498efa6d24ec1861c60026d73590d67a1 100644 (file)
                        <artifactId>org.argeo.slc.core</artifactId>
                        <version>2.1.1-SNAPSHOT</version>
                </dependency>
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.agent</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
                <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.support.osgi</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.support.equinox</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.agent</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.base</groupId>
+                       <groupId>org.argeo.commons</groupId>
                        <artifactId>org.argeo.osgi.boot</artifactId>
                        <version>${version.argeo-commons}</version>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.osgi.extender</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.base</groupId>
-                       <artifactId>org.argeo.dep.log4j</artifactId>
-                       <version>${version.argeo-commons}</version>
-                       <type>pom</type>
-               </dependency>
 
                <!-- CLI Agent -->
 <!--           <dependency> -->
 <!--                   <artifactId>org.argeo.slc.launcher</artifactId> -->
 <!--                   <version>1.1.12-SNAPSHOT</version> -->
 <!--           </dependency> -->
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.agent.cli</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.agent.cli</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
 
                <!-- JCR Agent -->
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.support.jcr</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.agent.jcr</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.node.jackrabbit</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.agent.jcr</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
+<!--           <dependency> -->
+<!--                   <groupId>org.argeo.slc</groupId> -->
+<!--                   <artifactId>org.argeo.slc.node.jackrabbit</artifactId> -->
+<!--                   <version>2.1.1-SNAPSHOT</version> -->
+<!--           </dependency> -->
 
                <!-- Node subset -->
                <!-- Default JCR repositories configurations -->
                <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.node.repo.jackrabbit</artifactId>
+                       <groupId>org.argeo.commons</groupId>
+                       <artifactId>org.argeo.cms</artifactId>
                        <version>${version.argeo-commons}</version>
                </dependency>
 
                <!-- Argeo Security -->
                <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
+                       <groupId>org.argeo.commons</groupId>
                        <artifactId>org.argeo.security.core</artifactId>
                        <version>${version.argeo-commons}</version>
                </dependency>
 
-               <!-- VFS -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.vfs</artifactId>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>org.argeo.tp</groupId>
-                                       <artifactId>org.apache.xmlcommons</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-
-               <!-- Xerces and Xalan -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.xmlcommons</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.xalan</artifactId>
-               </dependency>
-
-               <!-- Javax -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>javax.annotation</artifactId>
-               </dependency>
-
-               <!-- Jackrabbit -->
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.jackrabbit</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.jackrabbit</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-
-               <!-- Security (Jackrabbit) -->
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.dao.jackrabbit</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-
-               <!-- Security (Standalone) -->
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.dao.os</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-
-               <!-- DB drivers -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.h2</artifactId>
-               </dependency>
        </dependencies>
        <profiles>
                <profile>
index 2f8f8e9e0ef2bd672cfdfe14d1de0ddeb8c944f5..82886744336dd6f2f0250da01414ce14302f43db 100644 (file)
        <name>SLC Dependencies</name>
        <packaging>pom</packaging>
        <modules>
-               <module>org.argeo.slc.dep.detached</module>
                <module>org.argeo.slc.dep.minimal</module>
                <module>org.argeo.slc.dep.backend</module>
-               <module>org.argeo.slc.dep.eclipse</module>
-               <module>org.argeo.slc.dep.rcp</module>
-               <module>org.argeo.slc.dep.rap</module>
+<!--           <module>org.argeo.slc.dep.eclipse</module> -->
+<!--           <module>org.argeo.slc.dep.rcp</module> -->
+<!--           <module>org.argeo.slc.dep.rap</module> -->
        </modules>
        <build>
                <plugins>
diff --git a/org.argeo.slc.core/bin/log4j.properties b/org.argeo.slc.core/bin/log4j.properties
deleted file mode 100644 (file)
index 0133bab..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.\r
-log4j.rootLogger=WARN, console\r
-\r
-## Levels\r
-# Slc\r
-log4j.logger.org.argeo=DEBUG\r
-\r
-# Castor\r
-log4j.logger.org.exolab.castor=WARN\r
-\r
-# Spring\r
-log4j.logger.org.springframework=WARN\r
-\r
-\r
-## Appenders\r
-# A1 is set to be a ConsoleAppender.\r
-log4j.appender.console=org.apache.log4j.ConsoleAppender\r
-\r
-# A1 uses PatternLayout.\r
-log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n\r
-\r
index d76da463a044b06b8afbb56658bcce4e8486fe5f..9a03b0157579b4522cfc67f1e04e07dde36c9e41 100644 (file)
@@ -2,8 +2,8 @@ package org.argeo.slc.repo;
 
 import org.argeo.slc.CategorizedNameVersion;
 import org.argeo.slc.build.Distribution;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /** A {@link Distribution} based on an Aether {@link Artifact} */
 public class ArtifactDistribution implements Distribution,
index 27c6806a3e98d062c43462e5ffcf67c95f8e6dbb..377b35a7534bc05ff2399d3c68144e46a2092e3c 100644 (file)
@@ -28,7 +28,7 @@ import org.argeo.slc.aether.AetherUtils;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 import org.osgi.framework.Constants;
-import org.sonatype.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.Artifact;
 
 /**
  * Add {@link Artifact} properties to a {@link Node}. Does nothing if the node
index 79d3b5175ef8870e810f286b3c191d1d08e962a5..af96f232d10198084a4bb926d023175dbf7969b8 100644 (file)
@@ -23,8 +23,8 @@ import org.argeo.slc.CategorizedNameVersion;
 import org.argeo.slc.NameVersion;
 import org.argeo.slc.SlcException;
 import org.osgi.framework.Constants;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Creates a jar bundle from an ArgeoOsgiDistribution. This jar is then
index bca049618dd996a2abc04ec1bbc11521414e8a98..7b445345b1745d42f9ce65db7bbce6b6434e018a 100644 (file)
@@ -29,8 +29,8 @@ import org.argeo.slc.build.Distribution;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 import org.osgi.framework.Constants;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Create or update JCR meta-data for an SLC Modular Distribution
index 97ca286ce31e10f27e3661954f4d2237d27f5aca..bcaa7302ec68b992efc3da7237c8e9de6694565b 100644 (file)
@@ -29,8 +29,8 @@ import org.argeo.slc.NameVersion;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.aether.AetherUtils;
 import org.argeo.slc.repo.maven.MavenConventionsUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Creates pde sources from a source {@link Artifact} with name
index 4a175ac594ce641569e269bd37c6c201d753e5a3..f03319ae358593ccfef11ce83a6fb0dc702a9552 100644 (file)
@@ -65,8 +65,8 @@ import org.argeo.slc.jcr.SlcTypes;
 import org.argeo.slc.repo.maven.MavenConventionsUtils;
 import org.argeo.util.security.Keyring;
 import org.osgi.framework.Constants;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /** Utilities around repo */
 public class RepoUtils implements ArgeoNames, SlcNames {
index 57b93b8ec26f365a2df7b3ed7ad41072f9572058..f3675de71d68ae37498e2941a46130d89ff39518 100644 (file)
@@ -1,7 +1,7 @@
 package org.argeo.slc.repo;
 
-import static org.freecompany.redline.header.Header.HeaderTag.HEADERIMMUTABLE;
-import static org.freecompany.redline.header.Signature.SignatureTag.SIGNATURES;
+import static org.redline_rpm.header.Header.HeaderTag.HEADERIMMUTABLE;
+import static org.redline_rpm.header.Signature.SignatureTag.SIGNATURES;
 
 import java.io.InputStream;
 import java.nio.ByteBuffer;
@@ -15,11 +15,11 @@ import org.apache.commons.io.FilenameUtils;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
-import org.freecompany.redline.ChannelWrapper.Key;
-import org.freecompany.redline.ReadableChannelWrapper;
-import org.freecompany.redline.header.AbstractHeader;
-import org.freecompany.redline.header.Format;
-import org.freecompany.redline.header.Header;
+import org.redline_rpm.ChannelWrapper.Key;
+import org.redline_rpm.ReadableChannelWrapper;
+import org.redline_rpm.header.AbstractHeader;
+import org.redline_rpm.header.Format;
+import org.redline_rpm.header.Header;
 
 /** Indexes an RPM file. */
 public class RpmIndexer implements NodeIndexer, SlcNames {
index 12cf490050d76f4416e32dfd9851c190bc2aa192..f051715130ce2925c19220c2298d11b7cf8c932c 100644 (file)
@@ -56,7 +56,7 @@ public class ConvertPoms_01_03 implements Runnable {
                                "org.apache.activemq.optional");
                artifactMapping.put("org.argeo.dep.osgi.activemq.xmpp",
                                "org.apache.activemq.xmpp");
-               artifactMapping.put("org.argeo.dep.osgi.aether", "org.sonatype.aether");
+               artifactMapping.put("org.argeo.dep.osgi.aether", "org.eclipse.aether");
                artifactMapping.put("org.argeo.dep.osgi.boilerpipe",
                                "de.l3s.boilerpipe");
                artifactMapping.put("org.argeo.dep.osgi.commons.cli",
index cd5283db4e1b568ff61d4bd1cff6a753df814cf4..a745bb22e25e8ddd26c38dda870b4b08b96df541 100644 (file)
@@ -40,8 +40,8 @@ import org.argeo.slc.repo.ArtifactIndexer;
 import org.argeo.slc.repo.RepoConstants;
 import org.argeo.slc.repo.RepoUtils;
 import org.osgi.framework.Version;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Generates binaries-, sources- and sdk-version.pom artifacts for a given
index d1245ff956ddb381481446974ee6df1f21dee546..c2b4203747f537116689a185719f640a43b7c99d 100644 (file)
@@ -41,9 +41,9 @@ import org.argeo.slc.repo.ArtifactIndexer;
 import org.argeo.slc.repo.JarFileIndexer;
 import org.argeo.slc.repo.RepoConstants;
 import org.argeo.slc.repo.RepoUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Import all the dependencies listed in a POM and their dependency graphs to a
index 758316d3290b695d945010a12672d35a6f5ce36e..63e7d874c136d0854052bfe2b90b3a0f84d84e20 100644 (file)
@@ -31,7 +31,7 @@ import org.argeo.slc.SlcException;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 import org.argeo.slc.repo.RepoConstants;
-import org.sonatype.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.Artifact;
 
 /** Create a distribution node from a set of artifacts */
 public class IndexDistribution implements Runnable {
index 4e8d3fb832f54ac6c6f24d905e4c8850682f3209..1ec361ac2d7089eff515d588b88bb593a4386db7 100644 (file)
@@ -26,8 +26,8 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.aether.AetherTemplate;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
index fcd65d954d3dfd289fe40d1fd4144947e1214bb1..0349f3587cbb597b85a2d7f26be9dd2ac7f657a0 100644 (file)
@@ -37,7 +37,7 @@ import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 import org.argeo.slc.repo.MavenProxyService;
 import org.argeo.slc.repo.RepoConstants;
-import org.sonatype.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.RemoteRepository;
 
 /** Synchronises the node repository with remote Maven repositories */
 public class MavenProxyServiceImpl extends AbstractUrlProxy implements
index baf6ec723e0f852b4370e79c5921552de3391533..7eb2e523ec982acdff19280b243463a6ea6acc2e 100644 (file)
@@ -50,8 +50,8 @@ import org.argeo.slc.repo.JarFileIndexer;
 import org.argeo.slc.repo.RepoUtils;
 import org.argeo.slc.repo.osgi.OsgiProfile;
 import org.osgi.framework.Constants;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Migrate the distribution from 1.2 to 1.4 by cleaning naming and dependencies.
index 29fa8f14d8dba8790cb631241307d924c3eaeb3e..9a9e96f013147950b2be0889d8929500618e0bfd 100644 (file)
@@ -35,8 +35,8 @@ import org.argeo.slc.build.Distribution;
 import org.argeo.slc.build.License;
 import org.argeo.slc.repo.OsgiFactory;
 import org.argeo.slc.repo.RepoUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 import org.springframework.util.AntPathMatcher;
 import org.springframework.util.PathMatcher;
 
index fce521181686c1cf604e3383ae2a675c9bc39fe4..1c9a5f89007f87caf32775063d2eb9d74cca8de6 100644 (file)
@@ -14,8 +14,8 @@ import org.argeo.slc.SlcException;
 import org.argeo.slc.build.Distribution;
 import org.argeo.slc.build.License;
 import org.osgi.framework.Version;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 import org.springframework.beans.factory.BeanNameAware;
 
 import aQute.lib.osgi.Builder;
index 80574f8f66d8f27053a81717f8036317c3737674..fbc44b3e0e0fae545acf7449a43d69f5f2ab8d9b 100644 (file)
@@ -37,8 +37,8 @@ import org.argeo.slc.SlcException;
 import org.argeo.slc.repo.ArtifactIndexer;
 import org.argeo.slc.repo.JarFileIndexer;
 import org.argeo.slc.repo.RepoUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Import all bundles in a zip file (typically an Eclipse distribution) into the
index ab7daeb111b311c78fb6e4d04c8768f7919a65d1..a00a2bd4f7d9920c2c8e66723e7a946314d5da74 100644 (file)
@@ -16,9 +16,9 @@ import org.argeo.slc.DefaultNameVersion;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.repo.OsgiFactory;
 import org.argeo.slc.repo.RepoUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.artifact.SubArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.util.artifact.SubArtifact;
 
 /**
  * BND wrapper based on a Maven artifact available from one of the configured
index 99f31bb0414ae047c913ed7c6641ae1e09f60bee..ef61bf11c57f3701ac32e25068c4424f293c2ff1 100644 (file)
@@ -44,8 +44,8 @@ import org.argeo.slc.repo.RepoUtils;
 import org.argeo.slc.repo.maven.MavenConventionsUtils;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  * Make sure that all JCR metadata and Maven metadata are consistent for this
index bd4f4311ce94595120145ce67dfafb8ed58d1984..0f918fdc334d5bee424d190a54d706351b5a3089 100644 (file)
@@ -28,8 +28,8 @@ import org.argeo.slc.jcr.SlcTypes;
 import org.argeo.slc.repo.NodeIndexer;
 import org.argeo.slc.repo.OsgiFactory;
 import org.argeo.slc.repo.maven.MavenConventionsUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /** Default implementation of {@link OsgiFactory}. */
 public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
index d16a797420f7f39c71d5887bd76485134be1b614..74c54252827a4d3c9330ba14c2d68fd017ca5981 100644 (file)
@@ -16,8 +16,8 @@ import org.argeo.slc.repo.ArgeoOsgiDistribution;
 import org.argeo.slc.repo.ModularDistributionFactory;
 import org.argeo.slc.repo.OsgiFactory;
 import org.argeo.slc.repo.maven.MavenConventionsUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /** Executes the processes required so that all managed bundles are available. */
 public class ProcessDistribution implements Runnable {
index cf0422e4309e66dcaed5a124498e3e0bd5d6e247..819b623865546d370167a1eb0eeb75680687f7e3 100644 (file)
@@ -18,8 +18,8 @@ import org.argeo.slc.DefaultNameVersion;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.repo.OsgiFactory;
 import org.argeo.slc.repo.RepoUtils;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 import aQute.lib.osgi.Jar;
 
index bc86c42397ef126c77ef584a0472c9bec18d36ac..70b08e83018b29c72264fa37f2b23597484264ee 100644 (file)
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" output="target/classes" path="src"/>
+       <classpathentry kind="src" path="ext/test"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>>>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/org.argeo.slc.support/ext/test/org/argeo/slc/aether/AetherUtilsTest.java b/org.argeo.slc.support/ext/test/org/argeo/slc/aether/AetherUtilsTest.java
new file mode 100644 (file)
index 0000000..ba22397
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+
+import junit.framework.TestCase;
+
+public class AetherUtilsTest extends TestCase {
+       public void testConvertPathToArtifact() throws Exception {
+               checkPathConversion("my.group.id:my-artifactId:pom:1.2.3",
+                               "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3.pom");
+               checkPathConversion("my.group.id:my-artifactId:pom:1.2.3-SNAPSHOT",
+                               "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT.pom");
+               checkPathConversion("my.group.id:my-artifactId:pom:myClassifier:1.2.3",
+                               "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3-myClassifier.pom");
+               checkPathConversion(
+                               "my.group.id:my-artifactId:pom:myClassifier:1.2.3-SNAPSHOT",
+                               "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT-myClassifier.pom");
+               checkPathConversion(
+                               "my.group.id:my-artifactId:pom:myClassifier:20110828.223836-2",
+                               "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-20110828.223836-2-myClassifier.pom");
+       }
+
+       public void testConvertPathToArtifactRealLife() throws Exception {
+               checkPathConversion(
+                               "org.apache.maven.plugins:maven-antrun-plugin:pom:1.1",
+                               "org/apache/maven/plugins/maven-antrun-plugin/1.1/maven-antrun-plugin-1.1.pom");
+               checkPathConversion(
+                               "org.apache.maven.plugins:maven-plugin-parent:pom:2.0.1",
+                               "org/apache/maven/plugins/maven-plugin-parent/2.0.1/maven-plugin-parent-2.0.1.pom");
+               checkPathConversion(
+                               "org.apache.avalon.framework:avalon-framework-impl:pom:4.3.1",
+                               "org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.pom");
+               checkPathConversion(
+                               "org.apache.maven.shared:maven-dependency-tree:pom:1.2",
+                               "org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.pom");
+               checkPathConversion(
+                               "org.argeo.maven.plugins:maven-argeo-osgi-plugin:pom:1.0.33",
+                               "org/argeo/maven/plugins/maven-argeo-osgi-plugin/1.0.33/maven-argeo-osgi-plugin-1.0.33.pom");
+               checkPathConversion(
+                               "org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1",
+                               "org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom");
+       }
+
+       protected void checkPathConversion(String expectedArtifact, String path) {
+               Artifact artifact = AetherUtils.convertPathToArtifact(path, null);
+               if (expectedArtifact == null)
+                       assertNull(artifact);
+               else
+                       assertEquals(new DefaultArtifact(expectedArtifact), artifact);
+       }
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/AetherTemplate.java b/org.argeo.slc.support/src/org/argeo/slc/aether/AetherTemplate.java
new file mode 100644 (file)
index 0000000..a83caa1
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import java.io.File;
+import java.util.List;
+
+import org.argeo.slc.SlcException;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.ArtifactResult;
+
+/** Simplifies access to Aether. */
+public class AetherTemplate {
+       private RepositorySystem repositorySystem;
+       private RepositorySystemSession repositorySystemSession;
+       private List<RemoteRepository> remoteRepositories;
+
+       /** Resolves the artifact in order to give access to its file. */
+       public File getResolvedFile(Artifact artifact) {
+               try {
+                       ArtifactRequest artifactRequest = new ArtifactRequest(artifact,
+                                       remoteRepositories, null);
+                       ArtifactResult result = repositorySystem.resolveArtifact(
+                                       repositorySystemSession, artifactRequest);
+                       return result.getArtifact().getFile();
+               } catch (ArtifactResolutionException e) {
+                       throw new SlcException("Cannot resolve " + artifact, e);
+               }
+       }
+
+       /**
+        * Transitively resolves the dependencies of this artifact (with scope
+        * 'compile')
+        * 
+        * @param artifact
+        *            the artifact to resolve
+        */
+       public DependencyNode resolveDependencies(Artifact artifact) {
+               return resolveDependencies(artifact, "compile");
+       }
+
+       /**
+        * Transitively resolves the dependencies of this artifact.
+        * 
+        * @param artifact
+        *            the artifact to resolve
+        * @param scope
+        *            the scope
+        */
+       public DependencyNode resolveDependencies(Artifact artifact, String scope) {
+               try {
+                       Dependency dependency = new Dependency(artifact, scope);
+                       CollectRequest collectRequest = new CollectRequest();
+                       collectRequest.setRoot(dependency);
+                       for (RemoteRepository remoteRepository : remoteRepositories)
+                               collectRequest.addRepository(remoteRepository);
+                       DependencyNode node = repositorySystem.collectDependencies(
+                                       repositorySystemSession, collectRequest).getRoot();
+
+                       // FIXME adapt to changes in Aether
+                       // repositorySystem.resolveDependencies(repositorySystemSession,
+                       // node,
+                       // null);
+                       return node;
+               } catch (Exception e) {
+                       throw new SlcException("Cannot resolve dependencies of " + artifact
+                                       + " (scope: " + scope + ")", e);
+               }
+       }
+
+       public RepositorySystem getRepositorySystem() {
+               return repositorySystem;
+       }
+
+       public void setRepositorySystem(RepositorySystem repositorySystem) {
+               this.repositorySystem = repositorySystem;
+       }
+
+       public RepositorySystemSession getRepositorySystemSession() {
+               return repositorySystemSession;
+       }
+
+       public void setRepositorySystemSession(
+                       RepositorySystemSession repositorySystemSession) {
+               this.repositorySystemSession = repositorySystemSession;
+       }
+
+       public List<RemoteRepository> getRemoteRepositories() {
+               return remoteRepositories;
+       }
+
+       public void setRemoteRepositories(List<RemoteRepository> remoteRepositories) {
+               this.remoteRepositories = remoteRepositories;
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/AetherUtils.java b/org.argeo.slc.support/src/org/argeo/slc/aether/AetherUtils.java
new file mode 100644 (file)
index 0000000..8da332b
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import java.util.regex.Pattern;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.SlcException;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.artifact.DefaultArtifact;
+
+/** Utilities related to Aether */
+public class AetherUtils {
+       public final static String SNAPSHOT = "SNAPSHOT";
+       // hacked from aether
+       public static final Pattern SNAPSHOT_TIMESTAMP = Pattern
+                       .compile("^(.*-)?([0-9]{8}.[0-9]{6}-[0-9]+)$");
+
+       private final static Log log = LogFactory.getLog(AetherUtils.class);
+
+       /** Logs a dependency node and its transitive dependencies as a tree. */
+       public static void logDependencyNode(int depth,
+                       DependencyNode dependencyNode) {
+               if (!log.isDebugEnabled())
+                       return;
+
+               StringBuffer prefix = new StringBuffer(depth * 2 + 2);
+               // prefix.append("|-");
+               for (int i = 0; i < depth * 2; i++) {
+                       prefix.append(' ');
+               }
+               Artifact artifact = dependencyNode.getDependency().getArtifact();
+               log.debug(prefix + "|-> " + artifact.getArtifactId() + " ["
+                               + artifact.getVersion() + "]"
+                               + (dependencyNode.getDependency().isOptional() ? " ?" : ""));
+               for (DependencyNode child : dependencyNode.getChildren()) {
+                       logDependencyNode(depth + 1, child);
+               }
+       }
+
+       /**
+        * Converts a path (relative to a repository root) to an {@link Artifact}.
+        * 
+        * @param path
+        *            the relative path
+        * @param type
+        *            the layout type, currently ignored because only the 'default'
+        *            Maven 2 layout is currently supported:
+        *            /my/group/id/artifactId/
+        *            version/artifactId-version[-classifier].extension
+        * @return the related artifact or null if the file is not an artifact
+        *         (Maven medata data XML files, check sums, etc.)
+        */
+       public static Artifact convertPathToArtifact(String path, String type) {
+               // TODO rewrite it with regexp (unit tests first!)
+
+               // normalize
+               if (path.startsWith("/"))
+                       path = path.substring(1);
+
+               // parse group id
+               String[] tokensSlash = path.split("/");
+               if (tokensSlash.length < 4)
+                       return null;
+               StringBuffer groupId = new StringBuffer(path.length());
+               for (int i = 0; i < tokensSlash.length - 3; i++) {
+                       if (i != 0)
+                               groupId.append('.');
+                       groupId.append(tokensSlash[i]);
+               }
+               String artifactId = tokensSlash[tokensSlash.length - 3];
+               String baseVersion = tokensSlash[tokensSlash.length - 2];
+               String fileName = tokensSlash[tokensSlash.length - 1];
+
+               if (!fileName.startsWith(artifactId))
+                       return null;
+               // FIXME make it configurable? (via an argument?)
+               if (FilenameUtils.isExtension(fileName, new String[] { "sha1", "md5" }))
+                       return null;
+
+               String extension = FilenameUtils.getExtension(fileName);
+               String baseName = FilenameUtils.getBaseName(fileName);
+
+               // check since we assume hereafter
+               if (!baseName.startsWith(artifactId))
+                       throw new SlcException("Base name '" + baseName
+                                       + " does not start with artifact id '" + artifactId
+                                       + "' in " + path);
+
+               boolean isSnapshot = baseVersion.endsWith("-" + SNAPSHOT);
+               String baseBaseVersion = isSnapshot ? baseVersion.substring(0,
+                               baseVersion.length() - SNAPSHOT.length() - 1) : baseVersion;
+               int artifactAndBaseBaseVersionLength = artifactId.length() + 1
+                               + baseBaseVersion.length() + 1;
+               String classifier = null;
+               if (baseName.length() > artifactAndBaseBaseVersionLength) {
+                       String dashRest = baseName
+                                       .substring(artifactAndBaseBaseVersionLength);
+                       String[] dashes = dashRest.split("-");
+
+                       if (isSnapshot) {
+                               if (dashes[0].equals(SNAPSHOT)) {
+                                       if (dashRest.length() > SNAPSHOT.length() + 1)
+                                               classifier = dashRest.substring(SNAPSHOT.length() + 1);
+
+                               } else {
+                                       if (dashes.length > 2)// assume no '-' in classifier
+                                               classifier = dashes[2];
+                               }
+                       } else {
+                               if (dashes.length > 0)
+                                       classifier = dashes[0];
+                       }
+               }
+
+               // classifier
+               // String classifier = null;
+               // int firstDash = baseName.indexOf('-');
+               // int classifierDash = baseName.lastIndexOf('-');
+               // if (classifierDash > 0 && classifierDash != firstDash) {
+               // classifier = baseName.substring(classifierDash + 1);
+               // }
+               // if (isSnapshot && classifier != null) {
+               // if (classifier.equals(SNAPSHOT))
+               // classifier = null;
+               // else
+               // try {
+               // Long.parseLong(classifier); // build number
+               // // if not failed this is a timestamped version
+               // classifier = null;
+               // } catch (NumberFormatException e) {
+               // // silent
+               // }
+               // }
+
+               // version
+               String version = baseName.substring(artifactId.length() + 1);
+               if (classifier != null)
+                       version = version.substring(0,
+                                       version.length() - classifier.length() - 1);
+
+               // consistency checks
+               if (!isSnapshot && !version.equals(baseVersion))
+                       throw new SlcException("Base version '" + baseVersion
+                                       + "' and version '" + version + "' not in line in " + path);
+               if (!isSnapshot && isSnapshotVersion(version))
+                       throw new SlcException("SNAPSHOT base version '" + baseVersion
+                                       + "' and version '" + version + "' not in line in " + path);
+
+               DefaultArtifact artifact = new DefaultArtifact(groupId.toString(),
+                               artifactId, classifier, extension, version);
+               return artifact;
+       }
+
+       /** Hacked from aether */
+       public static boolean isSnapshotVersion(String version) {
+               return version.endsWith(SNAPSHOT)
+                               || SNAPSHOT_TIMESTAMP.matcher(version).matches();
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/ArtifactIdComparator.java b/org.argeo.slc.support/src/org/argeo/slc/aether/ArtifactIdComparator.java
new file mode 100644 (file)
index 0000000..6aa0ec6
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import java.util.Comparator;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * Compare two artifacts, for use in {@link TreeSet} / {@link TreeMap}, consider
+ * artifactId first THEN groupId
+ */
+public class ArtifactIdComparator implements Comparator<Artifact> {
+       public int compare(Artifact o1, Artifact o2) {
+               if (o1.getArtifactId().equals(o2.getArtifactId()))
+                       return o1.getGroupId().compareTo(o2.getGroupId());
+               return o1.getArtifactId().compareTo(o2.getArtifactId());
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/ConsoleRepositoryListener.java b/org.argeo.slc.support/src/org/argeo/slc/aether/ConsoleRepositoryListener.java
new file mode 100644 (file)
index 0000000..727c5f3
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.aether.AbstractRepositoryListener;
+import org.eclipse.aether.RepositoryEvent;
+
+public class ConsoleRepositoryListener extends AbstractRepositoryListener {
+
+       private final static Log log = LogFactory
+                       .getLog(ConsoleRepositoryListener.class);
+
+       public void artifactDeployed(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.debug("Deployed " + event.getArtifact() + " to "
+                                       + event.getRepository());
+       }
+
+       public void artifactDeploying(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Deploying " + event.getArtifact() + " to "
+                                       + event.getRepository());
+       }
+
+       public void artifactDescriptorInvalid(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.warn("Invalid artifact descriptor for " + event.getArtifact()
+                                       + ": " + event.getException().getMessage());
+       }
+
+       public void artifactDescriptorMissing(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.warn("Missing artifact descriptor for " + event.getArtifact());
+       }
+
+       public void artifactInstalled(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.debug("Installed " + event.getArtifact() + " to "
+                                       + event.getFile());
+       }
+
+       public void artifactInstalling(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Installing " + event.getArtifact() + " to "
+                                       + event.getFile());
+       }
+
+       public void artifactResolved(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Resolved artifact " + event.getArtifact() + " from "
+                                       + event.getRepository());
+       }
+
+       public void artifactDownloading(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Downloading artifact " + event.getArtifact() + " from "
+                                       + event.getRepository());
+       }
+
+       public void artifactDownloaded(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.debug("Downloaded artifact " + event.getArtifact() + " from "
+                                       + event.getRepository());
+       }
+
+       public void artifactResolving(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Resolving artifact " + event.getArtifact());
+       }
+
+       public void metadataDeployed(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.debug("Deployed " + event.getMetadata() + " to "
+                                       + event.getRepository());
+       }
+
+       public void metadataDeploying(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Deploying " + event.getMetadata() + " to "
+                                       + event.getRepository());
+       }
+
+       public void metadataInstalled(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.debug("Installed " + event.getMetadata() + " to "
+                                       + event.getFile());
+       }
+
+       public void metadataInstalling(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Installing " + event.getMetadata() + " to "
+                                       + event.getFile());
+       }
+
+       public void metadataInvalid(RepositoryEvent event) {
+               if (log.isDebugEnabled())
+                       log.debug("Invalid metadata " + event.getMetadata());
+       }
+
+       public void metadataResolved(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Resolved metadata " + event.getMetadata() + " from "
+                                       + event.getRepository());
+       }
+
+       public void metadataResolving(RepositoryEvent event) {
+               if (log.isTraceEnabled())
+                       log.trace("Resolving metadata " + event.getMetadata() + " from "
+                                       + event.getRepository());
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/ConsoleTransferListener.java b/org.argeo.slc.support/src/org/argeo/slc/aether/ConsoleTransferListener.java
new file mode 100644 (file)
index 0000000..3543d68
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import java.io.PrintStream;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.aether.transfer.AbstractTransferListener;
+import org.eclipse.aether.transfer.TransferEvent;
+import org.eclipse.aether.transfer.TransferResource;
+
+public class ConsoleTransferListener extends AbstractTransferListener {
+       private final static Log log = LogFactory
+                       .getLog(ConsoleTransferListener.class);
+
+       private PrintStream out;
+
+       private Map<TransferResource, Long> downloads = new ConcurrentHashMap<TransferResource, Long>();
+
+       private int lastLength;
+
+       public ConsoleTransferListener(PrintStream out) {
+               this.out = (out != null) ? out : System.out;
+       }
+
+       @Override
+       public void transferInitiated(TransferEvent event) {
+               String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading"
+                               : "Downloading";
+
+               if (log.isDebugEnabled())
+                       log.debug(message + ": " + event.getResource().getRepositoryUrl()
+                                       + event.getResource().getResourceName());
+       }
+
+       @Override
+       public void transferProgressed(TransferEvent event) {
+               TransferResource resource = event.getResource();
+               downloads.put(resource, Long.valueOf(event.getTransferredBytes()));
+
+               StringBuilder buffer = new StringBuilder(64);
+
+               for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
+                       long total = entry.getKey().getContentLength();
+                       long complete = entry.getValue().longValue();
+
+                       buffer.append(getStatus(complete, total)).append("  ");
+               }
+
+               int pad = lastLength - buffer.length();
+               lastLength = buffer.length();
+               pad(buffer, pad);
+               buffer.append('\r');
+
+               out.print(buffer);
+       }
+
+       private String getStatus(long complete, long total) {
+               if (total >= 1024) {
+                       return toKB(complete) + "/" + toKB(total) + " KB ";
+               } else if (total >= 0) {
+                       return complete + "/" + total + " B ";
+               } else if (complete >= 1024) {
+                       return toKB(complete) + " KB ";
+               } else {
+                       return complete + " B ";
+               }
+       }
+
+       private void pad(StringBuilder buffer, int spaces) {
+               String block = "                                        ";
+               while (spaces > 0) {
+                       int n = Math.min(spaces, block.length());
+                       buffer.append(block, 0, n);
+                       spaces -= n;
+               }
+       }
+
+       @Override
+       public void transferSucceeded(TransferEvent event) {
+               transferCompleted(event);
+
+               TransferResource resource = event.getResource();
+               long contentLength = event.getTransferredBytes();
+               if (contentLength >= 0) {
+                       String type = (event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded"
+                                       : "Downloaded");
+                       String len = contentLength >= 1024 ? toKB(contentLength) + " KB"
+                                       : contentLength + " B";
+
+                       String throughput = "";
+                       long duration = System.currentTimeMillis()
+                                       - resource.getTransferStartTime();
+                       if (duration > 0) {
+                               DecimalFormat format = new DecimalFormat("0.0",
+                                               new DecimalFormatSymbols(Locale.ENGLISH));
+                               double kbPerSec = (contentLength / 1024.0)
+                                               / (duration / 1000.0);
+                               throughput = " at " + format.format(kbPerSec) + " KB/sec";
+                       }
+
+                       out.println(type + ": " + resource.getRepositoryUrl()
+                                       + resource.getResourceName() + " (" + len + throughput
+                                       + ")");
+               }
+       }
+
+       @Override
+       public void transferFailed(TransferEvent event) {
+               transferCompleted(event);
+
+               log.error(event.getException().getMessage()
+                               + (event.getException().getCause() != null ? " : "
+                                               + event.getException().getCause().getMessage() : ""));
+               // event.getException().printStackTrace( out );
+       }
+
+       private void transferCompleted(TransferEvent event) {
+               downloads.remove(event.getResource());
+
+               StringBuilder buffer = new StringBuilder(64);
+               pad(buffer, lastLength);
+               buffer.append('\r');
+               out.print(buffer);
+       }
+
+       public void transferCorrupted(TransferEvent event) {
+               event.getException().printStackTrace(out);
+       }
+
+       protected long toKB(long bytes) {
+               return (bytes + 1023) / 1024;
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/SimpleArtifactDescriptorReader.java b/org.argeo.slc.support/src/org/argeo/slc/aether/SimpleArtifactDescriptorReader.java
new file mode 100644 (file)
index 0000000..3aca172
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.impl.ArtifactDescriptorReader;
+import org.eclipse.aether.resolution.ArtifactDescriptorException;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+
+public class SimpleArtifactDescriptorReader implements ArtifactDescriptorReader {
+
+       public ArtifactDescriptorResult readArtifactDescriptor(
+                       RepositorySystemSession session, ArtifactDescriptorRequest request)
+                       throws ArtifactDescriptorException {
+               ArtifactDescriptorResult result = new ArtifactDescriptorResult(request);
+               return result;
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/SimpleVersionRangeResolver.java b/org.argeo.slc.support/src/org/argeo/slc/aether/SimpleVersionRangeResolver.java
new file mode 100644 (file)
index 0000000..b7e7f95
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import org.argeo.slc.aether.osgi.OsgiVersion;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResolutionException;
+import org.eclipse.aether.resolution.VersionRangeResult;
+import org.eclipse.aether.version.Version;
+
+public class SimpleVersionRangeResolver implements VersionRangeResolver {
+
+       public VersionRangeResult resolveVersionRange(
+                       RepositorySystemSession session, VersionRangeRequest request)
+                       throws VersionRangeResolutionException {
+               VersionRangeResult versionRangeResult = new VersionRangeResult(request);
+               Version version = new OsgiVersion(request.getArtifact()
+                               .getBaseVersion());
+               versionRangeResult.addVersion(version);
+               return null;
+       }
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/SimpleVersionResolver.java b/org.argeo.slc.support/src/org/argeo/slc/aether/SimpleVersionResolver.java
new file mode 100644 (file)
index 0000000..51a6490
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.impl.VersionResolver;
+import org.eclipse.aether.resolution.VersionRequest;
+import org.eclipse.aether.resolution.VersionResolutionException;
+import org.eclipse.aether.resolution.VersionResult;
+
+public class SimpleVersionResolver implements VersionResolver {
+
+       public VersionResult resolveVersion(RepositorySystemSession session,
+                       VersionRequest request) throws VersionResolutionException {
+               VersionResult versionResult = new VersionResult(request);
+               versionResult.setVersion(request.getArtifact().getBaseVersion());
+               return versionResult;
+       }
+
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/osgi/OsgiVersion.java b/org.argeo.slc.support/src/org/argeo/slc/aether/osgi/OsgiVersion.java
new file mode 100644 (file)
index 0000000..9f35ff9
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether.osgi;
+
+import org.osgi.framework.Version;
+
+/**
+ * Wraps an OSGi {@link Version} as an Aether
+ * {@link org.eclipse.aether.version.Version}.
+ */
+public class OsgiVersion implements org.eclipse.aether.version.Version {
+       final private Version version;
+
+       public OsgiVersion(String str) {
+               version = Version.parseVersion(str);
+       }
+
+       public Version getVersion() {
+               return version;
+       }
+
+       public int compareTo(org.eclipse.aether.version.Version v) {
+               if (!(v instanceof OsgiVersion))
+                       return 0;
+               OsgiVersion ov = (OsgiVersion) v;
+               return version.compareTo(ov.version);
+       }
+}
diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java b/org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java
new file mode 100644 (file)
index 0000000..069e4c3
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.aether.spring;
+
+import org.eclipse.aether.repository.Authentication;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.springframework.beans.factory.BeanNameAware;
+import org.springframework.beans.factory.FactoryBean;
+
+/** Simplifies the definition of a remote factory using Spring */
+public class RemoteRepositoryFactory implements BeanNameAware, FactoryBean {
+       private String beanName;
+       private String id;
+       private String url;
+       private String type = "default";
+       private String username;
+       private String password;
+
+       public Object getObject() throws Exception {
+               // FIXME Adapt to changes in Aether
+//             RemoteRepository remoteRepository = new RemoteRepository(
+//                             id != null ? id : beanName, type, url);
+//             if (username != null) {
+//                     Authentication authentication = new Authentication(username,
+//                                     password);
+//                     remoteRepository.setAuthentication(authentication);
+//             }
+               return null;
+       }
+
+       public Class<?> getObjectType() {
+               return RemoteRepository.class;
+       }
+
+       public boolean isSingleton() {
+               return true;
+       }
+
+       public void setBeanName(String name) {
+               this.beanName = name;
+
+       }
+
+       public void setId(String id) {
+               this.id = id;
+       }
+
+       public void setUrl(String url) {
+               this.url = url;
+       }
+
+       public void setType(String type) {
+               this.type = type;
+       }
+
+       public void setUsername(String username) {
+               this.username = username;
+       }
+
+       public void setPassword(String password) {
+               this.password = password;
+       }
+
+}
diff --git a/pom.xml b/pom.xml
index 6c15049a6845531d0876af8df371db885be34d3b..8d6fdae771cdea125d55e8d79f8646c3c431566e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,5 @@
-<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">
+<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.argeo.commons</groupId>
                <module>org.argeo.slc.api</module>
                <module>org.argeo.slc.core</module>
                <module>org.argeo.slc.unit</module>
+               <module>org.argeo.slc.support</module>
                <module>org.argeo.slc.repo</module>
 
-<!--           <module>runtime</module> -->
-<!--           <module>modules</module> -->
-<!--           <module>plugins</module> -->
-<!--           <module>archetypes</module> -->
+               <!-- <module>runtime</module> -->
+               <!-- <module>modules</module> -->
+               <!-- <module>plugins</module> -->
+               <!-- <module>archetypes</module> -->
 
-<!--           <module>lib</module> -->
-<!--           <module>dep</module> -->
-<!--           <module>dist</module> -->
-<!--           <module>demo</module> -->
+               <!-- <module>lib</module> -->
+               <module>dep</module>
+               <!-- <module>dist</module> -->
+               <!-- <module>demo</module> -->
        </modules>
        <url>http://projects.argeo.org/slc/</url>
        <scm>
@@ -120,17 +122,9 @@ limitations under the License.
                                <checksumPolicy>warn</checksumPolicy>
                        </releases>
                </repository>
-               <!-- 
-               <repository>
-                       <id>argeo-tp-extras</id>
-                       <url>https://forge.argeo.org/data/public/java/argeo-tp-extras-2.1</url>
-                       <releases>
-                               <enabled>true</enabled>
-                               <updatePolicy>daily</updatePolicy>
-                               <checksumPolicy>warn</checksumPolicy>
-                       </releases>
-               </repository>
-                -->
+               <!-- <repository> <id>argeo-tp-extras</id> <url>https://forge.argeo.org/data/public/java/argeo-tp-extras-2.1</url> 
+                       <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>warn</checksumPolicy> 
+                       </releases> </repository> -->
                <repository>
                        <id>argeo-tp-extras-local</id>
                        <url>http://localhost:7080/data/public/java/argeo-tp-extras-2.1</url>
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/AetherTemplate.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/AetherTemplate.java
deleted file mode 100644 (file)
index c06161d..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import java.io.File;
-import java.util.List;
-
-import org.argeo.slc.SlcException;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.collection.CollectRequest;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.sonatype.aether.resolution.ArtifactRequest;
-import org.sonatype.aether.resolution.ArtifactResolutionException;
-import org.sonatype.aether.resolution.ArtifactResult;
-
-/** Simplifies access to Aether. */
-public class AetherTemplate {
-       private RepositorySystem repositorySystem;
-       private RepositorySystemSession repositorySystemSession;
-       private List<RemoteRepository> remoteRepositories;
-
-       /** Resolves the artifact in order to give access to its file. */
-       public File getResolvedFile(Artifact artifact) {
-               try {
-                       ArtifactRequest artifactRequest = new ArtifactRequest(artifact,
-                                       remoteRepositories, null);
-                       ArtifactResult result = repositorySystem.resolveArtifact(
-                                       repositorySystemSession, artifactRequest);
-                       return result.getArtifact().getFile();
-               } catch (ArtifactResolutionException e) {
-                       throw new SlcException("Cannot resolve " + artifact, e);
-               }
-       }
-
-       /**
-        * Transitively resolves the dependencies of this artifact (with scope
-        * 'compile')
-        * 
-        * @param artifact
-        *            the artifact to resolve
-        */
-       public DependencyNode resolveDependencies(Artifact artifact) {
-               return resolveDependencies(artifact, "compile");
-       }
-
-       /**
-        * Transitively resolves the dependencies of this artifact.
-        * 
-        * @param artifact
-        *            the artifact to resolve
-        * @param scope
-        *            the scope
-        */
-       public DependencyNode resolveDependencies(Artifact artifact, String scope) {
-               try {
-                       Dependency dependency = new Dependency(artifact, scope);
-                       CollectRequest collectRequest = new CollectRequest();
-                       collectRequest.setRoot(dependency);
-                       for (RemoteRepository remoteRepository : remoteRepositories)
-                               collectRequest.addRepository(remoteRepository);
-                       DependencyNode node = repositorySystem.collectDependencies(
-                                       repositorySystemSession, collectRequest).getRoot();
-
-                       repositorySystem.resolveDependencies(repositorySystemSession, node,
-                                       null);
-                       return node;
-               } catch (Exception e) {
-                       throw new SlcException("Cannot resolve dependencies of " + artifact
-                                       + " (scope: " + scope + ")", e);
-               }
-       }
-
-       public RepositorySystem getRepositorySystem() {
-               return repositorySystem;
-       }
-
-       public void setRepositorySystem(RepositorySystem repositorySystem) {
-               this.repositorySystem = repositorySystem;
-       }
-
-       public RepositorySystemSession getRepositorySystemSession() {
-               return repositorySystemSession;
-       }
-
-       public void setRepositorySystemSession(
-                       RepositorySystemSession repositorySystemSession) {
-               this.repositorySystemSession = repositorySystemSession;
-       }
-
-       public List<RemoteRepository> getRemoteRepositories() {
-               return remoteRepositories;
-       }
-
-       public void setRemoteRepositories(List<RemoteRepository> remoteRepositories) {
-               this.remoteRepositories = remoteRepositories;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/AetherUtils.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/AetherUtils.java
deleted file mode 100644 (file)
index 1e52342..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import java.util.regex.Pattern;
-
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-
-/** Utilities related to Aether */
-public class AetherUtils {
-       public final static String SNAPSHOT = "SNAPSHOT";
-       // hacked from aether
-       public static final Pattern SNAPSHOT_TIMESTAMP = Pattern
-                       .compile("^(.*-)?([0-9]{8}.[0-9]{6}-[0-9]+)$");
-
-       private final static Log log = LogFactory.getLog(AetherUtils.class);
-
-       /** Logs a dependency node and its transitive dependencies as a tree. */
-       public static void logDependencyNode(int depth,
-                       DependencyNode dependencyNode) {
-               if (!log.isDebugEnabled())
-                       return;
-
-               StringBuffer prefix = new StringBuffer(depth * 2 + 2);
-               // prefix.append("|-");
-               for (int i = 0; i < depth * 2; i++) {
-                       prefix.append(' ');
-               }
-               Artifact artifact = dependencyNode.getDependency().getArtifact();
-               log.debug(prefix + "|-> " + artifact.getArtifactId() + " ["
-                               + artifact.getVersion() + "]"
-                               + (dependencyNode.getDependency().isOptional() ? " ?" : ""));
-               for (DependencyNode child : dependencyNode.getChildren()) {
-                       logDependencyNode(depth + 1, child);
-               }
-       }
-
-       /**
-        * Converts a path (relative to a repository root) to an {@link Artifact}.
-        * 
-        * @param path
-        *            the relative path
-        * @param type
-        *            the layout type, currently ignored because only the 'default'
-        *            Maven 2 layout is currently supported:
-        *            /my/group/id/artifactId/
-        *            version/artifactId-version[-classifier].extension
-        * @return the related artifact or null if the file is not an artifact
-        *         (Maven medata data XML files, check sums, etc.)
-        */
-       public static Artifact convertPathToArtifact(String path, String type) {
-               // TODO rewrite it with regexp (unit tests first!)
-
-               // normalize
-               if (path.startsWith("/"))
-                       path = path.substring(1);
-
-               // parse group id
-               String[] tokensSlash = path.split("/");
-               if (tokensSlash.length < 4)
-                       return null;
-               StringBuffer groupId = new StringBuffer(path.length());
-               for (int i = 0; i < tokensSlash.length - 3; i++) {
-                       if (i != 0)
-                               groupId.append('.');
-                       groupId.append(tokensSlash[i]);
-               }
-               String artifactId = tokensSlash[tokensSlash.length - 3];
-               String baseVersion = tokensSlash[tokensSlash.length - 2];
-               String fileName = tokensSlash[tokensSlash.length - 1];
-
-               if (!fileName.startsWith(artifactId))
-                       return null;
-               // FIXME make it configurable? (via an argument?)
-               if (FilenameUtils.isExtension(fileName, new String[] { "sha1", "md5" }))
-                       return null;
-
-               String extension = FilenameUtils.getExtension(fileName);
-               String baseName = FilenameUtils.getBaseName(fileName);
-
-               // check since we assume hereafter
-               if (!baseName.startsWith(artifactId))
-                       throw new SlcException("Base name '" + baseName
-                                       + " does not start with artifact id '" + artifactId
-                                       + "' in " + path);
-
-               boolean isSnapshot = baseVersion.endsWith("-" + SNAPSHOT);
-               String baseBaseVersion = isSnapshot ? baseVersion.substring(0,
-                               baseVersion.length() - SNAPSHOT.length() - 1) : baseVersion;
-               int artifactAndBaseBaseVersionLength = artifactId.length() + 1
-                               + baseBaseVersion.length() + 1;
-               String classifier = null;
-               if (baseName.length() > artifactAndBaseBaseVersionLength) {
-                       String dashRest = baseName
-                                       .substring(artifactAndBaseBaseVersionLength);
-                       String[] dashes = dashRest.split("-");
-
-                       if (isSnapshot) {
-                               if (dashes[0].equals(SNAPSHOT)) {
-                                       if (dashRest.length() > SNAPSHOT.length() + 1)
-                                               classifier = dashRest.substring(SNAPSHOT.length() + 1);
-
-                               } else {
-                                       if (dashes.length > 2)// assume no '-' in classifier
-                                               classifier = dashes[2];
-                               }
-                       } else {
-                               if (dashes.length > 0)
-                                       classifier = dashes[0];
-                       }
-               }
-
-               // classifier
-               // String classifier = null;
-               // int firstDash = baseName.indexOf('-');
-               // int classifierDash = baseName.lastIndexOf('-');
-               // if (classifierDash > 0 && classifierDash != firstDash) {
-               // classifier = baseName.substring(classifierDash + 1);
-               // }
-               // if (isSnapshot && classifier != null) {
-               // if (classifier.equals(SNAPSHOT))
-               // classifier = null;
-               // else
-               // try {
-               // Long.parseLong(classifier); // build number
-               // // if not failed this is a timestamped version
-               // classifier = null;
-               // } catch (NumberFormatException e) {
-               // // silent
-               // }
-               // }
-
-               // version
-               String version = baseName.substring(artifactId.length() + 1);
-               if (classifier != null)
-                       version = version.substring(0,
-                                       version.length() - classifier.length() - 1);
-
-               // consistency checks
-               if (!isSnapshot && !version.equals(baseVersion))
-                       throw new SlcException("Base version '" + baseVersion
-                                       + "' and version '" + version + "' not in line in " + path);
-               if (!isSnapshot && isSnapshotVersion(version))
-                       throw new SlcException("SNAPSHOT base version '" + baseVersion
-                                       + "' and version '" + version + "' not in line in " + path);
-
-               DefaultArtifact artifact = new DefaultArtifact(groupId.toString(),
-                               artifactId, classifier, extension, version);
-               return artifact;
-       }
-
-       /** Hacked from aether */
-       public static boolean isSnapshotVersion(String version) {
-               return version.endsWith(SNAPSHOT)
-                               || SNAPSHOT_TIMESTAMP.matcher(version).matches();
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ArtifactIdComparator.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ArtifactIdComparator.java
deleted file mode 100644 (file)
index c9d5265..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import java.util.Comparator;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.sonatype.aether.artifact.Artifact;
-
-/**
- * Compare two artifacts, for use in {@link TreeSet} / {@link TreeMap}, consider
- * artifactId first THEN groupId
- */
-public class ArtifactIdComparator implements Comparator<Artifact> {
-       public int compare(Artifact o1, Artifact o2) {
-               if (o1.getArtifactId().equals(o2.getArtifactId()))
-                       return o1.getGroupId().compareTo(o2.getGroupId());
-               return o1.getArtifactId().compareTo(o2.getArtifactId());
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ConsoleRepositoryListener.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ConsoleRepositoryListener.java
deleted file mode 100644 (file)
index 45c4076..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.sonatype.aether.AbstractRepositoryListener;
-import org.sonatype.aether.RepositoryEvent;
-
-public class ConsoleRepositoryListener extends AbstractRepositoryListener {
-
-       private final static Log log = LogFactory
-                       .getLog(ConsoleRepositoryListener.class);
-
-       public void artifactDeployed(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.debug("Deployed " + event.getArtifact() + " to "
-                                       + event.getRepository());
-       }
-
-       public void artifactDeploying(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Deploying " + event.getArtifact() + " to "
-                                       + event.getRepository());
-       }
-
-       public void artifactDescriptorInvalid(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.warn("Invalid artifact descriptor for " + event.getArtifact()
-                                       + ": " + event.getException().getMessage());
-       }
-
-       public void artifactDescriptorMissing(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.warn("Missing artifact descriptor for " + event.getArtifact());
-       }
-
-       public void artifactInstalled(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.debug("Installed " + event.getArtifact() + " to "
-                                       + event.getFile());
-       }
-
-       public void artifactInstalling(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Installing " + event.getArtifact() + " to "
-                                       + event.getFile());
-       }
-
-       public void artifactResolved(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Resolved artifact " + event.getArtifact() + " from "
-                                       + event.getRepository());
-       }
-
-       public void artifactDownloading(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Downloading artifact " + event.getArtifact() + " from "
-                                       + event.getRepository());
-       }
-
-       public void artifactDownloaded(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.debug("Downloaded artifact " + event.getArtifact() + " from "
-                                       + event.getRepository());
-       }
-
-       public void artifactResolving(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Resolving artifact " + event.getArtifact());
-       }
-
-       public void metadataDeployed(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.debug("Deployed " + event.getMetadata() + " to "
-                                       + event.getRepository());
-       }
-
-       public void metadataDeploying(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Deploying " + event.getMetadata() + " to "
-                                       + event.getRepository());
-       }
-
-       public void metadataInstalled(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.debug("Installed " + event.getMetadata() + " to "
-                                       + event.getFile());
-       }
-
-       public void metadataInstalling(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Installing " + event.getMetadata() + " to "
-                                       + event.getFile());
-       }
-
-       public void metadataInvalid(RepositoryEvent event) {
-               if (log.isDebugEnabled())
-                       log.debug("Invalid metadata " + event.getMetadata());
-       }
-
-       public void metadataResolved(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Resolved metadata " + event.getMetadata() + " from "
-                                       + event.getRepository());
-       }
-
-       public void metadataResolving(RepositoryEvent event) {
-               if (log.isTraceEnabled())
-                       log.trace("Resolving metadata " + event.getMetadata() + " from "
-                                       + event.getRepository());
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ConsoleTransferListener.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ConsoleTransferListener.java
deleted file mode 100644 (file)
index a7399d0..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import java.io.PrintStream;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.sonatype.aether.transfer.AbstractTransferListener;
-import org.sonatype.aether.transfer.TransferEvent;
-import org.sonatype.aether.transfer.TransferResource;
-
-public class ConsoleTransferListener extends AbstractTransferListener {
-       private final static Log log = LogFactory
-                       .getLog(ConsoleTransferListener.class);
-
-       private PrintStream out;
-
-       private Map<TransferResource, Long> downloads = new ConcurrentHashMap<TransferResource, Long>();
-
-       private int lastLength;
-
-       public ConsoleTransferListener(PrintStream out) {
-               this.out = (out != null) ? out : System.out;
-       }
-
-       @Override
-       public void transferInitiated(TransferEvent event) {
-               String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading"
-                               : "Downloading";
-
-               if (log.isDebugEnabled())
-                       log.debug(message + ": " + event.getResource().getRepositoryUrl()
-                                       + event.getResource().getResourceName());
-       }
-
-       @Override
-       public void transferProgressed(TransferEvent event) {
-               TransferResource resource = event.getResource();
-               downloads.put(resource, Long.valueOf(event.getTransferredBytes()));
-
-               StringBuilder buffer = new StringBuilder(64);
-
-               for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
-                       long total = entry.getKey().getContentLength();
-                       long complete = entry.getValue().longValue();
-
-                       buffer.append(getStatus(complete, total)).append("  ");
-               }
-
-               int pad = lastLength - buffer.length();
-               lastLength = buffer.length();
-               pad(buffer, pad);
-               buffer.append('\r');
-
-               out.print(buffer);
-       }
-
-       private String getStatus(long complete, long total) {
-               if (total >= 1024) {
-                       return toKB(complete) + "/" + toKB(total) + " KB ";
-               } else if (total >= 0) {
-                       return complete + "/" + total + " B ";
-               } else if (complete >= 1024) {
-                       return toKB(complete) + " KB ";
-               } else {
-                       return complete + " B ";
-               }
-       }
-
-       private void pad(StringBuilder buffer, int spaces) {
-               String block = "                                        ";
-               while (spaces > 0) {
-                       int n = Math.min(spaces, block.length());
-                       buffer.append(block, 0, n);
-                       spaces -= n;
-               }
-       }
-
-       @Override
-       public void transferSucceeded(TransferEvent event) {
-               transferCompleted(event);
-
-               TransferResource resource = event.getResource();
-               long contentLength = event.getTransferredBytes();
-               if (contentLength >= 0) {
-                       String type = (event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded"
-                                       : "Downloaded");
-                       String len = contentLength >= 1024 ? toKB(contentLength) + " KB"
-                                       : contentLength + " B";
-
-                       String throughput = "";
-                       long duration = System.currentTimeMillis()
-                                       - resource.getTransferStartTime();
-                       if (duration > 0) {
-                               DecimalFormat format = new DecimalFormat("0.0",
-                                               new DecimalFormatSymbols(Locale.ENGLISH));
-                               double kbPerSec = (contentLength / 1024.0)
-                                               / (duration / 1000.0);
-                               throughput = " at " + format.format(kbPerSec) + " KB/sec";
-                       }
-
-                       out.println(type + ": " + resource.getRepositoryUrl()
-                                       + resource.getResourceName() + " (" + len + throughput
-                                       + ")");
-               }
-       }
-
-       @Override
-       public void transferFailed(TransferEvent event) {
-               transferCompleted(event);
-
-               log.error(event.getException().getMessage()
-                               + (event.getException().getCause() != null ? " : "
-                                               + event.getException().getCause().getMessage() : ""));
-               // event.getException().printStackTrace( out );
-       }
-
-       private void transferCompleted(TransferEvent event) {
-               downloads.remove(event.getResource());
-
-               StringBuilder buffer = new StringBuilder(64);
-               pad(buffer, lastLength);
-               buffer.append('\r');
-               out.print(buffer);
-       }
-
-       public void transferCorrupted(TransferEvent event) {
-               event.getException().printStackTrace(out);
-       }
-
-       protected long toKB(long bytes) {
-               return (bytes + 1023) / 1024;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleArtifactDescriptorReader.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleArtifactDescriptorReader.java
deleted file mode 100644 (file)
index f97ddef..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.impl.ArtifactDescriptorReader;
-import org.sonatype.aether.resolution.ArtifactDescriptorException;
-import org.sonatype.aether.resolution.ArtifactDescriptorRequest;
-import org.sonatype.aether.resolution.ArtifactDescriptorResult;
-
-public class SimpleArtifactDescriptorReader implements ArtifactDescriptorReader {
-
-       public ArtifactDescriptorResult readArtifactDescriptor(
-                       RepositorySystemSession session, ArtifactDescriptorRequest request)
-                       throws ArtifactDescriptorException {
-               ArtifactDescriptorResult result = new ArtifactDescriptorResult(request);
-               return result;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleVersionRangeResolver.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleVersionRangeResolver.java
deleted file mode 100644 (file)
index 2d1ee28..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import org.argeo.slc.aether.osgi.OsgiVersion;
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.impl.VersionRangeResolver;
-import org.sonatype.aether.resolution.VersionRangeRequest;
-import org.sonatype.aether.resolution.VersionRangeResolutionException;
-import org.sonatype.aether.resolution.VersionRangeResult;
-import org.sonatype.aether.version.Version;
-
-public class SimpleVersionRangeResolver implements VersionRangeResolver {
-
-       public VersionRangeResult resolveVersionRange(
-                       RepositorySystemSession session, VersionRangeRequest request)
-                       throws VersionRangeResolutionException {
-               VersionRangeResult versionRangeResult = new VersionRangeResult(request);
-               Version version = new OsgiVersion(request.getArtifact()
-                               .getBaseVersion());
-               versionRangeResult.addVersion(version);
-               return null;
-       }
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleVersionResolver.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/SimpleVersionResolver.java
deleted file mode 100644 (file)
index eb20cc3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.impl.VersionResolver;
-import org.sonatype.aether.resolution.VersionRequest;
-import org.sonatype.aether.resolution.VersionResolutionException;
-import org.sonatype.aether.resolution.VersionResult;
-
-public class SimpleVersionResolver implements VersionResolver {
-
-       public VersionResult resolveVersion(RepositorySystemSession session,
-                       VersionRequest request) throws VersionResolutionException {
-               VersionResult versionResult = new VersionResult(request);
-               versionResult.setVersion(request.getArtifact().getBaseVersion());
-               return versionResult;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/osgi/OsgiVersion.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/osgi/OsgiVersion.java
deleted file mode 100644 (file)
index 733c172..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether.osgi;
-
-import org.osgi.framework.Version;
-
-/**
- * Wraps an OSGi {@link Version} as an Aether
- * {@link org.sonatype.aether.version.Version}.
- */
-public class OsgiVersion implements org.sonatype.aether.version.Version {
-       final private Version version;
-
-       public OsgiVersion(String str) {
-               version = Version.parseVersion(str);
-       }
-
-       public Version getVersion() {
-               return version;
-       }
-
-       public int compareTo(org.sonatype.aether.version.Version v) {
-               if (!(v instanceof OsgiVersion))
-                       return 0;
-               OsgiVersion ov = (OsgiVersion) v;
-               return version.compareTo(ov.version);
-       }
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java b/runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java
deleted file mode 100644 (file)
index e5335b7..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether.spring;
-
-import org.sonatype.aether.repository.Authentication;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.springframework.beans.factory.BeanNameAware;
-import org.springframework.beans.factory.FactoryBean;
-
-/** Simplifies the definition of a remote factory using Spring */
-public class RemoteRepositoryFactory implements BeanNameAware, FactoryBean {
-       private String beanName;
-       private String id;
-       private String url;
-       private String type = "default";
-       private String username;
-       private String password;
-
-       public Object getObject() throws Exception {
-               RemoteRepository remoteRepository = new RemoteRepository(
-                               id != null ? id : beanName, type, url);
-               if (username != null) {
-                       Authentication authentication = new Authentication(username,
-                                       password);
-                       remoteRepository.setAuthentication(authentication);
-               }
-               return remoteRepository;
-       }
-
-       public Class<?> getObjectType() {
-               return RemoteRepository.class;
-       }
-
-       public boolean isSingleton() {
-               return true;
-       }
-
-       public void setBeanName(String name) {
-               this.beanName = name;
-
-       }
-
-       public void setId(String id) {
-               this.id = id;
-       }
-
-       public void setUrl(String url) {
-               this.url = url;
-       }
-
-       public void setType(String type) {
-               this.type = type;
-       }
-
-       public void setUsername(String username) {
-               this.username = username;
-       }
-
-       public void setPassword(String password) {
-               this.password = password;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.support.aether/src/test/java/org/argeo/slc/aether/AetherUtilsTest.java b/runtime/org.argeo.slc.support.aether/src/test/java/org/argeo/slc/aether/AetherUtilsTest.java
deleted file mode 100644 (file)
index 711bd73..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.aether;
-
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-
-import junit.framework.TestCase;
-
-public class AetherUtilsTest extends TestCase {
-       public void testConvertPathToArtifact() throws Exception {
-               checkPathConversion("my.group.id:my-artifactId:pom:1.2.3",
-                               "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3.pom");
-               checkPathConversion("my.group.id:my-artifactId:pom:1.2.3-SNAPSHOT",
-                               "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT.pom");
-               checkPathConversion("my.group.id:my-artifactId:pom:myClassifier:1.2.3",
-                               "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3-myClassifier.pom");
-               checkPathConversion(
-                               "my.group.id:my-artifactId:pom:myClassifier:1.2.3-SNAPSHOT",
-                               "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT-myClassifier.pom");
-               checkPathConversion(
-                               "my.group.id:my-artifactId:pom:myClassifier:20110828.223836-2",
-                               "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-20110828.223836-2-myClassifier.pom");
-       }
-
-       public void testConvertPathToArtifactRealLife() throws Exception {
-               checkPathConversion(
-                               "org.apache.maven.plugins:maven-antrun-plugin:pom:1.1",
-                               "org/apache/maven/plugins/maven-antrun-plugin/1.1/maven-antrun-plugin-1.1.pom");
-               checkPathConversion(
-                               "org.apache.maven.plugins:maven-plugin-parent:pom:2.0.1",
-                               "org/apache/maven/plugins/maven-plugin-parent/2.0.1/maven-plugin-parent-2.0.1.pom");
-               checkPathConversion(
-                               "org.apache.avalon.framework:avalon-framework-impl:pom:4.3.1",
-                               "org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.pom");
-               checkPathConversion(
-                               "org.apache.maven.shared:maven-dependency-tree:pom:1.2",
-                               "org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.pom");
-               checkPathConversion(
-                               "org.argeo.maven.plugins:maven-argeo-osgi-plugin:pom:1.0.33",
-                               "org/argeo/maven/plugins/maven-argeo-osgi-plugin/1.0.33/maven-argeo-osgi-plugin-1.0.33.pom");
-               checkPathConversion(
-                               "org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1",
-                               "org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom");
-       }
-
-       protected void checkPathConversion(String expectedArtifact, String path) {
-               Artifact artifact = AetherUtils.convertPathToArtifact(path, null);
-               if (expectedArtifact == null)
-                       assertNull(artifact);
-               else
-                       assertEquals(new DefaultArtifact(expectedArtifact), artifact);
-       }
-}