Skip to content

Commit

Permalink
Added KnownBundleAnalyzerPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
njbartlett committed Jan 23, 2013
1 parent e0987e2 commit 80b8972
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion biz.aQute.repository/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bundle-Version: 2.0.4.${tstamp;yyyyMMdd-HHmmss}_${Git-Descriptor}
Bundle-Version: 2.0.5.${tstamp;yyyyMMdd-HHmmss}_${Git-Descriptor}

jetty.libs: lib/javax.servlet-2.5.0.jar;version=file,\
lib/jetty-continuation-7.6.3.v20120416.jar;version=file,\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package aQute.bnd.deployer.repository.providers;

import java.io.*;
import java.util.*;

import org.osgi.service.indexer.*;
import org.osgi.service.indexer.impl.*;

import aQute.bnd.service.*;
import aQute.service.reporter.*;

public class KnownBundleAnalyzerPlugin extends KnownBundleAnalyzer implements ResourceAnalyzer, Plugin {

private static final String PROP_DATA = "data";

private Reporter reporter;

public KnownBundleAnalyzerPlugin() {
super(new Properties());
}

public void setProperties(Map<String,String> config) {
String fileName = config.get(PROP_DATA);
if (fileName == null)
throw new IllegalArgumentException(String.format("Property name '%s' must be set on KnownBundleAnalyzerPlugin", PROP_DATA));
File file = new File(fileName);
if (!file.isFile())
throw new IllegalArgumentException(String.format("Data file does not exist, or is not a plain file: %s", file));

FileInputStream stream = null;
try {
stream = new FileInputStream(file);
Properties props = new Properties();
props.load(stream);
setKnownBundlesExtra(props);
} catch (IOException e) {
throw new IllegalArgumentException(String.format("Unable to read data file: %s", file), e);
} finally {
try { if (stream != null) stream.close(); } catch (IOException e) {}
}
}

public void setReporter(Reporter reporter) {
this.reporter = reporter;
}

}

0 comments on commit 80b8972

Please sign in to comment.