Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Latest bnd sync

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1370165 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 55d4dfefeeeecd8f9591a49b6b6a90689bd4cf55 1 parent 5e1031a
Stuart McCulloch authored
Showing with 695 additions and 272 deletions.
  1. +3 −0  bundleplugin/src/main/java/aQute/bnd/build/Container.java
  2. +40 −39 bundleplugin/src/main/java/aQute/bnd/build/Project.java
  3. +4 −0 bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
  4. +1 −2  bundleplugin/src/main/java/aQute/bnd/build/ProjectMessages.java
  5. +3 −1 bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
  6. +1 −0  bundleplugin/src/main/java/aQute/bnd/build/ReflectAction.java
  7. +14 −4 bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
  8. +1 −1  bundleplugin/src/main/java/aQute/bnd/build/WorkspaceRepository.java
  9. +1 −1  bundleplugin/src/main/java/aQute/bnd/build/packageinfo
  10. +1 −0  bundleplugin/src/main/java/aQute/bnd/compatibility/Access.java
  11. +1 −0  bundleplugin/src/main/java/aQute/bnd/compatibility/GenericParameter.java
  12. +1 −0  bundleplugin/src/main/java/aQute/bnd/compatibility/Kind.java
  13. +1 −0  bundleplugin/src/main/java/aQute/bnd/compatibility/Scope.java
  14. +1 −0  bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
  15. +7 −9 bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
  16. +1 −0  bundleplugin/src/main/java/aQute/bnd/component/HeaderReader.java
  17. +1 −0  bundleplugin/src/main/java/aQute/bnd/component/ReferenceDef.java
  18. +2 −0  bundleplugin/src/main/java/aQute/bnd/component/TagResource.java
  19. +3 −0  bundleplugin/src/main/java/aQute/bnd/differ/DiffImpl.java
  20. +3 −0  bundleplugin/src/main/java/aQute/bnd/differ/Element.java
  21. +4 −3 bundleplugin/src/main/java/aQute/bnd/filerepo/FileRepo.java
  22. +3 −1 bundleplugin/src/main/java/aQute/bnd/header/Attrs.java
  23. +3 −0  bundleplugin/src/main/java/aQute/bnd/header/Parameters.java
  24. +3 −0  bundleplugin/src/main/java/aQute/bnd/make/calltree/CalltreeResource.java
  25. +1 −0  bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java
  26. +0 −2  bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java
  27. +4 −0 bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java
  28. +2 −0  bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java
  29. +12 −4 bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
  30. +1 −0  bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java
  31. +48 −40 bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java
  32. +6 −2 bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java
  33. +2 −1  bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
  34. +1 −0  bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java
  35. +6 −2 bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java
  36. +1 −2  bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
  37. +1 −0  bundleplugin/src/main/java/aQute/bnd/maven/support/Pom.java
  38. +1 −0  bundleplugin/src/main/java/aQute/bnd/maven/support/ProjectPom.java
  39. +1 −1  bundleplugin/src/main/java/aQute/bnd/maven/support/packageinfo
  40. +13 −1 bundleplugin/src/main/java/aQute/bnd/osgi/Analyzer.java
  41. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/Annotation.java
  42. +7 −1 bundleplugin/src/main/java/aQute/bnd/osgi/Builder.java
  43. +2 −0  bundleplugin/src/main/java/aQute/bnd/osgi/BundleId.java
  44. +10 −2 bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
  45. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/CombinedResource.java
  46. +10 −0 bundleplugin/src/main/java/aQute/bnd/osgi/Descriptors.java
  47. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/EmbeddedResource.java
  48. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/FileResource.java
  49. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/Instruction.java
  50. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/Instructions.java
  51. +8 −2 bundleplugin/src/main/java/aQute/bnd/osgi/Jar.java
  52. +3 −0  bundleplugin/src/main/java/aQute/bnd/osgi/JarResource.java
  53. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
  54. +3 −0  bundleplugin/src/main/java/aQute/bnd/osgi/Packages.java
  55. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/PreprocessResource.java
  56. +12 −13 bundleplugin/src/main/java/aQute/bnd/osgi/Processor.java
  57. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/URLResource.java
  58. +2 −0  bundleplugin/src/main/java/aQute/bnd/osgi/Verifier.java
  59. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/WriteResource.java
  60. +1 −0  bundleplugin/src/main/java/aQute/bnd/osgi/ZipResource.java
  61. +0 −1  bundleplugin/src/main/java/aQute/bnd/osgi/resource/Filters.java
  62. +5 −2 bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
  63. +3 −2 bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
  64. +98 −4 bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
  65. +1 −1  bundleplugin/src/main/java/aQute/bnd/service/packageinfo
  66. +1 −1  bundleplugin/src/main/java/aQute/bnd/service/repository/MinimalRepository.java
  67. +1 −0  bundleplugin/src/main/java/aQute/bnd/signing/JartoolSigner.java
  68. +3 −0  bundleplugin/src/main/java/aQute/bnd/version/Version.java
  69. +1 −0  bundleplugin/src/main/java/aQute/bnd/version/VersionRange.java
  70. +1 −0  bundleplugin/src/main/java/aQute/lib/base64/Base64.java
  71. +3 −0  bundleplugin/src/main/java/aQute/lib/collections/SortedList.java
  72. +83 −38 bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
  73. +158 −45 bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
  74. +4 −0 bundleplugin/src/main/java/aQute/lib/filter/Filter.java
  75. +2 −0  bundleplugin/src/main/java/aQute/lib/index/Index.java
  76. +3 −1 bundleplugin/src/main/java/aQute/lib/io/IO.java
  77. +1 −2  bundleplugin/src/main/java/aQute/lib/json/ByteArrayHandler.java
  78. +1 −0  bundleplugin/src/main/java/aQute/lib/json/Encoder.java
  79. +1 −0  bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
  80. +1 −0  bundleplugin/src/main/java/aQute/lib/spring/JPAComponent.java
  81. +1 −0  bundleplugin/src/main/java/aQute/lib/spring/SpringXMLType.java
  82. +1 −0  bundleplugin/src/main/java/aQute/lib/tag/Tag.java
  83. +8 −1 bundleplugin/src/main/java/aQute/libg/cafs/CAFS.java
  84. +1 −0  bundleplugin/src/main/java/aQute/libg/clauses/Selector.java
  85. +4 −0 bundleplugin/src/main/java/aQute/libg/command/Command.java
  86. +2 −0  bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
  87. +35 −40 bundleplugin/src/main/java/aQute/libg/sed/ReplacerAdapter.java
  88. +1 −0  bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
