Author: shawkins
Date: 2012-04-27 11:38:44 -0400 (Fri, 27 Apr 2012)
New Revision: 4041
Modified:
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
branches/8.0.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/8.0.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
branches/8.0.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-2018 ensuring that the resource map is passed to the metadata
Modified: branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
---
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-04-27
12:02:10 UTC (rev 4040)
+++
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -21,6 +21,7 @@
*/
package org.teiid.jboss;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.ServiceLoader;
import java.util.StringTokenizer;
@@ -39,14 +40,14 @@
import org.jboss.msc.service.AbstractServiceListener;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceBuilder.DependencyType;
import org.jboss.msc.service.ServiceController;
-import org.jboss.msc.service.ServiceController.Mode;
-import org.jboss.msc.service.ServiceController.State;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.service.ServiceController.State;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -65,6 +66,7 @@
import org.teiid.query.ObjectReplicator;
import org.teiid.query.metadata.DDLMetadataRepository;
import org.teiid.query.metadata.NativeMetadataRepository;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
class VDBDeployer implements DeploymentUnitProcessor {
@@ -126,8 +128,10 @@
// set up the metadata repositories for each models
IndexMetadataRepository indexRepo = null;
IndexMetadataStore indexFactory =
deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
+ LinkedHashMap<String, Resource> visibilityMap = null;
if (indexFactory != null) {
indexRepo = new IndexMetadataRepository(indexFactory);
+ visibilityMap = indexFactory.getEntriesPlusVisibilities();
}
for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
@@ -139,7 +143,7 @@
}
// build a VDB service
- VDBService vdb = new VDBService(deployment);
+ VDBService vdb = new VDBService(deployment, visibilityMap);
final ServiceBuilder<VDBMetaData> vdbService =
context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(),
deployment.getVersion()), vdb);
// add dependencies to data-sources
Modified:
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
---
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-04-27
12:02:10 UTC (rev 4040)
+++
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -27,7 +27,11 @@
import javax.xml.stream.XMLStreamException;
-import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.msc.service.ServiceController;
import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Model;
@@ -39,7 +43,6 @@
import org.teiid.logging.LogManager;
import org.teiid.metadata.VdbConstants;
import org.teiid.metadata.index.IndexMetadataStore;
-import org.teiid.runtime.RuntimePlugin;
/**
Modified: branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
---
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-04-27
12:02:10 UTC (rev 4040)
+++
branches/8.0.x/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -28,6 +28,7 @@
import java.util.Date;
import java.util.HashSet;
import java.util.IdentityHashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -71,6 +72,7 @@
import org.teiid.metadata.index.IndexMetadataRepository;
import org.teiid.query.ObjectReplicator;
import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.tempdata.GlobalTableStore;
import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.translator.DelegatingExecutionFactory;
@@ -86,9 +88,11 @@
protected final InjectedValue<BufferManager> bufferManagerInjector = new
InjectedValue<BufferManager>();
protected final InjectedValue<ObjectReplicator> objectReplicatorInjector = new
InjectedValue<ObjectReplicator>();
private VDBLifeCycleListener vdbListener;
+ private LinkedHashMap<String, Resource> visibilityMap;
- public VDBService(VDBMetaData metadata) {
+ public VDBService(VDBMetaData metadata, LinkedHashMap<String, Resource>
visibilityMap) {
this.vdb = metadata;
+ this.visibilityMap = visibilityMap;
}
@Override
@@ -158,7 +162,7 @@
try {
// add transformation metadata to the repository.
- getVDBRepository().addVDB(this.vdb, store, udf, cmr);
+ getVDBRepository().addVDB(this.vdb, store, visibilityMap, udf, cmr);
} catch (VirtualDatabaseException e) {
throw new StartException(IntegrationPlugin.Event.TEIID50032.name(), e);
}
Modified: branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-04-27
12:02:10 UTC (rev 4040)
+++ branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -37,7 +37,6 @@
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.metadata.*;
-import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.query.function.FunctionTree;
import org.teiid.query.function.UDFSource;
import org.teiid.query.metadata.CompositeMetadataStore;
@@ -63,12 +62,10 @@
// used as cached item to avoid rebuilding
private volatile VDBMetaData mergedVDB;
- public CompositeVDB(VDBMetaData vdb, MetadataStore metadataStore, UDFMetaData udf,
FunctionTree systemFunctions, ConnectorManagerRepository cmr, MetadataStore...
additionalStores) {
+ public CompositeVDB(VDBMetaData vdb, MetadataStore metadataStore,
LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, FunctionTree
systemFunctions, ConnectorManagerRepository cmr, MetadataStore... additionalStores) {
this.vdb = vdb;
this.store = metadataStore;
- if (metadataStore instanceof IndexMetadataStore) {
- this.visibilityMap =
((IndexMetadataStore)metadataStore).getEntriesPlusVisibilities();
- }
+ this.visibilityMap = visibilityMap;
this.udf = udf;
this.systemFunctions = systemFunctions;
this.cmr = cmr;
Modified: branches/8.0.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/8.0.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-04-27
12:02:10 UTC (rev 4040)
+++ branches/8.0.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
@@ -47,6 +48,7 @@
import org.teiid.metadata.MetadataStore;
import org.teiid.query.function.SystemFunctionManager;
import org.teiid.query.metadata.MetadataValidator;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.validator.ValidatorReport;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.translator.TranslatorException;
@@ -68,7 +70,7 @@
private Map<String, Datatype> datatypeMap = new HashMap<String,
Datatype>();
- public void addVDB(VDBMetaData vdb, MetadataStore metadataStore, UDFMetaData udf,
ConnectorManagerRepository cmr) throws VirtualDatabaseException {
+ public void addVDB(VDBMetaData vdb, MetadataStore metadataStore,
LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf,
ConnectorManagerRepository cmr) throws VirtualDatabaseException {
if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40035,
RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40035, vdb.getName(), vdb.getVersion()));
}
@@ -81,14 +83,14 @@
if (this.odbcEnabled && odbcStore == null) {
this.odbcStore = getODBCMetadataStore();
}
-
- CompositeVDB cvdb = null;
+
+ MetadataStore[] stores = null;
if (this.odbcStore == null) {
- cvdb = new CompositeVDB(vdb, metadataStore, udf,
this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore);
+ stores = new MetadataStore[] {this.systemStore};
+ } else {
+ stores = new MetadataStore[] {this.systemStore, odbcStore};
}
- else {
- cvdb = new CompositeVDB(vdb, metadataStore, udf,
this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore, odbcStore);
- }
+ CompositeVDB cvdb = new CompositeVDB(vdb, metadataStore, visibilityMap, udf,
this.systemFunctionManager.getSystemFunctions(), cmr, stores);
this.vdbRepo.put(vdbId(vdb), cvdb);
notifyAdd(vdb.getName(), vdb.getVersion(), cvdb);
}
Modified: branches/8.0.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
---
branches/8.0.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2012-04-27
12:02:10 UTC (rev 4040)
+++
branches/8.0.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -65,7 +65,7 @@
cmr.addConnectorManager("source",
getConnectorManager("FakeTranslator", "FakeConnection",
getFuncsOne()));
cmr.addConnectorManager("source2",
getConnectorManager("FakeTranslator2", "FakeConnection2",
getFuncsTwo()));
- CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metadataStore, null,
RealMetadataFactory.SFM.getSystemFunctions(),cmr);
+ CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metadataStore, null, null,
RealMetadataFactory.SFM.getSystemFunctions(),cmr);
cvdb.metadataLoadFinished();
return cvdb;
}
Modified:
branches/8.0.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
---
branches/8.0.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-04-27
12:02:10 UTC (rev 4040)
+++
branches/8.0.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-04-27
15:38:44 UTC (rev 4041)
@@ -47,8 +47,8 @@
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.DefaultCacheFactory;
import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.DQP;
import org.teiid.client.security.ILogon;
import org.teiid.common.buffer.TupleBufferCache;
@@ -412,7 +412,7 @@
udfMetaData.addFunctions(entry.getKey(), entry.getValue());
}
}
- this.repo.addVDB(vdbMetaData, metadata, udfMetaData, cmr);
+ this.repo.addVDB(vdbMetaData, metadata, (metadata instanceof
IndexMetadataStore)?((IndexMetadataStore)metadata).getEntriesPlusVisibilities():null,
udfMetaData, cmr);
this.repo.finishDeployment(vdbMetaData.getName(), vdbMetaData.getVersion());
this.repo.getVDB(vdbMetaData.getName(),
vdbMetaData.getVersion()).setStatus(VDB.Status.ACTIVE);
} catch (VirtualDatabaseException e) {