Latest bnd sync
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1370165 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java b/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
index a8fc577..fbdac78 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
@@ -1,11 +1,12 @@
package aQute.bnd.service;
+import java.io.InputStream;
+
import aQute.bnd.build.*;
-import aQute.bnd.osgi.*;
/**
* Deploy this artifact to maven.
*/
public interface Deploy {
- boolean deploy(Project project, Jar jar) throws Exception;
+ boolean deploy(Project project, String jarName, InputStream jarStream) throws Exception;
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
index 772803d..73847f7 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
@@ -1,9 +1,9 @@
package aQute.bnd.service;
import java.io.*;
+import java.net.*;
import java.util.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.version.*;
public interface RepositoryPlugin {
@@ -12,6 +12,83 @@
}
/**
+ * Options used to steer the put operation
+ */
+ public class PutOptions {
+ /**
+ * The <b>SHA1</b> digest of the artifact to put into the repository.<br/>
+ * <br/>
+ * When specified the digest of the <b>fetched</b> artifact will be
+ * calculated and verified against this digest, <b>before</b> putting
+ * the artifact into the repository.<br/>
+ * <br/>
+ * An exception is thrown if the specified digest and the calculated
+ * digest do not match.
+ */
+ public byte[] digest = null;
+
+ /**
+ * Allow the implementation to change the artifact.<br/>
+ * <br/>
+ * When set to true the implementation is allowed to change the artifact
+ * when putting it into the repository.<br/>
+ * <br/>
+ * An exception is thrown when set to false and the implementation can't
+ * put the artifact into the repository without changing it.
+ */
+ public boolean allowArtifactChange = false;
+
+ /**
+ * Generate a <b>SHA1</b> digest.<br/>
+ * <br/>
+ * When set to true the implementation generates a digest of the
+ * artifact as it is put into the repository and returns that digest in
+ * the result.
+ */
+ public boolean generateDigest = false;
+
+ /**
+ * Create a 'latest' artifact when it did not exist.<br/>
+ * <br/>
+ * When set to true the implementation is requested to create a 'latest'
+ * artifact.
+ */
+ public boolean createLatest = false;
+ }
+
+ /**
+ * Results returned by the put operation
+ */
+ public class PutResult {
+ /**
+ * The artifact as it was put in the repository.<br/>
+ * <br/>
+ * This can be a URI to the artifact (when it was put into the
+ * repository), or null when the artifact was not put into the
+ * repository (for example because it was already in the repository).
+ */
+ public URI artifact = null;
+
+ /**
+ * The 'latest' artifact as it was put in the repository.<br/>
+ * <br/>
+ * Only set when {@link PutOptions#createLatest} was set to true and the
+ * 'latest' artifact did not exist, or when the 'latest' artifact did
+ * exists and was older than the artifact being put in the repository.
+ */
+ public URI latest = null;
+
+ /**
+ * The <b>SHA1</b> digest of the artifact as it was put into the
+ * repository.<br/>
+ * <br/>
+ * This will be null when {@link PutOptions#generateDigest} was null, or
+ * when {@link #artifact} is null.
+ */
+ public byte[] digest = null;
+ }
+
+ /**
* Return a URL to a matching version of the given bundle.
*
* @param bsn
@@ -36,12 +113,29 @@
boolean canWrite();
/**
- * Put a JAR file in the repository.
+ * Put an artifact (from the InputStream) into the repository.<br/>
+ * <br/>
+ * There is NO guarantee that the artifact on the input stream has not been
+ * modified after it's been put in the repository since that is dependent on
+ * the implementation of the repository (see
+ * {@link RepositoryPlugin.PutOptions#allowArtifactChange}).
*
- * @param jar
+ * @param stream
+ * The input stream with the artifact
+ * @param options
+ * The put options. See {@link RepositoryPlugin.PutOptions}
+ * @return The result of the put, never null. See
+ * {@link RepositoryPlugin.PutResult}
* @throws Exception
+ * When the repository root directory doesn't exist, when the
+ * repository is read-only, when the specified checksum doesn't
+ * match the checksum of the fetched artifact (see
+ * {@link RepositoryPlugin.PutOptions#digest}), when the
+ * implementation wants to modify the artifact but isn't allowed
+ * (see {@link RepositoryPlugin.PutOptions#allowArtifactChange}
+ * ), or when another error has occurred.
*/
- File put(Jar jar) throws Exception;
+ PutResult put(InputStream stream, PutOptions options) throws Exception;
/**
* Return a list of bsns that are present in the repository.
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/packageinfo b/bundleplugin/src/main/java/aQute/bnd/service/packageinfo
index 084a0d4..63eb236 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/packageinfo
+++ b/bundleplugin/src/main/java/aQute/bnd/service/packageinfo
@@ -1 +1 @@
-version 2.0.0
+version 3.0.0
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/repository/MinimalRepository.java b/bundleplugin/src/main/java/aQute/bnd/service/repository/MinimalRepository.java
index bbc0593..dab3b0c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/repository/MinimalRepository.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/repository/MinimalRepository.java
@@ -10,7 +10,7 @@
public interface MinimalRepository {
public enum Gestalt {
ADD, REMOTE
- };
+ }
Report add(File f) throws Exception;