本文整理了Java中aQute.lib.osgi.Jar.close()
方法的一些代码示例,展示了Jar.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.close()
方法的具体详情如下:
包路径:aQute.lib.osgi.Jar
类名称:Jar
方法名:close
暂无
代码示例来源:origin: biz.aQute/aQute.bnd
public void close() {
super.close();
if (dot != null)
dot.close();
if (classpath != null)
for (Iterator<Jar> j = classpath.iterator(); j.hasNext();) {
Jar jar = j.next();
jar.close();
}
}
代码示例来源:origin: io.fabric8.fab/fab-osgi
public void run()
{
try
{
jar.write( pout );
}
catch( Exception e )
{
LOG.warn( "Bundle cannot be generated" );
}
finally
{
try
{
jar.close();
pout.close();
}
catch( IOException ignore )
{
// if we get here something is very wrong
LOG.error( "Bundle cannot be generated", ignore );
}
}
}
}.start();
代码示例来源:origin: org.fusesource.fabric.fab/fab-osgi
public void run()
{
try
{
jar.write( pout );
}
catch( Exception e )
{
LOG.warn( "Bundle cannot be generated" );
}
finally
{
try
{
jar.close();
pout.close();
}
catch( IOException ignore )
{
// if we get here something is very wrong
LOG.error( "Bundle cannot be generated", ignore );
}
}
}
}.start();
代码示例来源:origin: biz.aQute/bnd
dot.close();
jar.close();
代码示例来源:origin: io.fabric8.fab/fab-core
public Set<String> getPackages() throws IOException {
if (packages == null) {
if (getExtension().equals("jar") || getExtension().equals("zip")) {
aQute.lib.osgi.Jar jar = new aQute.lib.osgi.Jar(getJarFile());
try {
packages = new HashSet<String>(jar.getPackages());
} finally {
jar.close();
}
} else {
return Collections.emptySet();
}
}
return packages;
}
代码示例来源:origin: org.fusesource.fabric.fab/fab-core
public Set<String> getPackages() throws IOException {
if (packages == null) {
if (getExtension().equals("jar") || getExtension().equals("zip")) {
aQute.lib.osgi.Jar jar = new aQute.lib.osgi.Jar(getJarFile());
try {
packages = new HashSet<String>(jar.getPackages());
} finally {
jar.close();
}
} else {
return Collections.emptySet();
}
}
return packages;
}
代码示例来源:origin: org.fusesource.fabric.fab/fabric-fab-core
public Set<String> getPackages() throws IOException {
if( packages==null ) {
if( getExtension().equals("jar") || getExtension().equals("zip") ) {
aQute.lib.osgi.Jar jar = new aQute.lib.osgi.Jar(getJarFile());
try {
packages = new HashSet<String>(jar.getPackages());
} finally {
jar.close();
}
} else {
return Collections.emptySet();
}
}
return packages;
}
代码示例来源:origin: biz.aQute/bnd
void applyPatch(String old, String patch, String newer) throws Exception {
Jar a = new Jar(new File(old));
Jar b = new Jar(new File(patch));
Manifest bm = b.getManifest();
String patchDelete = bm.getMainAttributes().getValue("Patch-Delete");
String patchVersion = bm.getMainAttributes().getValue("Patch-Version");
if (patchVersion == null) {
error("To patch, you must provide a patch bundle.\nThe given " + patch
+ " bundle does not contain the Patch-Version header");
return;
}
Collection<String> delete = split(patchDelete);
Set<String> paths = new HashSet<String>(a.getResources().keySet());
paths.removeAll(delete);
for (String path : paths) {
Resource br = b.getResource(path);
if (br == null)
b.putResource(path, a.getResource(path));
}
bm.getMainAttributes().putValue("Bundle-Version", patchVersion);
b.write(new File(newer));
a.close();
b.close();
}
代码示例来源:origin: biz.aQute/aQute.bnd
void applyPatch(String old, String patch, String newer) throws Exception {
Jar a = new Jar(new File(old));
Jar b = new Jar(new File(patch));
Manifest bm = b.getManifest();
String patchDelete = bm.getMainAttributes().getValue("Patch-Delete");
String patchVersion = bm.getMainAttributes().getValue("Patch-Version");
if (patchVersion == null) {
error("To patch, you must provide a patch bundle.\nThe given "
+ patch
+ " bundle does not contain the Patch-Version header");
return;
}
Collection<String> delete = split(patchDelete);
Set<String> paths = new HashSet<String>(a.getResources().keySet());
paths.removeAll(delete);
for (String path : paths) {
Resource br = b.getResource(path);
if (br == null)
b.putResource(path, a.getResource(path));
}
bm.getMainAttributes().putValue("Bundle-Version", patchVersion);
b.write(new File(newer));
a.close();
b.close();
}
代码示例来源:origin: biz.aQute/bnd
public File saveBuild(Jar jar) throws Exception {
try {
String bsn = jar.getName();
File f = getOutputFile(bsn);
String msg = "";
if (!f.exists() || f.lastModified() < jar.lastModified()) {
reportNewer(f.lastModified(), jar);
f.delete();
if (!f.getParentFile().isDirectory())
f.getParentFile().mkdirs();
jar.write(f);
getWorkspace().changedFile(f);
} else {
msg = "(not modified since " + new Date(f.lastModified()) + ")";
}
trace(jar.getName() + " (" + f.getName() + ") " + jar.getResources().size() + " " + msg);
return f;
} finally {
jar.close();
}
}
代码示例来源:origin: biz.aQute/bnd
void createPatch(String old, String newer, String patch) throws Exception {
Jar a = new Jar(new File(old));
Manifest am = a.getManifest();
Jar b = new Jar(new File(newer));
Manifest bm = b.getManifest();
Set<String> delete = newSet();
for (String path : a.getResources().keySet()) {
Resource br = b.getResource(path);
if (br == null) {
trace("DELETE %s", path);
delete.add(path);
} else {
Resource ar = a.getResource(path);
if (isEqual(ar, br)) {
trace("UNCHANGED %s", path);
b.remove(path);
} else
trace("UPDATE %s", path);
}
}
bm.getMainAttributes().putValue("Patch-Delete", join(delete, ", "));
bm.getMainAttributes().putValue("Patch-Version",
am.getMainAttributes().getValue("Bundle-Version"));
b.write(new File(patch));
a.close();
a.close();
}
代码示例来源:origin: biz.aQute/aQute.bnd
void createPatch(String old, String newer, String patch) throws Exception {
Jar a = new Jar(new File(old));
Manifest am = a.getManifest();
Jar b = new Jar(new File(newer));
Manifest bm = b.getManifest();
Set<String> delete = newSet();
for (String path : a.getResources().keySet()) {
Resource br = b.getResource(path);
if (br == null) {
trace("DELETE %s", path);
delete.add(path);
} else {
Resource ar = a.getResource(path);
if (isEqual(ar, br)) {
trace("UNCHANGED %s", path);
b.remove(path);
} else
trace("UPDATE %s", path);
}
}
bm.getMainAttributes().putValue("Patch-Delete", join(delete, ", "));
bm.getMainAttributes().putValue("Patch-Version",
am.getMainAttributes().getValue("Bundle-Version"));
b.write(new File(patch));
a.close();
a.close();
}
代码示例来源:origin: biz.aQute/aQute.bnd
/**
* Release
*
* @param name
* The respository name
* @param test
* Run testcases
* @throws Exception
*/
public void release(String name, boolean test) throws Exception {
File[] jars = build(test);
// If build fails jars will be null
if (jars == null) {
return;
}
for (File jar : jars) {
Jar j = new Jar(jar);
release(name, j);
j.close();
}
}
代码示例来源:origin: biz.aQute/bnd
/**
* @param out
* @param file
* @throws IOException
* @throws Exception
*/
void doSingleFileLib(File file, Appendable out) throws IOException, Exception {
Jar jar = new Jar(file);
String bsn = jar.getBsn();
System.out.println(bsn);
String version = jar.getVersion();
jar.close();
if (bsn == null) {
error("No valid bsn for %s", file);
bsn = "not set";
}
if (version == null)
version = "0";
Version v = new Version(version);
v = new Version(v.getMajor(), v.getMinor(), v.getMicro());
out.append(bsn);
out.append(";version=" + v + "\n"); // '[" + v + "," + v + "]'\n");
}
代码示例来源:origin: biz.aQute/bnd
/**
* Release
*
* @param name
* The respository name
* @param test
* Run testcases
* @throws Exception
*/
public void release(String name, boolean test) throws Exception {
trace("release");
File[] jars = build(test);
// If build fails jars will be null
if (jars == null) {
trace("no jars being build");
return;
}
trace("build ", Arrays.toString(jars));
for (File jar : jars) {
Jar j = new Jar(jar);
try {
release(name, j);
} finally {
j.close();
}
}
}
代码示例来源:origin: biz.aQute/aQute.bnd
private void doExpand(Jar jar) throws IOException {
if (getClasspath().size() == 0
&& (getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null))
warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one");
Map<Instruction, Map<String, String>> privateMap = replaceWitInstruction(
getHeader(PRIVATE_PACKAGE), PRIVATE_PACKAGE);
Map<Instruction, Map<String, String>> exportMap = replaceWitInstruction(
getHeader(EXPORT_PACKAGE), EXPORT_PACKAGE);
if (isTrue(getProperty(Constants.UNDERTEST))) {
privateMap.putAll(replaceWitInstruction(parseHeader(getProperty(
Constants.TESTPACKAGES, "test;presence:=optional")),
TESTPACKAGES));
}
if (!privateMap.isEmpty())
doExpand(jar, "Private-Package, or -testpackages", privateMap, true);
if (!exportMap.isEmpty()) {
Jar exports = new Jar("exports");
doExpand(exports, "Export-Package", exportMap, true);
jar.addAll(exports);
exports.close();
}
if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly()) {
warning("Neither Export-Package, Private-Package, -testpackages is set, therefore no packages will be included");
}
}
代码示例来源:origin: biz.aQute/bnd
jar.close();
verifier.close();
代码示例来源:origin: biz.aQute/aQute.bnd
jar.close();
verifier.close();
代码示例来源:origin: biz.aQute/bnd
/**
* Deploy the current project to a repository
*
* @throws Exception
*/
public void deploy() throws Exception {
Map<String, Map<String, String>> deploy = parseHeader(getProperty(DEPLOY));
if (deploy.isEmpty()) {
warning("Deploying but %s is not set to any repo", DEPLOY);
return;
}
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);
try {
if (d.deploy(this, jar))
trace("deployed %s successfully to %s", output, d);
} catch (Exception e) {
error("Error while deploying %s, %s", this, e);
e.printStackTrace();
}
}
} finally {
jar.close();
}
}
}
代码示例来源:origin: biz.aQute/bnd
private void doExpand(Jar jar) throws IOException {
if (getClasspath().size() == 0
&& (getProperty(EXPORT_PACKAGE) != null || getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null))
warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one");
Map<Instruction, Map<String, String>> privateMap = Instruction
.replaceWithInstruction(getHeader(PRIVATE_PACKAGE));
Map<Instruction, Map<String, String>> exportMap = Instruction
.replaceWithInstruction(getHeader(EXPORT_PACKAGE));
if (isTrue(getProperty(Constants.UNDERTEST))) {
privateMap.putAll(Instruction.replaceWithInstruction(parseHeader(getProperty(
Constants.TESTPACKAGES, "test;presence:=optional"))));
}
if (!privateMap.isEmpty())
doExpand(jar, "Private-Package, or -testpackages", privateMap, true);
if (!exportMap.isEmpty()) {
Jar exports = new Jar("exports");
doExpand(exports, EXPORT_PACKAGE, exportMap, true);
jar.addAll(exports);
exports.close();
}
if (!isNoBundle()) {
if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly()
&& getProperty(EXPORT_CONTENTS) == null) {
warning("None of Export-Package, Provide-Package, Private-Package, -testpackages, or -exportcontents is set, therefore no packages will be included");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!