Skip to content

Commit

Permalink
allowing test metadata to read the vdb.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Oct 7, 2013
1 parent a782206 commit 1321cc4
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -33,6 +33,8 @@
import javax.xml.stream.XMLStreamException;

import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBMetadataParser;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.FileUtils;
import org.teiid.core.util.LRUCache;
Expand All @@ -47,6 +49,7 @@
import org.teiid.query.metadata.SystemMetadata;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.metadata.VDBResources;
import org.teiid.query.metadata.VDBResources.Resource;


public class VDBMetadataFactory {
Expand Down Expand Up @@ -75,7 +78,11 @@ public static TransformationMetadata getVDBMetadata(String vdbName, URL vdbURL,

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) {
Expand All @@ -84,7 +91,7 @@ public static TransformationMetadata getVDBMetadata(String vdbName, URL vdbURL,
trees = Arrays.asList(new FunctionTree(schema, new UDFSource(methods), true));
}
SystemFunctionManager sfm = new SystemFunctionManager();
vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(SystemMetadata.getInstance().getSystemStore(), imf.store)), imf.resources.getEntriesPlusVisibilities(), sfm.getSystemFunctions(), trees);
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) {
Expand Down

0 comments on commit 1321cc4

Please sign in to comment.