View
3  bundleplugin/src/main/java/aQute/bnd/build/Container.java
@@ -103,12 +103,14 @@ public String getError() {
return error;
}
+ @Override
public boolean equals(Object other) {
if (other instanceof Container)
return file.equals(((Container) other).file);
return false;
}
+ @Override
public int hashCode() {
return file.hashCode();
}
@@ -122,6 +124,7 @@ public Project getProject() {
*
* @return
*/
+ @Override
public String toString() {
if (getError() != null)
return "/error/" + getError();
View
79 bundleplugin/src/main/java/aQute/bnd/build/Project.java
@@ -14,6 +14,7 @@
import aQute.bnd.osgi.*;
import aQute.bnd.osgi.eclipse.*;
import aQute.bnd.service.*;
+import aQute.bnd.service.RepositoryPlugin.PutResult;
import aQute.bnd.service.RepositoryPlugin.Strategy;
import aQute.bnd.service.action.*;
import aQute.bnd.version.*;
@@ -146,6 +147,7 @@ public Workspace getWorkspace() {
return workspace;
}
+ @Override
public String toString() {
return getBase().getName();
}
@@ -202,7 +204,9 @@ public synchronized void prepare() throws Exception {
// Set default bin directory
output = getOutput0();
if (!output.exists()) {
- output.mkdirs();
+ if (!output.mkdirs()) {
+ throw new IOException("Could not create directory " + output);
+ }
getWorkspace().changedFile(output);
}
if (!output.isDirectory())
@@ -296,10 +300,12 @@ private File getOutput0() {
/**
*
*/
- private File getTarget0() {
+ private File getTarget0() throws IOException {
File target = getFile(getProperty("target", "generated"));
if (!target.exists()) {
- target.mkdirs();
+ if (!target.mkdirs()) {
+ throw new IOException("Could not create directory " + target);
+ }
getWorkspace().changedFile(target);
}
return target;
@@ -809,15 +815,16 @@ private String list(String[] args, Collection< ? > list) {
return join(list, separator);
}
+ @Override
protected Object[] getMacroDomains() {
return new Object[] {
workspace
};
}
- public File release(Jar jar) throws Exception {
+ public File release(String jarName, InputStream jarStream) throws Exception {
String name = getProperty(Constants.RELEASEREPO);
- return release(name, jar);
+ return release(name, jarName, jarStream);
}
/**
@@ -825,11 +832,12 @@ public File release(Jar jar) throws Exception {
*
* @param name
* The repository name
- * @param jar
+ * @param jarName
+ * @param jarStream
* @return
* @throws Exception
*/
- public File release(String name, Jar jar) throws Exception {
+ public File release(String name, String jarName, InputStream jarStream) throws Exception {
trace("release %s", name);
List<RepositoryPlugin> plugins = getPlugins(RepositoryPlugin.class);
RepositoryPlugin rp = null;
@@ -848,14 +856,11 @@ public File release(String name, Jar jar) throws Exception {
if (rp != null) {
try {
- File file = rp.put(jar);
- trace("Released %s to file %s in repository %s", jar.getName(), file, rp);
+ PutResult r = rp.put(jarStream, new RepositoryPlugin.PutOptions());
+ trace("Released %s to %s in repository %s", jarName, r.artifact, rp);
}
catch (Exception e) {
- msgs.Release_Into_Exception_(jar, rp, e);
- }
- finally {
- jar.close();
+ msgs.Release_Into_Exception_(jarName, rp, e);
}
} else if (name == null)
msgs.NoNameForReleaseRepository();
@@ -890,15 +895,8 @@ public void release(String name, boolean test) throws Exception {
}
trace("build ", Arrays.toString(jars));
for (File jar : jars) {
- Jar j = new Jar(jar);
- try {
- release(name, j);
- }
- finally {
- j.close();
- }
+ release(name, jar.getName(), new BufferedInputStream(new FileInputStream(jar)));
}
-
}
/**
@@ -1114,17 +1112,13 @@ public void deploy(String name, File file) throws Exception {
}
if (rp != null) {
- Jar jar = new Jar(file);
try {
- rp.put(jar);
+ rp.put(new BufferedInputStream(new FileInputStream(file)), new RepositoryPlugin.PutOptions());
return;
}
catch (Exception e) {
msgs.DeployingFile_On_Exception_(file, rp.getName(), e);
}
- finally {
- jar.close();
- }
return;
}
trace("No repo found " + file);
@@ -1155,22 +1149,16 @@ public void deploy() throws Exception {
}
File[] outputs = getBuildFiles();
for (File output : outputs) {
- Jar jar = new Jar(output);
- try {
for (Deploy d : getPlugins(Deploy.class)) {
- trace("Deploying %s to: %s", jar, d);
+ trace("Deploying %s to: %s", output.getName(), d);
try {
- if (d.deploy(this, jar))
+ if (d.deploy(this, output.getName(), new BufferedInputStream(new FileInputStream(output))))
trace("deployed %s successfully to %s", output, d);
}
catch (Exception e) {
msgs.Deploying(e);
}
}
- }
- finally {
- jar.close();
- }
}
}
@@ -1452,8 +1440,12 @@ public File saveBuild(Jar jar) throws Exception {
if (!f.exists() || f.lastModified() < jar.lastModified()) {
reportNewer(f.lastModified(), jar);
f.delete();
- if (!f.getParentFile().isDirectory())
- f.getParentFile().mkdirs();
+ File fp = f.getParentFile();
+ if (!fp.isDirectory()) {
+ if (!fp.exists() && !fp.mkdirs()) {
+ throw new IOException("Could not create directory " + fp);
+ }
+ }
jar.write(f);
getWorkspace().changedFile(f);
@@ -1491,6 +1483,7 @@ private void reportNewer(long lastModified, Jar jar) {
/**
* Refresh if we are based on stale data. This also implies our workspace.
*/
+ @Override
public boolean refresh() {
boolean changed = false;
if (isCnf()) {
@@ -1503,6 +1496,7 @@ public boolean isCnf() {
return getBase().getName().equals(Workspace.CNFDIR);
}
+ @Override
public void propertiesChanged() {
super.propertiesChanged();
preparedPaths = false;
@@ -1568,12 +1562,16 @@ public void clean() throws Exception {
File target = getTarget0();
if (target.isDirectory() && target.getParentFile() != null) {
IO.delete(target);
- target.mkdirs();
+ if (!target.exists() && !target.mkdirs()) {
+ throw new IOException("Could not create directory " + target);
+ }
}
File output = getOutput0();
if (getOutput().isDirectory())
IO.delete(output);
- output.mkdirs();
+ if (!output.exists() && !output.mkdirs()) {
+ throw new IOException("Could not create directory " + output);
+ }
}
public File[] build() throws Exception {
@@ -2052,7 +2050,10 @@ void updatePackageInfoFile(String packageName, Version newVersion) throws Except
String path = packageName.replace('.', '/') + "/packageinfo";
File binary = IO.getFile(getOutput(), path);
- binary.getParentFile().mkdirs();
+ File bp = binary.getParentFile();
+ if (!bp.exists() && !bp.mkdirs()) {
+ throw new IOException("Could not create directory " + bp);
+ }
IO.copy(file, binary);
refresh();
View
4 bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
@@ -27,12 +27,14 @@ public long lastModified() {
/**
* We put our project and our workspace on the macro path.
*/
+ @Override
protected Object[] getMacroDomains() {
return new Object[] {
project, project.getWorkspace()
};
}
+ @Override
public Builder getSubBuilder() throws Exception {
return project.getBuilder(this);
}
@@ -41,6 +43,7 @@ public Project getProject() {
return project;
}
+ @Override
public void init() {
try {
if (!initialized) {
@@ -68,6 +71,7 @@ public void init() {
}
}
+ @Override
public List<Jar> getClasspath() {
init();
return super.getClasspath();
View
3  bundleplugin/src/main/java/aQute/bnd/build/ProjectMessages.java
@@ -3,7 +3,6 @@
import java.io.*;
import java.util.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.service.*;
import aQute.bnd.service.RepositoryPlugin.Strategy;
import aQute.bnd.version.*;
@@ -39,7 +38,7 @@
ERROR ReleaseRepository_NotFoundIn_(String name, List<RepositoryPlugin> plugins);
- ERROR Release_Into_Exception_(Jar jar, RepositoryPlugin rp, Exception e);
+ ERROR Release_Into_Exception_(String jar, RepositoryPlugin rp, Exception e);
ERROR NoScripters_(String script);
View
4 bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
@@ -63,7 +63,9 @@ public void setContinuous(boolean b) {
}
public boolean prepare() throws Exception {
- reportDir.mkdirs();
+ if (!reportDir.exists() && !reportDir.mkdirs()) {
+ throw new IOException("Could not create directory " + reportDir);
+ }
for (File file : reportDir.listFiles()) {
file.delete();
}
View
1  bundleplugin/src/main/java/aQute/bnd/build/ReflectAction.java
@@ -16,6 +16,7 @@ public void execute(Project project, String action) throws Exception {
m.invoke(project);
}
+ @Override
public String toString() {
return "ra:" + what;
}
View
18 bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
@@ -81,7 +81,9 @@ public static Workspace getWorkspace(File parent) throws Exception {
public Workspace(File dir) throws Exception {
dir = dir.getAbsoluteFile();
- dir.mkdirs();
+ if (!dir.exists() && !dir.mkdirs()) {
+ throw new IOException("Could not create directory " + dir);
+ }
assert dir.isDirectory();
File buildDir = new File(dir, BNDDIR).getAbsoluteFile();
@@ -123,6 +125,7 @@ public boolean isPresent(String name) {
return models.values();
}
+ @Override
public boolean refresh() {
if (super.refresh()) {
for (Project project : getCurrentProjects()) {
@@ -261,19 +264,23 @@ void copy(InputStream in, OutputStream out) throws Exception {
super("cache", getFile(buildDir, CACHEDIR), false);
}
+ @Override
public String toString() {
return "bnd-cache";
}
+ @Override
protected void init() throws Exception {
if (lock.tryLock(50, TimeUnit.SECONDS) == false)
throw new TimeLimitExceededException("Cached File Repo is locked and can't acquire it");
try {
if (!inited) {
inited = true;
- root.mkdirs();
+ if (!root.exists() && !root.mkdirs()) {
+ throw new IOException("Could not create cache directory " + root);
+ }
if (!root.isDirectory())
- throw new IllegalArgumentException("Cannot create cache dir " + root);
+ throw new IllegalArgumentException("Cache directory " + root + " not a directory");
InputStream in = getClass().getResourceAsStream(EMBEDDED_REPO);
if (in != null)
@@ -296,7 +303,10 @@ void unzip(InputStream in, File dir) throws Exception {
if (!jentry.isDirectory()) {
File dest = Processor.getFile(dir, jentry.getName());
if (!dest.isFile() || dest.lastModified() < jentry.getTime() || jentry.getTime() == 0) {
- dest.getParentFile().mkdirs();
+ File dp = dest.getParentFile();
+ if (!dp.exists() && !dp.mkdirs()) {
+ throw new IOException("Could not create directory " + dp);
+ }
FileOutputStream out = new FileOutputStream(dest);
try {
copy(jin, out);
View
2  bundleplugin/src/main/java/aQute/bnd/build/WorkspaceRepository.java
@@ -86,7 +86,7 @@ public boolean canWrite() {
return false;
}
- public File put(Jar jar) throws Exception {
+ public PutResult put(InputStream stream, PutOptions options) throws Exception {
return null;
}
View
2  bundleplugin/src/main/java/aQute/bnd/build/packageinfo
@@ -1 +1 @@
-version 1.45.0
+version 2.0.0
View
1  bundleplugin/src/main/java/aQute/bnd/compatibility/Access.java
@@ -19,6 +19,7 @@ public static Access modifier(int mod) {
return PACKAGE;
}
+ @Override
public String toString() {
return super.toString().toLowerCase();
}
View
1  bundleplugin/src/main/java/aQute/bnd/compatibility/GenericParameter.java
@@ -13,6 +13,7 @@ public GenericParameter(String name, GenericType[] bounds) {
};
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(name);
View
1  bundleplugin/src/main/java/aQute/bnd/compatibility/Kind.java
@@ -6,6 +6,7 @@
public enum Kind {
ROOT, CLASS, FIELD, CONSTRUCTOR, METHOD, UNKNOWN;
+ @Override
public String toString() {
return super.toString().toLowerCase();
}
View
1  bundleplugin/src/main/java/aQute/bnd/compatibility/Scope.java
@@ -68,6 +68,7 @@ public void setBase(GenericType typeSignature) {
base = typeSignature;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
View
1  bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
@@ -129,6 +129,7 @@ protected String referredMethod(Analyzer analyzer, ReferenceDef rdef, String val
return null;
}
+ @Override
public void annotation(Annotation annotation) {
try {
java.lang.annotation.Annotation a = annotation.getAnnotation();
View
16 bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
@@ -29,15 +29,13 @@ public boolean analyzeJar(Analyzer analyzer) throws Exception {
if (instruction.matches(c.getFQN())) {
if (instruction.isNegated())
break;
- else {
- ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
- if (definition != null) {
- definition.sortReferences();
- definition.prepare(analyzer);
- String name = "OSGI-INF/" + definition.name + ".xml";
- names.add(name);
- analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
- }
+ ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
+ if (definition != null) {
+ definition.sortReferences();
+ definition.prepare(analyzer);
+ String name = "OSGI-INF/" + definition.name + ".xml";
+ names.add(name);
+ analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
}
}
}
View
1  bundleplugin/src/main/java/aQute/bnd/component/HeaderReader.java
@@ -91,6 +91,7 @@ public Tag createComponentTag(String name, String impl, Map<String, String> info
clazz.parseClassFileWithCollector(new ClassDataCollector() {
+ @Override
public void method(MethodDef md) {
Set<String> allowedParams = allowed;
String lifecycleName = null;
View
1  bundleplugin/src/main/java/aQute/bnd/component/ReferenceDef.java
@@ -88,6 +88,7 @@ public Tag getTag() {
return b;
}
+ @Override
public String toString() {
return name;
}
View
2  bundleplugin/src/main/java/aQute/bnd/component/TagResource.java
@@ -12,6 +12,7 @@ public TagResource(Tag tag) {
this.tag = tag;
}
+ @Override
public void write(OutputStream out) throws UnsupportedEncodingException {
OutputStreamWriter ow = new OutputStreamWriter(out, "UTF-8");
PrintWriter pw = new PrintWriter(ow);
@@ -24,6 +25,7 @@ public void write(OutputStream out) throws UnsupportedEncodingException {
}
}
+ @Override
public long lastModified() {
return 0;
}
View
3  bundleplugin/src/main/java/aQute/bnd/differ/DiffImpl.java
@@ -180,10 +180,12 @@ public String getName() {
return children;
}
+ @Override
public String toString() {
return String.format("%-10s %-10s %s", getDelta(), getType(), getName());
}
+ @Override
public boolean equals(Object other) {
if (other instanceof DiffImpl) {
DiffImpl o = (DiffImpl) other;
@@ -192,6 +194,7 @@ public boolean equals(Object other) {
return false;
}
+ @Override
public int hashCode() {
return getDelta().hashCode() ^ getType().hashCode() ^ getName().hashCode();
}
View
3  bundleplugin/src/main/java/aQute/bnd/differ/Element.java
@@ -100,6 +100,7 @@ public int compareTo(Tree other) {
return type.compareTo(other.getType());
}
+ @Override
public boolean equals(Object other) {
if (other == null || getClass() != other.getClass())
return false;
@@ -107,6 +108,7 @@ public boolean equals(Object other) {
return compareTo((Element) other) == 0;
}
+ @Override
public int hashCode() {
return type.hashCode() ^ name.hashCode();
}
@@ -135,6 +137,7 @@ public Element get(String name) {
return null;
}
+ @Override
public String toString() {
return type + " " + name + " (" + add + "/" + remove + ")";
}
View
7 bundleplugin/src/main/java/aQute/bnd/filerepo/FileRepo.java
@@ -4,7 +4,6 @@
import java.util.*;
import java.util.regex.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.version.*;
public class FileRepo {
@@ -97,9 +96,11 @@ public File get(String bsn, VersionRange range, int strategy) throws Exception {
return files[files.length - 1];
}
- public File put(String bsn, Version version) {
+ public File put(String bsn, Version version) throws IOException {
File dir = new File(root, bsn);
- dir.mkdirs();
+ if (!dir.exists() && !dir.mkdirs()) {
+ throw new IOException("Could not create directory " + dir);
+ }
File file = new File(dir, bsn + "-" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro()
+ ".jar");
return file;
View
4 bundleplugin/src/main/java/aQute/bnd/header/Attrs.java
@@ -3,7 +3,6 @@
import java.util.*;
import java.util.regex.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.version.*;
import aQute.lib.collections.*;
@@ -220,6 +219,7 @@ public String getVersion() {
return get("version");
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
append(sb);
@@ -237,11 +237,13 @@ public void append(StringBuilder sb) {
}
}
+ @Override
@Deprecated
public boolean equals(Object other) {
return super.equals(other);
}
+ @Override
@Deprecated
public int hashCode() {
return super.hashCode();
View
3  bundleplugin/src/main/java/aQute/bnd/header/Parameters.java
@@ -148,6 +148,7 @@ public int size() {
return map.values();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
append(sb);
@@ -168,11 +169,13 @@ public void append(StringBuilder sb) {
}
}
+ @Override
@Deprecated
public boolean equals(Object other) {
return super.equals(other);
}
+ @Override
@Deprecated
public int hashCode() {
return super.hashCode();
View
3  bundleplugin/src/main/java/aQute/bnd/make/calltree/CalltreeResource.java
@@ -47,6 +47,7 @@ public CalltreeResource(Collection<Clazz> values) {
* We set the last modified to 0 so this resource does not force a new JAR
* if all other resources are up to date.
*/
+ @Override
public long lastModified() {
return 0;
}
@@ -55,6 +56,7 @@ public long lastModified() {
* The write method is called to write the resource. We just call the static
* method.
*/
+ @Override
public void write(OutputStream out) throws Exception {
OutputStreamWriter osw = new OutputStreamWriter(out, Constants.DEFAULT_CHARSET);
PrintWriter pw = new PrintWriter(osw);
@@ -87,6 +89,7 @@ public static void writeCalltree(PrintWriter out, Collection<Clazz> classes) thr
Clazz.MethodDef source;
// Before a method is parsed
+ @Override
public void method(Clazz.MethodDef source) {
this.source = source;
xref(using, source, null);
View
1  bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java
@@ -80,6 +80,7 @@ public Reporter getReporter() {
return r.map;
}
+ @Override
public void annotation(Annotation annotation) {
String fqn = annotation.getName().getFQN();
View
2  bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java
@@ -11,11 +11,9 @@
import aQute.bnd.header.*;
import aQute.bnd.make.metatype.*;
import aQute.bnd.osgi.*;
-import aQute.bnd.osgi.Clazz.MethodDef;
import aQute.bnd.osgi.Clazz.QUERY;
import aQute.bnd.osgi.Descriptors.TypeRef;
import aQute.bnd.service.*;
-import aQute.bnd.version.*;
import aQute.lib.tag.Tag;
/**
View
4 bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java
@@ -37,6 +37,7 @@ private static void crossRef(Collection<Clazz> source, final Map<MethodDef,List<
clazz.parseClassFileWithCollector(new ClassDataCollector() {
MethodDef source;
+ @Override
public void implementsInterfaces(TypeRef names[]) {
MethodDef def = clazz.getMethodDef(0, "<implements>", "()V");
// TODO
@@ -53,6 +54,7 @@ public void implementsInterfaces(TypeRef names[]) {
}
// Method definitions
+ @Override
public void method(MethodDef source) {
this.source = source;
}
@@ -77,10 +79,12 @@ public int compare(MethodDef a, MethodDef b) {
for (final Clazz clazz : sources) {
clazz.parseClassFileWithCollector(new ClassDataCollector() {
+ @Override
public boolean classStart(int access, TypeRef name) {
return clazz.isPublic();
}
+ @Override
public void method(MethodDef source) {
if (source.isPublic() || source.isProtected())
catalog.put(source, new ArrayList<MethodDef>());
View
2  bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java
@@ -171,6 +171,7 @@ private void addMethod(MethodDef method, Meta.AD ad) throws Exception {
final List<String> values = Create.list();
c.parseClassFileWithCollector(new ClassDataCollector() {
+ @Override
public void field(Clazz.FieldDef def) {
if (def.isEnum()) {
values.add(def.getName());
@@ -236,6 +237,7 @@ public void annotation(Annotation annotation) {
}
+ @Override
public void write(OutputStream out) throws IOException {
try {
finish();
View
16 bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
@@ -60,7 +60,9 @@ public void run(String args[], int i) throws Exception {
trace("temp dir " + temp);
IO.delete(temp);
- temp.mkdirs();
+ if (!temp.exists() && !temp.mkdirs()) {
+ throw new IOException("Could not create directory " + temp);
+ }
if (!temp.isDirectory())
throw new IOException("Cannot create temp directory");
@@ -210,7 +212,9 @@ else if (option.startsWith("-properties")) {
}
File original = getFile(temp, "original");
- original.mkdirs();
+ if (!original.exists() && !original.mkdirs()) {
+ throw new IOException("Could not create directory " + original);
+ }
binaryJar.expand(original);
binaryJar.calcChecksums(null);
@@ -272,7 +276,9 @@ else if (option.startsWith("-properties")) {
trace("creating bundle dir");
File bundle = new File(temp, "bundle");
- bundle.mkdirs();
+ if (!bundle.exists() && !bundle.mkdirs()) {
+ throw new IOException("Could not create directory " + bundle);
+ }
String prefix = pom.getArtifactId() + "-" + pom.getVersion();
File binaryFile = new File(bundle, prefix + ".jar");
@@ -400,7 +406,9 @@ private void sign(File file, String passphrase) throws Exception {
private Jar javadoc(File source, Set<String> exports, Manifest m, Properties p) throws Exception {
File tmp = new File(temp, "javadoc");
- tmp.mkdirs();
+ if (!tmp.exists() && !tmp.mkdirs()) {
+ throw new IOException("Could not create directory " + tmp);
+ }
Command command = new Command();
command.add(getProperty("javadoc", "javadoc"));
View
1  bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java
@@ -63,6 +63,7 @@ public void add(Artifact artifact) {
dependencies.add(artifact);
}
+ @Override
public String toString() {
return groupId + "." + artifactId + "-" + version + "[" + scope + "," + optional + "]";
}
View
88 bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java
@@ -40,56 +40,64 @@ public void setReporter(Reporter processor) {
/**
*/
- public boolean deploy(Project project, Jar original) throws Exception {
+ public boolean deploy(Project project, String jarName, InputStream jarStream) throws Exception {
Parameters deploy = project.parseHeader(project.getProperty(Constants.DEPLOY));
Map<String,String> maven = deploy.get(repository);
if (maven == null)
return false; // we're not playing for this bundle
- project.progress("deploying %s to Maven repo: %s", original, repository);
+ project.progress("deploying %s to Maven repo: %s", jarName, repository);
File target = project.getTarget();
File tmp = Processor.getFile(target, repository);
- tmp.mkdirs();
-
- Manifest manifest = original.getManifest();
- if (manifest == null)
- project.error("Jar has no manifest: %s", original);
- else {
- project.progress("Writing pom.xml");
- PomResource pom = new PomResource(manifest);
- pom.setProperties(maven);
- File pomFile = write(tmp, pom, "pom.xml");
-
- Jar main = new Jar("main");
- Jar src = new Jar("src");
- try {
- split(original, main, src);
- Parameters exports = project.parseHeader(manifest.getMainAttributes()
- .getValue(Constants.EXPORT_PACKAGE));
- File jdoc = new File(tmp, "jdoc");
- jdoc.mkdirs();
- project.progress("Generating Javadoc for: " + exports.keySet());
- Jar javadoc = javadoc(jdoc, project, exports.keySet());
- project.progress("Writing javadoc jar");
- File javadocFile = write(tmp, new JarResource(javadoc), "javadoc.jar");
- project.progress("Writing main file");
- File mainFile = write(tmp, new JarResource(main), "main.jar");
- project.progress("Writing sources file");
- File srcFile = write(tmp, new JarResource(main), "src.jar");
-
- project.progress("Deploying main file");
- maven_gpg_sign_and_deploy(project, mainFile, null, pomFile);
- project.progress("Deploying main sources file");
- maven_gpg_sign_and_deploy(project, srcFile, "sources", null);
- project.progress("Deploying main javadoc file");
- maven_gpg_sign_and_deploy(project, javadocFile, "javadoc", null);
+ if (!tmp.exists() && !tmp.mkdirs()) {
+ throw new IOException("Could not create directory " + tmp);
+ }
+ Jar original = new Jar(jarName, jarStream);
+ try {
+ Manifest manifest = original.getManifest();
+ if (manifest == null)
+ project.error("Jar has no manifest: %s", original);
+ else {
+ project.progress("Writing pom.xml");
+ PomResource pom = new PomResource(manifest);
+ pom.setProperties(maven);
+ File pomFile = write(tmp, pom, "pom.xml");
+
+ Jar main = new Jar("main");
+ Jar src = new Jar("src");
+ try {
+ split(original, main, src);
+ Parameters exports = project.parseHeader(manifest.getMainAttributes().getValue(
+ Constants.EXPORT_PACKAGE));
+ File jdoc = new File(tmp, "jdoc");
+ jdoc.mkdirs();
+ project.progress("Generating Javadoc for: " + exports.keySet());
+ Jar javadoc = javadoc(jdoc, project, exports.keySet());
+ project.progress("Writing javadoc jar");
+ File javadocFile = write(tmp, new JarResource(javadoc), "javadoc.jar");
+ project.progress("Writing main file");
+ File mainFile = write(tmp, new JarResource(main), "main.jar");
+ project.progress("Writing sources file");
+ File srcFile = write(tmp, new JarResource(main), "src.jar");
+
+ project.progress("Deploying main file");
+ maven_gpg_sign_and_deploy(project, mainFile, null, pomFile);
+ project.progress("Deploying main sources file");
+ maven_gpg_sign_and_deploy(project, srcFile, "sources", null);
+ project.progress("Deploying main javadoc file");
+ maven_gpg_sign_and_deploy(project, javadocFile, "javadoc", null);
+
+ }
+ finally {
+ main.close();
+ src.close();
+ }
}
- finally {
- main.close();
- src.close();
- }
+ }
+ finally {
+ original.close();
}
return true;
}
View
8 bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java
@@ -85,7 +85,9 @@ public boolean deploy(Project project, Jar original) throws Exception {
project.progress("deploying %s to Maven repo: %s", original, repository);
File target = project.getTarget();
File tmp = Processor.getFile(target, repository);
- tmp.mkdirs();
+ if (!tmp.exists() && !tmp.mkdirs()) {
+ throw new IOException("Could not create directory " + tmp);
+ }
Manifest manifest = original.getManifest();
if (manifest == null)
@@ -103,7 +105,9 @@ public boolean deploy(Project project, Jar original) throws Exception {
Parameters exports = project.parseHeader(manifest.getMainAttributes()
.getValue(Constants.EXPORT_PACKAGE));
File jdoc = new File(tmp, "jdoc");
- jdoc.mkdirs();
+ if (!jdoc.exists() && !jdoc.mkdirs()) {
+ throw new IOException("Could not create directory " + jdoc);
+ }
project.progress("Generating Javadoc for: " + exports.keySet());
Jar javadoc = javadoc(jdoc, project, exports.keySet());
project.progress("Writing javadoc jar");
View
3  bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
@@ -17,6 +17,7 @@
Reporter reporter;
String name;
+ @Override
public String toString() {
return "maven:" + root;
}
@@ -112,7 +113,7 @@ void find(List<String> bsns, Pattern pattern, File base, String name) {
}
}
- public File put(Jar jar) throws Exception {
+ public PutResult put(InputStream stream, PutOptions options) throws Exception {
throw new IllegalStateException("Maven does not support the put command");
}
View
1  bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java
@@ -11,6 +11,7 @@
this.maven = mavenEntry;
}
+ @Override
public File getArtifact() throws Exception {
return maven.getArtifact();
}
View
8 bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java
@@ -43,7 +43,9 @@
this.pomPath = path + ".pom";
this.artifactPath = path + ".jar";
this.dir = IO.getFile(maven.repository, path).getParentFile();
- this.dir.mkdirs();
+ if (!this.dir.exists() && !this.dir.mkdirs()) {
+ throw new ExceptionInInitializerError("Could not create directory " + this.dir);
+ }
this.pomFile = new File(maven.repository, pomPath);
this.artifactFile = new File(maven.repository, artifactPath);
this.propertiesFile = new File(dir, "bnd.properties");
@@ -98,7 +100,9 @@ public CachedPom getPom(URI[] urls) throws Exception {
// the file.
} else {
- dir.mkdirs();
+ if (!dir.exists() && !dir.mkdirs()) {
+ throw new IOException("Could not create directory " + dir);
+ }
// We really do not have the file
// so we have to find out who has it.
for (final URI url : urls) {
View
3  bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
@@ -4,7 +4,6 @@
import java.net.*;
import java.util.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.service.*;
import aQute.bnd.version.*;
import aQute.lib.io.*;
@@ -68,7 +67,7 @@ public boolean canWrite() {
return false;
}
- public File put(Jar jar) throws Exception {
+ public PutResult put(InputStream stream, PutOptions options) throws Exception {
throw new UnsupportedOperationException("cannot do put");
}
View
1  bundleplugin/src/main/java/aQute/bnd/maven/support/Pom.java
@@ -296,6 +296,7 @@ protected String replace(String in) {
return in;
}
+ @Override
public String toString() {
return groupId + "+" + artifactId + "-" + version;
}
View
1  bundleplugin/src/main/java/aQute/bnd/maven/support/ProjectPom.java
@@ -136,6 +136,7 @@ public boolean excludes(String name) {
// Match any macros
final static Pattern MACRO = Pattern.compile("(\\$\\{\\s*([^}\\s]+)\\s*\\})");
+ @Override
protected String replace(String in) {
System.err.println("Replce: " + in);
if (in == null) {
View
2  bundleplugin/src/main/java/aQute/bnd/maven/support/packageinfo
@@ -1 +1 @@
-version 1.0
+version 2.0
View
14 bundleplugin/src/main/java/aQute/bnd/osgi/Analyzer.java
@@ -769,6 +769,7 @@ public void mergeManifest(Manifest manifest) throws IOException {
}
}
+ @Override
public void setBase(File file) {
super.setBase(file);
getProperties().put("project.dir", getBase().getAbsolutePath());
@@ -840,6 +841,7 @@ public Jar setJar(Jar jar) {
return jar;
}
+ @Override
protected void begin() {
if (inited == false) {
inited = true;
@@ -1466,6 +1468,7 @@ void getExportVersionsFromPackageInfo(PackageRef packageRef, Resource r, Package
}
}
+ @Override
public void close() {
if (diagnostics) {
PrintStream out = System.err;
@@ -1612,6 +1615,7 @@ public void addClasspath(File cp) throws IOException {
classpath.add(jar);
}
+ @Override
public void clear() {
classpath.clear();
}
@@ -2447,7 +2451,10 @@ public boolean save(File output, boolean force) throws Exception {
jar.lastModified() - output.lastModified());
if (!output.exists() || output.lastModified() <= jar.lastModified() || force) {
- output.getParentFile().mkdirs();
+ File op = output.getParentFile();
+ if (!op.exists() && !op.mkdirs()) {
+ throw new IOException("Could not create directory " + op);
+ }
if (source != null && output.getCanonicalPath().equals(source.getCanonicalPath())) {
File bak = new File(source.getParentFile(), source.getName() + ".bak");
if (!source.renameTo(bak)) {
@@ -2545,11 +2552,13 @@ public void setDefaults(String bsn, Version version) {
clazz.parseClassFileWithCollector(new ClassDataCollector() {
Clazz.Def member;
+ @Override
public void extendsClass(TypeRef zuper) throws Exception {
if (dest.contains(zuper.getPackageRef()))
xref.add(clazz.getExtends(zuper), zuper);
}
+ @Override
public void implementsInterfaces(TypeRef[] interfaces) throws Exception {
for (TypeRef i : interfaces) {
if (dest.contains(i.getPackageRef()))
@@ -2557,6 +2566,7 @@ public void implementsInterfaces(TypeRef[] interfaces) throws Exception {
}
}
+ @Override
public void referTo(TypeRef to, int modifiers) {
if (to.isJava())
return;
@@ -2570,10 +2580,12 @@ public void referTo(TypeRef to, int modifiers) {
}
+ @Override
public void method(Clazz.MethodDef defined) {
member = defined;
}
+ @Override
public void field(Clazz.FieldDef defined) {
member = defined;
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/Annotation.java
@@ -34,6 +34,7 @@ public RetentionPolicy getRetentionPolicy() {
return policy;
}
+ @Override
public String toString() {
return name + ":" + member + ":" + policy + ":" + elements;
}
View
8 bundleplugin/src/main/java/aQute/bnd/osgi/Builder.java
@@ -238,7 +238,10 @@ private void doSaveManifest(Jar dot) throws Exception {
f = new File(f, "MANIFEST.MF");
}
f.delete();
- f.getParentFile().mkdirs();
+ File fp = f.getParentFile();
+ if (!fp.exists() && !fp.mkdirs()) {
+ throw new IOException("Could not create directory " + fp);
+ }
OutputStream out = new FileOutputStream(f);
try {
Jar.writeManifest(dot.getManifest(), out);
@@ -281,6 +284,7 @@ public boolean hasSources() {
/**
* Answer extra packages. In this case we implement conditional package. Any
*/
+ @Override
protected Jar getExtra() throws Exception {
Parameters conditionals = getParameters(CONDITIONAL_PACKAGE);
if (conditionals.isEmpty())
@@ -315,6 +319,7 @@ protected Jar getExtra() throws Exception {
* the setup. We do not want to cleanup if we are going to verify.
*/
+ @Override
public void analyze() throws Exception {
super.analyze();
cleanupVersion(getImports(), null);
@@ -1078,6 +1083,7 @@ public void addSourcepath(File cp) {
sourcePath.add(cp);
}
+ @Override
public void close() {
super.close();
}
View
2  bundleplugin/src/main/java/aQute/bnd/osgi/BundleId.java
@@ -24,10 +24,12 @@ public boolean isValid() {
return Verifier.isVersion(version) && Verifier.isBsn(bsn);
}
+ @Override
public boolean equals(Object o) {
return this == o || ((o instanceof BundleId) && compareTo((BundleId) o) == 0);
}
+ @Override
public int hashCode() {
return bsn.hashCode() ^ version.hashCode();
}
View
12 bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
@@ -251,11 +251,13 @@ public FieldDef(int access, String name, String descriptor) {
this.descriptor = analyzer.getDescriptor(descriptor);
}
+ @Override
public String getName() {
return name;
}
+ @Override
public TypeRef getType() {
return descriptor.getType();
}
@@ -290,6 +292,7 @@ public String getGenericReturnType() {
return objectDescriptorToFQN(returnType);
}
+ @Override
public TypeRef[] getPrototype() {
return null;
}
@@ -297,6 +300,7 @@ public String getSignature() {
return signature;
}
+ @Override
public String toString() {
return name;
}
@@ -311,6 +315,7 @@ public boolean isConstructor() {
return name.equals("<init>") || name.equals("<clinit>");
}
+ @Override
public TypeRef[] getPrototype() {
return descriptor.getPrototype();
}
@@ -335,16 +340,18 @@ public boolean getImplements() {
}
+ @Override
public String getName() {
if (interf)
return "<implements>";
- else
- return "<extends>";
+ return "<extends>";
}
+ @Override
public TypeRef getType() {
return type;
}
+ @Override
public TypeRef[] getPrototype() {
return null;
}
@@ -1527,6 +1534,7 @@ public boolean is(QUERY query, Instruction instr, Analyzer analyzer) throws Exce
return clazz.is(query, instr, analyzer);
}
+ @Override
public String toString() {
return className.getFQN();
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/CombinedResource.java
@@ -10,6 +10,7 @@
@Override
public void write(final OutputStream out) throws IOException, Exception {
OutputStream unclosable = new FilterOutputStream(out) {
+ @Override
public void close() {
// Ignore
}
View
10 bundleplugin/src/main/java/aQute/bnd/osgi/Descriptors.java
@@ -95,6 +95,7 @@ public boolean isJava() {
return java;
}
+ @Override
public String toString() {
return fqn;
}
@@ -111,11 +112,13 @@ public int compareTo(PackageRef other) {
return fqn.compareTo(other.fqn);
}
+ @Override
public boolean equals(Object o) {
assert o instanceof PackageRef;
return o == this;
}
+ @Override
public int hashCode() {
return super.hashCode();
}
@@ -207,6 +210,7 @@ public boolean isJava() {
return packageRef.isJava();
}
+ @Override
public String toString() {
return fqn;
}
@@ -215,6 +219,7 @@ public boolean isObject() {
return fqn.equals("java.lang.Object");
}
+ @Override
public boolean equals(Object other) {
assert other instanceof TypeRef;
return this == other;
@@ -268,6 +273,7 @@ public TypeRef getClassRef() {
return component.getClassRef();
}
+ @Override
public boolean equals(Object other) {
if (other == null || other.getClass() != getClass())
return false;
@@ -287,6 +293,7 @@ public boolean isJava() {
return component.isJava();
}
+ @Override
public String toString() {
return component.toString() + "[]";
}
@@ -457,6 +464,7 @@ public TypeRef getType() {
return prototype;
}
+ @Override
public boolean equals(Object other) {
if (other == null || other.getClass() != getClass())
return false;
@@ -464,10 +472,12 @@ public boolean equals(Object other) {
return Arrays.equals(prototype, ((Descriptor) other).prototype) && type == ((Descriptor) other).type;
}
+ @Override
public int hashCode() {
return prototype == null ? type.hashCode() : type.hashCode() ^ Arrays.hashCode(prototype);
}
+ @Override
public String toString() {
return descriptor;
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/EmbeddedResource.java
@@ -23,6 +23,7 @@ public void write(OutputStream out) throws IOException {
out.write(data);
}
+ @Override
public String toString() {
return ":" + data.length + ":";
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/FileResource.java
@@ -19,6 +19,7 @@ public static void build(Jar jar, File directory, Pattern doNotCopy) {
traverse(jar, directory.getAbsolutePath().length(), directory, doNotCopy);
}
+ @Override
public String toString() {
return ":" + file.getName() + ":";
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/Instruction.java
@@ -145,6 +145,7 @@ public String getInput() {
return input;
}
+ @Override
public String toString() {
return input;
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/Instructions.java
@@ -145,6 +145,7 @@ public int size() {
return map.values();
}
+ @Override
public String toString() {
return map == null ? "{}" : map.toString();
}
View
10 bundleplugin/src/main/java/aQute/bnd/osgi/Jar.java
@@ -97,6 +97,7 @@ public void setName(String name) {
this.name = name;
}
+ @Override
public String toString() {
return "Jar:" + name;
}
@@ -768,14 +769,19 @@ public String getVersion() throws Exception {
public void expand(File dir) throws Exception {
check();
dir = dir.getAbsoluteFile();
- dir.mkdirs();
+ if (!dir.exists() && !dir.mkdirs()) {
+ throw new IOException("Could not create directory " + dir);
+ }
if (!dir.isDirectory()) {
throw new IllegalArgumentException("Not a dir: " + dir.getAbsolutePath());
}
for (Map.Entry<String,Resource> entry : getResources().entrySet()) {
File f = getFile(dir, entry.getKey());
- f.getParentFile().mkdirs();
+ File fp = f.getParentFile();
+ if (!fp.exists() && !fp.mkdirs()) {
+ throw new IOException("Could not create directory " + fp);
+ }
IO.copy(entry.getValue().openInputStream(), f);
}
}
View
3  bundleplugin/src/main/java/aQute/bnd/osgi/JarResource.java
@@ -10,10 +10,12 @@ public JarResource(Jar jar) {
this.jar = jar;
}
+ @Override
public long lastModified() {
return jar.lastModified();
}
+ @Override
public void write(OutputStream out) throws Exception {
try {
jar.write(out);
@@ -28,6 +30,7 @@ public Jar getJar() {
return jar;
}
+ @Override
public String toString() {
return ":" + jar.getName() + ":";
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
@@ -895,6 +895,7 @@ public boolean contains(String key) {
return previous.contains(key);
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
String del = "[";
View
3  bundleplugin/src/main/java/aQute/bnd/osgi/Packages.java
@@ -179,6 +179,7 @@ public boolean containsBinaryName(String s) {
return getByFQN(s) != null;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
append(sb);
@@ -219,11 +220,13 @@ public Attrs get(PackageRef packageRef, Attrs deflt) {
return deflt;
}
+ @Override
@Deprecated
public boolean equals(Object other) {
return super.equals(other);
}
+ @Override
@Deprecated
public int hashCode() {
return super.hashCode();
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/PreprocessResource.java
@@ -13,6 +13,7 @@ public PreprocessResource(Processor processor, Resource r) {
setExtra(resource.getExtra());
}
+ @Override
protected byte[] getBytes() throws Exception {
ByteArrayOutputStream bout = new ByteArrayOutputStream(2000);
OutputStreamWriter osw = new OutputStreamWriter(bout, Constants.DEFAULT_CHARSET);
View
25 bundleplugin/src/main/java/aQute/bnd/osgi/Processor.java
@@ -127,12 +127,10 @@ public SetLocation error(String string, Object... args) {
try {
if (p.isFailOk())
return p.warning(string, args);
- else {
- String s = formatArrays(string, args == null ? new Object[0] : args);
- if (!p.errors.contains(s))
- p.errors.add(s);
- return location(s);
- }
+ String s = formatArrays(string, args == null ? new Object[0] : args);
+ if (!p.errors.contains(s))
+ p.errors.add(s);
+ return location(s);
}
finally {
p.signal();
@@ -160,13 +158,11 @@ public SetLocation error(String string, Throwable t, Object... args) {
if (p.isFailOk()) {
return p.warning(string + ": " + t, args);
}
- else {
- p.errors.add("Exception: " + t.getMessage());
- String s = formatArrays(string, args == null ? new Object[0] : args);
- if (!p.errors.contains(s))
- p.errors.add(s);
- return location(s);
- }
+ p.errors.add("Exception: " + t.getMessage());
+ String s = formatArrays(string, args == null ? new Object[0] : args);
+ if (!p.errors.contains(s))
+ p.errors.add(s);
+ return location(s);
}
finally {
p.signal();
@@ -408,6 +404,7 @@ protected void setTypeSpecificPlugins(Set<Object> list) {
return plugin;
}
+ @Override
public boolean isFailOk() {
String v = getProperty(Analyzer.FAIL_OK, null);
return v != null && v.equalsIgnoreCase("true");
@@ -1184,6 +1181,7 @@ void add(URL url) {
super.addURL(url);
}
+ @Override
public Class< ? > loadClass(String name) throws NoClassDefFoundError {
try {
Class< ? > c = super.loadClass(name);
@@ -1581,6 +1579,7 @@ public void remove() {
* Printout of the status of this processor for toString()
*/
+ @Override
public String toString() {
try {
StringBuilder sb = new StringBuilder();
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/URLResource.java
@@ -18,6 +18,7 @@ public InputStream openInputStream() throws IOException {
return url.openStream();
}
+ @Override
public String toString() {
return ":" + url.getPath() + ":";
}
View
2  bundleplugin/src/main/java/aQute/bnd/osgi/Verifier.java
@@ -47,6 +47,7 @@
this.target = target;
}
+ @Override
public String toString() {
return name + "(" + target + ")";
}
@@ -814,6 +815,7 @@ private boolean verifyListHeader(String name, Pattern regex, boolean error) {
return true;
}
+ @Override
public String getProperty(String key, String deflt) {
if (properties == null)
return deflt;
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/WriteResource.java
@@ -10,6 +10,7 @@ public InputStream openInputStream() throws Exception {
PipedInputStream pin = new PipedInputStream();
final PipedOutputStream pout = new PipedOutputStream(pin);
Thread t = new Thread() {
+ @Override
public void run() {
try {
write(pout);
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/ZipResource.java
@@ -24,6 +24,7 @@ public InputStream openInputStream() throws IOException {
return zip.getInputStream(entry);
}
+ @Override
public String toString() {
return ":" + zip.getName() + "(" + entry.getName() + "):";
}
View
1  bundleplugin/src/main/java/aQute/bnd/osgi/resource/Filters.java
@@ -2,7 +2,6 @@
import org.osgi.framework.namespace.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.version.*;
import aQute.libg.filters.*;
View
7 bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
@@ -85,7 +85,10 @@ private String read(File index) throws Exception {
private void write(File index, Map<String, ? extends Map<String,String>> map) throws Exception {
String s = Processor.printClauses(map);
- index.getParentFile().mkdirs();
+ File ip = index.getParentFile();
+ if (!ip.exists() && !ip.mkdirs()) {
+ throw new IOException("Could not create directory " + ip);
+ }
PrintWriter fw = IO.writer(index);
try {
fw.write(s);
@@ -166,7 +169,7 @@ public String getName() {
return result;
}
- public File put(Jar jar) throws Exception {
+ public PutResult put(InputStream stream, PutOptions options) throws Exception {
return null;
}
View
5 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;
}
View
102 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.
View
2  bundleplugin/src/main/java/aQute/bnd/service/packageinfo
@@ -1 +1 @@
-version 2.0.0
+version 3.0.0
View
2  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;
View
1  bundleplugin/src/main/java/aQute/bnd/signing/JartoolSigner.java