本文整理汇总了Java中org.teiid.adminapi.impl.VDBMetadataParser类的典型用法代码示例。如果您正苦于以下问题:Java VDBMetadataParser类的具体用法?Java VDBMetadataParser怎么用?Java VDBMetadataParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VDBMetadataParser类属于org.teiid.adminapi.impl包,在下文中一共展示了VDBMetadataParser类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVdbByteArray
import org.teiid.adminapi.impl.VDBMetadataParser; //导入依赖的package包/类
/**
* Get the bytearray version of the VDBMetaData object
* @param vdb the VDB
* @return the vdb in bytearray form
*/
public byte[] getVdbByteArray(VDBMetaData vdb) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
VDBMetadataParser.marshell(vdb, out);
return out.toByteArray();
}
示例2: getVDBMetadata
import org.teiid.adminapi.impl.VDBMetadataParser; //导入依赖的package包/类
public static TransformationMetadata getVDBMetadata(String vdbName, URL vdbURL, URL udfFile) throws IOException {
TransformationMetadata vdbmetadata = VDB_CACHE.get(vdbURL);
if (vdbmetadata != null) {
return vdbmetadata;
}
try {
IndexVDB imf = loadMetadata(vdbName, vdbURL);
Resource r = imf.resources.getEntriesPlusVisibilities().get("/META-INF/vdb.xml");
VDBMetaData vdb = null;
if (r != null) {
vdb = VDBMetadataParser.unmarshell(r.openStream());
}
Collection <FunctionMethod> methods = null;
Collection<FunctionTree> trees = null;
if (udfFile != null) {
String schema = FileUtils.getFilenameWithoutExtension(udfFile.getPath());
methods = FunctionMetadataReader.loadFunctionMethods(udfFile.openStream());
trees = Arrays.asList(new FunctionTree(schema, new UDFSource(methods), true));
}
SystemFunctionManager sfm = new SystemFunctionManager();
vdbmetadata = new TransformationMetadata(vdb, new CompositeMetadataStore(Arrays.asList(SystemMetadata.getInstance().getSystemStore(), imf.store)), imf.resources.getEntriesPlusVisibilities(), sfm.getSystemFunctions(), trees);
VDB_CACHE.put(vdbURL, vdbmetadata);
return vdbmetadata;
} catch (XMLStreamException e) {
throw new IOException(e);
}
}
示例3: testBuildArchive
import org.teiid.adminapi.impl.VDBMetadataParser; //导入依赖的package包/类
@Test
public void testBuildArchive() throws Exception {
VDBMetaData vdb = VDBMetadataParser.unmarshell(new FileInputStream(UnitTestUtil.getTestDataFile("sample-vdb.xml")));
MetadataStore ms = new MetadataStore();
for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
MetadataFactory mf = TestDDLParser.helpParse(model.getSchemaText(), model.getName());
ms.addSchema(mf.getSchema());
}
TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(ms, "Rest");
vdb.addAttchment(QueryMetadataInterface.class, metadata);
vdb.addAttchment(TransformationMetadata.class, metadata);
vdb.addAttchment(MetadataStore.class, ms);
RestASMBasedWebArchiveBuilder builder = new RestASMBasedWebArchiveBuilder();
byte[] contents = builder.createRestArchive(vdb);
ArrayList<String> files = new ArrayList<String>();
files.add("WEB-INF/web.xml");
files.add("WEB-INF/jboss-web.xml");
files.add("WEB-INF/classes/org/teiid/jboss/rest/View.class");
files.add("WEB-INF/classes/org/teiid/jboss/rest/TeiidRestApplication.class");
files.add("META-INF/MANIFEST.MF");
ZipInputStream zipIn = new ZipInputStream(new ByteArrayInputStream(contents));
ZipEntry ze;
while ((ze = zipIn.getNextEntry()) != null) {
assertTrue(files.contains(ze.getName()));
zipIn.closeEntry();
}
}