/** * Create a ModelRecord instance from the specified index record */ public Schema createModelRecord(final char[] record) { final List<String> tokens = getStrings(record, IndexConstants.RECORD_STRING.RECORD_DELIMITER); final Schema model = new Schema(); // The tokens are the standard header values int tokenIndex = 0; setRecordHeaderValues(model, tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++)); // The next token is the max set size tokenIndex++; // The next token is the model type model.setPhysical(Integer.parseInt(tokens.get(tokenIndex++)) == 0); // The next token is the primary metamodel Uri model.setPrimaryMetamodelUri(getObjectValue(tokens.get(tokenIndex++))); // The next token are the supports flags tokens.get(tokenIndex++); // The next tokens are footer values - the footer will contain the version number for the index record setRecordFooterValues(model, tokens, tokenIndex); return model; }
/** * Create a ModelRecord instance from the specified index record */ public Schema createModelRecord(final char[] record) { final List<String> tokens = getStrings(record, IndexConstants.RECORD_STRING.RECORD_DELIMITER); final Schema model = new Schema(); // The tokens are the standard header values int tokenIndex = 0; setRecordHeaderValues(model, tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++), tokens.get(tokenIndex++)); // The next token is the max set size tokenIndex++; // The next token is the model type model.setPhysical(Integer.parseInt(tokens.get(tokenIndex++)) == 0); // The next token is the primary metamodel Uri model.setPrimaryMetamodelUri(getObjectValue(tokens.get(tokenIndex++))); // The next token are the supports flags tokens.get(tokenIndex++); // The next tokens are footer values - the footer will contain the version number for the index record setRecordFooterValues(model, tokens, tokenIndex); return model; }
/** * Create a physical model with default settings. */ public static Schema createPhysicalModel(String name, MetadataStore metadataStore) { Schema schema = new Schema(); schema.setName(name); metadataStore.addSchema(schema); return schema; }
/** * Create a virtual model with default settings. */ public static Schema createVirtualModel(String name, MetadataStore metadataStore) { Schema schema = new Schema(); schema.setName(name); schema.setPhysical(false); metadataStore.addSchema(schema); return schema; }
@Test public void testFunction() throws Exception { Schema s = new Schema(); s.addFunction(MetadataFactory.createFunctionFromMethod("x", TestDDLStringVisitor.class.getMethod("someMethod", int.class))); String metadataDDL = DDLStringVisitor.getDDLString(s, null, null); assertEquals("CREATE VIRTUAL FUNCTION x(param1 integer) RETURNS string[]" + "\nOPTIONS (NAMEINSOURCE 'x', JAVA_CLASS 'org.teiid.query.metadata.TestDDLStringVisitor', JAVA_METHOD 'someMethod');", metadataDDL); }
schema = new Schema(); schema.setName(name); schema.setPhysical(physical);
final LinkedHashMap<String, ModelMetaData> modelMetaDatas = metadata.getModelMetaDatas(); for (ModelMetaData m:modelMetaDatas.values()) { Schema schema = new Schema(); schema.setName(m.getName()); schema.setAnnotation(m.getDescription());
schema = new Schema(); schema.setName(name); schema.setPhysical(physical);
schema = new Schema(); schema.setName(name); schema.setPhysical(physical);
Schema s = new Schema(); t1.setParent(s); s.setProperty(DataModifiable.DATA_TTL, "0");
Schema schema = new Schema(); schema.setName("SchemaA"); schema.addTable(t);