private void inventoryStorages(int schemaVersion, SchemaModel schema) { for (SchemaObjectType objectType : schema.getSchemaObjectTypes().values()) this.inventoryStorages(schemaVersion, objectType); }
private int write(XMLStreamWriter writer, boolean nameFormat) throws XMLStreamException { // Gather all known object storage IDs final TreeSet<Integer> storageIds = new TreeSet<>(); for (Schema schema : this.tx.getSchemas().getVersions().values()) storageIds.addAll(schema.getSchemaModel().getSchemaObjectTypes().keySet()); // Get corresponding object sets final ArrayList<NavigableSet<ObjId>> sets = storageIds.stream() .map(this.tx::getAll) .collect(Collectors.toCollection(() -> new ArrayList<>(storageIds.size()))); // Output all objects return this.write(writer, nameFormat, Iterables.concat(sets)); }
/** * Get the {@link SchemaModel} associated with this instance, derived from the annotations on the scanned classes. * * @return the associated schema model */ public SchemaModel getSchemaModel() { if (this.schemaModel == null) { final SchemaModel model = new SchemaModel(); for (JClass<?> jclass : this.jclasses.values()) { final SchemaObjectType schemaObjectType = jclass.toSchemaItem(this); model.getSchemaObjectTypes().put(schemaObjectType.getStorageId(), schemaObjectType); } this.schemaModel = model; this.schemaModel.lockDown(); this.log.debug("JSimpleDB schema generated from annotated classes:\n{}", this.schemaModel); } return this.schemaModel; }
for (SchemaObjectType type : schemaModel.getSchemaObjectTypes().values()) {
@Override public void run(CliSession session) throws Exception { final PrintWriter writer = session.getWriter(); writer.println(" CLI Mode: " + session.getMode()); writer.println(" Database: " + session.getDatabaseDescription()); writer.println(" Access Mode: " + (session.isReadOnly() ? "Read-Only" : "Read/Write")); writer.println(" Verbose Mode: " + session.isVerbose()); if (session.getMode().equals(SessionMode.KEY_VALUE)) return; final int schemaVersion = InfoCommand.getSchemaVersion(session); writer.println(" Schema Version: " + (schemaVersion != 0 ? schemaVersion : "Undefined")); final SchemaModel schemaModel = InfoCommand.getSchemaModel(session); writer.println(" Schema Model: " + (schemaModel != null ? schemaModel.getSchemaObjectTypes().size() + " object type(s)" : "Undefined")); writer.println(" New Schema Allowed: " + (session.isAllowNewSchema() ? "Yes" : "No")); if (session.getJSimpleDB() != null) { writer.println(" Validation Mode: " + (session.getValidationMode() != null ? session.getValidationMode() : ValidationMode.AUTOMATIC)); } }
for (SchemaObjectType schemaObjectType : this.schemaModel.getSchemaObjectTypes().values()) { final ObjType objType = new ObjType(schemaObjectType, this, fieldTypeRegistry); final int storageId = objType.getStorageId();
final SchemaObjectType schemaObjectType = schemaModel.getSchemaObjectTypes().get(objType.getStorageId()); while ((name = this.next(reader)) != null) { final QName fieldTagName = name;
if ((objectType = schema.getSchemaObjectTypes().get(id.getStorageId())) == null) { info.handle(new InvalidValue(pair).setDetail("invalid object ID " + id + " with storage ID " + id.getStorageId() + ": no such object type exists in schema version "