public Jar getValidJar(Jar jar, String id) throws Exception { Manifest manifest = jar.getManifest(); if (manifest == null) { trace("Wrapping with all defaults"); Builder b = new Builder(this); b.addClasspath(jar); b.setProperty("Bnd-Message", "Wrapped from " + id + "because lacked manifest"); b.setProperty(Constants.EXPORT_PACKAGE, "*"); b.setProperty(Constants.IMPORT_PACKAGE, "*;resolution:=optional"); jar = b.build(); } else if (manifest.getMainAttributes().getValue(Constants.BUNDLE_MANIFESTVERSION) == null) { trace("Not a release 4 bundle, wrapping with manifest as source"); Builder b = new Builder(this); b.addClasspath(jar); b.setProperty(Constants.PRIVATE_PACKAGE, "*"); b.mergeManifest(manifest); String imprts = manifest.getMainAttributes().getValue(Constants.IMPORT_PACKAGE); if (imprts == null) imprts = ""; else imprts += ","; imprts += "*;resolution=optional"; b.setProperty(Constants.IMPORT_PACKAGE, imprts); b.setProperty("Bnd-Message", "Wrapped from " + id + "because had incomplete manifest"); jar = b.build(); } return jar; }
public static void createBundle(IndexingConfig config){ Builder builder = new Builder(); builder.setProperty("Install-Path", builder.setProperty(Builder.EXPORT_PACKAGE,CONFIG_PACKAGE+config.getName().toLowerCase()); builder.setProperty(Builder.BUNDLE_CATEGORY, "Stanbol Data"); builder.setProperty(Builder.BUNDLE_NAME, "Apache Stanbol Data: "+config.getName()); builder.setProperty(Builder.CREATED_BY, "Apache Stanbol Entityhub Indexing Utils"); builder.setProperty(Builder.BUNDLE_VENDOR, "Apache Stanbol (Incubating)");//TODO make configureable builder.setProperty(Builder.BUNDLE_VERSION, "1.0.0"); builder.setProperty(Builder.BUNDLE_DESCRIPTION, "Bundle created for import of the referenced site " + config.getName() +" into the Apache Stanbol Entityhub"); builder.setProperty(Builder.BUNDLE_SYMBOLICNAME, CONFIG_PACKAGE+config.getName().toLowerCase()); try { builder.addClasspath(new File(config.getDestinationFolder(),CONFIG_ROOT));
public static void createBundle(IndexingConfig config){ Builder builder = new Builder(); builder.setProperty("Install-Path", builder.setProperty(Builder.EXPORT_PACKAGE,CONFIG_PACKAGE+config.getName().toLowerCase()); builder.setProperty(Builder.BUNDLE_CATEGORY, "Stanbol Data"); builder.setProperty(Builder.BUNDLE_NAME, "Apache Stanbol Data: "+config.getName()); builder.setProperty(Builder.CREATED_BY, "Apache Stanbol Entityhub Indexing Utils"); builder.setProperty(Builder.BUNDLE_VENDOR, "Apache Stanbol (Incubating)");//TODO make configureable builder.setProperty(Builder.BUNDLE_VERSION, "1.0.0"); builder.setProperty(Builder.BUNDLE_DESCRIPTION, "Bundle created for import of the referenced site " + config.getName() +" into the Apache Stanbol Entityhub"); builder.setProperty(Builder.BUNDLE_SYMBOLICNAME, CONFIG_PACKAGE+config.getName().toLowerCase()); try { builder.addClasspath(new File(config.getDestinationFolder(),CONFIG_ROOT));
builder.setProperty("Bundle-Name", jobName); builder.setProperty("Bundle-SymbolicName", jobName); builder.setProperty("Bundle-Version", jobVersion); builder.setProperty("Export-Package", "!routines.system*,*"); builder.setProperty("Import-Package", "routines.system*;resolution:=optional,*;resolution:=optional"); builder.setProperty("Private-Package", "routines.system*"); logger.debug("Iterate in the working directory"); File[] files = uncompressDir.listFiles();
Builder b = new Builder(this); b.addClasspath(jar); b.setProperty("Bnd-Message", "Wrapped from " + f.getAbsolutePath() + "because lacked manifest"); b.setProperty(Constants.EXPORT_PACKAGE, "*"); b.setProperty(Constants.IMPORT_PACKAGE, "*;resolution:=optional"); jar = b.build(); } else if (manifest.getMainAttributes().getValue( Builder b = new Builder(this); b.addClasspath(jar); b.setProperty(Constants.PRIVATE_PACKAGE, "*"); b.mergeManifest(manifest); String imprts = manifest.getMainAttributes().getValue( imprts += "*;resolution=optional"; b.setProperty(Constants.IMPORT_PACKAGE, imprts); b.setProperty("Bnd-Message", "Wrapped from " + f.getAbsolutePath() + "because had incomplete manifest"); jar = b.build();
b.addClasspath(getFile(args[i])); b.setProperty(EXPORT_PACKAGE, "*"); b.setPedantic(isPedantic()); b.build();
a.setProperty("Private-Package", "*"); Set<Pom> dependencies = pom.getDependencies(Scope.compile, urls2); for ( Pom dep : dependencies ) {
/** * Intercept the call to analyze and cleanup versions after we have analyzed * the setup. We do not want to cleanup if we are going to verify. */ public void analyze() throws IOException { super.analyze(); cleanupVersion(imports); cleanupVersion(exports); String version = getProperty(BUNDLE_VERSION); if (version != null) setProperty(BUNDLE_VERSION, cleanupVersion(version)); }
private void copy(Jar jar, String path, File from, boolean preprocess, Map<String, String> extra) throws Exception { if (doNotCopy(from.getName())) return; if (from.isDirectory()) { File files[] = from.listFiles(); for (int i = 0; i < files.length; i++) { copy(jar, appendPath(path, files[i].getName()), files[i], preprocess, extra); } } else { if (from.exists()) { Resource resource = new FileResource(from); if (preprocess) { resource = new PreprocessResource(this, resource); } String x = extra.get("extra"); if (x != null) resource.setExtra(x); if (path.endsWith("/")) path = path + from.getName(); jar.putResource(path, resource); if (isTrue(extra.get(LIB_DIRECTIVE))) { setProperty(BUNDLE_CLASSPATH, append(getProperty(BUNDLE_CLASSPATH), path)); } } else { error("Input file does not exist: " + from); } } }
/** * Intercept the call to analyze and cleanup versions after we have analyzed * the setup. We do not want to cleanup if we are going to verify. */ public void analyze() throws Exception { super.analyze(); cleanupVersion(imports, null); cleanupVersion(exports, getVersion()); String version = getProperty(BUNDLE_VERSION); if (version != null) { version = cleanupVersion(version); if (version.endsWith(".SNAPSHOT")) { version = version.replaceAll("SNAPSHOT$", getProperty(SNAPSHOT, "SNAPSHOT")); } setProperty(BUNDLE_VERSION, version); } }
builder.setProperty(Analyzer.FAIL_OK, "true"); Jar jar = builder.build(); getInfo(builder);
String path = "WEB-INF/lib/" + f.getName(); dot.putResource(path, new JarResource(jar)); setProperty(BUNDLE_CLASSPATH, append(getProperty(BUNDLE_CLASSPATH), path));
addClose(builder); builder.setProperties(file); builder.setProperty(SUB, ""); setProperty(SUB, sub); return result.toArray(new Jar[result.size()]);
builder.setProperty(Analyzer.FAIL_OK, "true"); Jar jar = builder.build(); getInfo(builder);
return dot; setProperty(BUNDLE_CLASSPATH, append("WEB-INF/classes", getProperty(BUNDLE_CLASSPATH)));
bchild.setProperty(Analyzer.INCLUDE_RESOURCE, ""); bchild.setProperties(bndfile, builder.getBase());
bchild.setProperty(Analyzer.INCLUDE_RESOURCE, ""); bchild.setProperty(Analyzer.INCLUDERESOURCE, ""); bchild.setProperties(bndfile, builder.getBase());