private XmlRpcFileManager startXmlRpcFileManager(int port, String catPath) {
Properties properties = new Properties(System.getProperties());
XmlRpcFileManager fileMgr = null;
// first make sure to load properties for the file manager
// and make sure to load logging properties as well
// set the log levels
URL loggingPropertiesUrl = this.getClass().getResource(
"/test.logging.properties");
properties.setProperty("java.util.logging.config.file", new File(
loggingPropertiesUrl.getFile()).getAbsolutePath());
// first load the example configuration
try {
URL filemgrPropertiesUrl = this.getClass().getResource(
"/filemgr.properties");
properties.load(
new FileInputStream(new File(filemgrPropertiesUrl.getFile())));
} catch (Exception e) {
fail(e.getMessage());
}
// override the catalog to use: we'll use lucene
properties.setProperty("filemgr.catalog.factory",
"org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory");
properties.setProperty(
"org.apache.oodt.cas.filemgr.catalog.lucene.idxPath",
catPath);
// now override the repo mgr policy
URL fmpolicyUrl = this.getClass().getResource("/ingest/fmpolicy");
try {
properties.setProperty(
"org.apache.oodt.cas.filemgr.repositorymgr.dirs",
"file://" + new File(fmpolicyUrl.getFile()).getCanonicalPath());
} catch (Exception e) {
fail(e.getMessage());
}
// now override the val layer ones
properties.setProperty("org.apache.oodt.cas.filemgr.validation.dirs",
"file://" + new File(fmpolicyUrl.getFile()).getAbsolutePath());
// set up mime repo path
URL mimeTypesUrl = this.getClass().getResource("/mime-types.xml");
properties.setProperty(
"org.apache.oodt.cas.filemgr.mime.type.repository",
new File(mimeTypesUrl.getFile()).getAbsolutePath());
System.setProperties(properties);
try {
fileMgr = new XmlRpcFileManager(port);
} catch (Exception e) {
fail(e.getMessage());
}
return fileMgr;