use of com.revolsys.record.schema.RecordDefinitionFactory in project com.revolsys.open by revolsys.
the class SaifReader method loadExportedObjects.
/**
* Load the exported objects for the SAIF archive.
*
* @throws IOException If there was an I/O error.
*/
@SuppressWarnings("unchecked")
private void loadExportedObjects() throws IOException {
final boolean setNames = this.includeTypeNames.isEmpty();
final ClassPathResource resource = new ClassPathResource("com/revolsys/io/saif/saifzip.csn");
final RecordDefinitionFactory schema = new SaifSchemaReader().loadSchema(resource);
final OsnReader reader = getOsnReader(schema, this.factory, "/exports.dir");
try {
final Map<String, String> names = new TreeMap<>();
if (reader.hasNext()) {
this.exportedObjects = reader.next();
final Set<Record> handles = (Set<Record>) this.exportedObjects.getValue("handles");
for (final Record exportedObject : handles) {
final String fileName = (String) exportedObject.getValue("objectSubset");
if (fileName != null && !fileName.equals("globmeta.osn")) {
String typePath = getTypeName(fileName);
if (typePath == null) {
final String name = (String) exportedObject.getValue("type");
typePath = PathCache.getName(name);
if (!this.fileNameTypeNameMap.containsKey(fileName)) {
this.fileNameTypeNameMap.put(fileName, typePath);
this.typePathFileNameMap.put(typePath, fileName);
}
}
if (setNames && !fileName.equals("metdat00.osn") && !fileName.equals("refsys00.osn")) {
names.put(typePath.toString(), typePath);
}
}
}
if (setNames) {
this.typePaths = new ArrayList<>(names.values());
} else {
this.typePaths = new ArrayList<>(this.includeTypeNames);
}
this.typePaths.removeAll(this.excludeTypeNames);
}
} finally {
reader.close();
}
}
Aggregations