for ( String d : desclist) {
if ( d.endsWith(".svc") ) {
int ndx = d.lastIndexOf(".");
String stem = d.substring(0, ndx);
DuccProperties props = new DuccProperties();
String props_filename = serviceFileKey(d);
props.load(props_filename);
DuccProperties metaprops = new DuccProperties();
String meta_filename = serviceFileKey(stem + ".meta");
metaprops.load(meta_filename);
String sc = metaprops.getProperty("service-class");
if ( (sc != null) && ( sc.equals("Implicit") || sc.equals("Submitted") ) ) {
logger.info(methodName, null, "Scrubbing", sc, "service", stem);
deleteProperties(stem, meta_filename, metaprops, props_filename, props);
continue;
}
int friendly = 0;
String uuid = "";
try {
// these gets will throw if the requisite objects aren't found
friendly = metaprops.getIntProperty("numeric_id");
uuid = metaprops.getStringProperty("uuid");
} catch (MissingPropertyException e1) {
// Ugly, but shouldn't have to be fatal
logger.error(methodName, null, "Cannot restore DuccId for", d, "Friendly id:", friendly, "uuid:", uuid);
continue;
}
DuccId id = new DuccId(friendly);
id.setUUID(UUID.fromString(uuid));
logger.debug(methodName, id, "Unique:", id.getUnique());
try {
handler.register(id, props_filename, meta_filename, props, metaprops);
} catch (IllegalStateException e ) { // happens on duplicate service
logger.error(methodName, id, e.getMessage()); // message has all I need.
}
}
}
} catch (Throwable e) {
// If we get here we aren't startable.
logger.error(methodName, null, "Cannot initialize service manger: ", e.getMessage());
System.exit(1);
}
state_dir = System.getProperty("DUCC_HOME") + "/state";
state_file = state_dir + "/sm.properties";
descriptor_dir = state_dir + "/services";
File ddir = new File(descriptor_dir);
if ( ddir.exists() ) {
if ( ! ddir.isDirectory() ) {
throw new IllegalStateException("Service descriptor location is not a directory: " + descriptor_dir);
}
} else {
ddir.mkdirs();
}
sm_props = new DuccProperties();
File sf = new File(state_file);
int seq = 0;
FileInputStream fos;
if ( sf.exists() ) {
fos = new FileInputStream(state_file);