} else {
configFileLoc = System.getProperty("org.apache.oodt.opendap.config.filePath");
}
if (configFileLoc.isEmpty()){
throw new ProfileException(
"Configuration file not found. Please specify in System property opendap.config.filePath or as URL parameter ConfigUrl");
} else {
try {
this.conf = OpendapConfigReader.read(configFileLoc);
} catch (FileNotFoundException e) {
throw new ProfileException("FileNotFoundException: File not found!");
} catch (MalformedURLException e) {
throw new ProfileException("MalformedURLException: please fix file URL");
}
}
List<Profile> profiles = new Vector<Profile>();
List<DapRoot> roots = this.conf.getRoots();
// loop over THREDDS catalogs
for (DapRoot root : roots) {
LOG.log(Level.INFO,"Parsing DapRoot="+root.getDatasetUrl());
DatasetExtractor d = new DatasetExtractor(xmlQuery, root.getCatalogUrl()
.toExternalForm(), root.getDatasetUrl().toExternalForm(), conf);
if (d.getDapUrls() != null) {
for (String opendapUrl : d.getDapUrls()) {
// wrap the profile generation in try-catch to avoid stopping the whole harvesting process in case an exception is thrown
try {
LOG.log(Level.FINE,"Connecting to opendapurl="+opendapUrl);
Profile profile = new Profile();
DConnect dConn = null;
try {
dConn = new DConnect(opendapUrl, true);
} catch (FileNotFoundException e) {
LOG.log(Level.WARNING, "Opendap URL not found: [" + opendapUrl
+ "]: Message: " + e.getMessage());
throw new ProfileException("Opendap URL not found: [" + opendapUrl
+ "]: Message: " + e.getMessage());
}
// retrieve already extracted THREDDS metadata
Metadata datasetMet = d.getDatasetMet(opendapUrl);