use of com.emc.storageos.db.common.schema.DbSchemas in project coprhd-controller by CoprHD.
the class DbSchemaChecker method genGeoDiffs.
/**
* Filter out all the non-geo db schemas from the spec and generate a diff
* Note that some CFs might have been migrated from local db to geo db
* So we need to grab a latest list of geo schemas from the current schema first.
*
* @param spec the db schema spec generated from the baseline file
* @param geoSchemas the latest list of geo schemas from the current DbSchemas object
* @return
*/
private static DbSchemasDiff genGeoDiffs(DbSchemas spec, List<DbSchema> geoSchemas) {
// prepare a list of geo schema names
List<String> geoSchemaNames = new ArrayList<>();
for (DbSchema geoSchema : geoSchemas) {
geoSchemaNames.add(geoSchema.getName());
}
List<DbSchema> specSchemaList = new ArrayList<>();
for (DbSchema schema : spec.getSchemas()) {
if (geoSchemaNames.contains(schema.getName())) {
specSchemaList.add(schema);
}
}
return new DbSchemasDiff(new DbSchemas(specSchemaList), new DbSchemas(geoSchemas));
}
use of com.emc.storageos.db.common.schema.DbSchemas in project coprhd-controller by CoprHD.
the class DbSchemaChecker method unmarshalSchemas.
public static DbSchemas unmarshalSchemas(final String version, final Reader reader) {
DbSchemas schemas = null;
try {
JAXBContext jc = JAXBContext.newInstance(DbSchemas.class);
Unmarshaller um = jc.createUnmarshaller();
schemas = (DbSchemas) um.unmarshal(reader);
log.info("{} drop unused schema if exists", version);
removeUnusedSchemaIfExists(schemas, DbSchemaInterceptorImpl.getIgnoreCfList());
if (DbSchemaFilter.needDoFilterFor(version)) {
log.info("filter out the garbage fileds for {}", version);
DbSchemaFilter.doFilter(schemas);
}
} catch (JAXBException e) {
log.error("Failed to unmarshal DbSchemas:", e);
}
return schemas;
}
Aggregations