use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestTransformationMetadata method testAmbiguousTableWithPrivateModel.
@Test
public void testAmbiguousTableWithPrivateModel() throws Exception {
Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
Datatype dt = new Datatype();
dt.setName(DataTypeManager.DefaultDataTypes.STRING);
dt.setJavaClassName(String.class.getCanonicalName());
datatypes.put(DataTypeManager.DefaultDataTypes.STRING, dt);
// $NON-NLS-1$
MetadataFactory mf = new MetadataFactory(null, 1, "x", datatypes, new Properties(), null);
// $NON-NLS-1$
mf.addTable("y");
// $NON-NLS-1$
MetadataFactory mf1 = new MetadataFactory(null, 1, "x1", datatypes, new Properties(), null);
// $NON-NLS-1$
mf1.addTable("y");
CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.asMetadataStore(), mf1.asMetadataStore()));
VDBMetaData vdb = new VDBMetaData();
vdb.setName("foo");
vdb.setVersion(1);
ModelMetaData model = new ModelMetaData();
model.setName("x1");
vdb.addModel(model);
ModelMetaData model2 = new ModelMetaData();
model2.setName("x");
model2.setVisible(true);
vdb.addModel(model2);
TransformationMetadata tm = new TransformationMetadata(vdb, cms, null, RealMetadataFactory.SFM.getSystemFunctions(), null);
// $NON-NLS-1$
Collection result = tm.getGroupsForPartialName("y");
assertEquals(2, result.size());
RealMetadataFactory.buildWorkContext(tm, vdb);
model.setVisible(false);
tm = new TransformationMetadata(vdb, cms, null, RealMetadataFactory.SFM.getSystemFunctions(), null);
// $NON-NLS-1$
result = tm.getGroupsForPartialName("y");
assertEquals(1, result.size());
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestTransformationMetadata method exampleTransformationMetadata.
private TransformationMetadata exampleTransformationMetadata() throws TranslatorException {
Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
Datatype dt = new Datatype();
dt.setName(DataTypeManager.DefaultDataTypes.STRING);
dt.setJavaClassName(String.class.getCanonicalName());
datatypes.put(DataTypeManager.DefaultDataTypes.STRING, dt);
// $NON-NLS-1$
MetadataFactory mf = new MetadataFactory(null, 1, "x", datatypes, new Properties(), null);
// $NON-NLS-1$
mf.addProcedure("y");
Table t = mf.addTable("foo");
mf.addColumn("col", DataTypeManager.DefaultDataTypes.STRING, t);
// $NON-NLS-1$
MetadataFactory mf1 = new MetadataFactory(null, 1, "x1", datatypes, new Properties(), null);
// $NON-NLS-1$
mf1.addProcedure("y");
Table table = mf1.addTable("doc");
table.setSchemaPaths(Arrays.asList("../../x.xsd"));
table.setResourcePath("/a/b/doc.xmi");
HashMap<String, VDBResources.Resource> resources = new HashMap<String, VDBResources.Resource>();
resources.put("/x.xsd", new VDBResources.Resource(VFS.getRootVirtualFile()));
CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.asMetadataStore(), mf1.asMetadataStore()));
VDBMetaData vdb = new VDBMetaData();
vdb.setName("vdb");
vdb.setVersion(1);
vdb.addModel(buildModel("x"));
vdb.addModel(buildModel("x1"));
vdb.addModel(buildModel("y"));
return new TransformationMetadata(vdb, cms, resources, RealMetadataFactory.SFM.getSystemFunctions(), null);
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class EvaluatorIterator method createTransformationMetadata.
public static TransformationMetadata createTransformationMetadata(String ddl) {
MetadataStore mds = new MetadataStore();
MetadataFactory mf = new MetadataFactory("vdb", 1, IMPLICIT_MODEL_NAME, SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
QueryParser.getQueryParser().parseDDL(mf, ddl);
mf.mergeInto(mds);
CompositeMetadataStore store = new CompositeMetadataStore(mds);
VDBMetaData vdbMetaData = new VDBMetaData();
// $NON-NLS-1$
vdbMetaData.setName("vdb");
vdbMetaData.setVersion(1);
List<FunctionTree> udfs = new ArrayList<FunctionTree>();
for (Schema schema : store.getSchemas().values()) {
vdbMetaData.addModel(createModel(schema.getName(), schema.isPhysical()));
}
TransformationMetadata metadata = new TransformationMetadata(vdbMetaData, store, null, SFM.getSystemFunctions(), udfs);
vdbMetaData.addAttchment(TransformationMetadata.class, metadata);
vdbMetaData.addAttchment(QueryMetadataInterface.class, metadata);
return metadata;
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class RealMetadataFactory method exampleBQTVDB.
public static VDBMetaData exampleBQTVDB() {
VDBMetaData vdb = new VDBMetaData();
vdb.setName("example1");
vdb.setVersion(1);
vdb.addModel(RealMetadataFactory.createModel("BQT1", true));
vdb.addModel(RealMetadataFactory.createModel("BQT2", true));
vdb.addModel(RealMetadataFactory.createModel("BQT3", true));
vdb.addModel(RealMetadataFactory.createModel("LOB", true));
vdb.addModel(RealMetadataFactory.createModel("VQT", false));
vdb.addModel(RealMetadataFactory.createModel("pm1", true));
vdb.addModel(RealMetadataFactory.createModel("pm2", true));
vdb.addModel(RealMetadataFactory.createModel("pm3", true));
vdb.addModel(RealMetadataFactory.createModel("pm4", true));
return vdb;
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class RealMetadataFactory method example1VDB.
public static VDBMetaData example1VDB() {
VDBMetaData vdb = new VDBMetaData();
vdb.setName("example1");
vdb.setVersion(1);
vdb.addModel(RealMetadataFactory.createModel("pm1", true));
vdb.addModel(RealMetadataFactory.createModel("pm2", true));
vdb.addModel(RealMetadataFactory.createModel("pm3", true));
vdb.addModel(RealMetadataFactory.createModel("pm4", true));
vdb.addModel(RealMetadataFactory.createModel("pm5", true));
vdb.addModel(RealMetadataFactory.createModel("pm6", true));
vdb.addModel(RealMetadataFactory.createModel("vm1", false));
vdb.addModel(RealMetadataFactory.createModel("vm2", false));
vdb.addModel(RealMetadataFactory.createModel("tm1", false));
return vdb;
}
Aggregations