use of org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor in project ovirt-engine by oVirt.
the class RsdlManager method loadMetaData.
private static MetaData loadMetaData(InputStream in) throws IOException {
Constructor constructor = new CustomClassLoaderConstructor(Thread.currentThread().getContextClassLoader());
MetaData metaData = (MetaData) new Yaml(constructor).load(in);
if (metaData == null) {
throw new IOException("Can't load metadata from input stream");
}
// Make sure that the loaded metadata contains default values:
assignDefaults(metaData);
// Remove leading slashes from all the action names:
for (Action action : metaData.getActions()) {
String name = action.getName();
name = name.replaceAll("^/?", "");
action.setName(name);
}
return metaData;
}
Aggregations