Author: shawkins
Date: 2010-09-14 17:21:26 -0400 (Tue, 14 Sep 2010)
New Revision: 2575
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
Log:
TEIID-1246 simplifying usage of model metadata
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
---
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-09-14
20:35:42 UTC (rev 2574)
+++
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -287,6 +287,11 @@
public String toString() {
return getName()+VERSION_DELIM+getVersion()+ models.getMap().values();
}
+
+ public boolean isVisible(String modelName) {
+ ModelMetaData model = getModel(modelName);
+ return model == null || model.isVisible();
+ }
public ModelMetaData getModel(String modelName) {
return this.models.getMap().get(modelName);
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java 2010-09-14
20:35:42 UTC (rev 2574)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedFinder.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -59,6 +59,7 @@
this.vdb = vdb;
userCache.put(CoreConstants.SYSTEM_MODEL, SYSTEM_CAPS);
userCache.put(CoreConstants.ODBC_MODEL, SYSTEM_CAPS);
+ userCache.put(CoreConstants.SYSTEM_ADMIN_MODEL, SYSTEM_CAPS);
}
/**
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2010-09-14
20:35:42 UTC (rev 2574)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -336,8 +336,7 @@
private List<Schema> getVisibleSchemas(VDBMetaData vdb, CompositeMetadataStore
metadata) {
ArrayList<Schema> result = new ArrayList<Schema>();
for (Schema schema : metadata.getSchemas().values()) {
- ModelMetaData model = vdb.getModel(schema.getName());
- if(model.isVisible()) {
+ if(vdb.isVisible(schema.getName())) {
result.add(schema);
}
}
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2010-09-14
20:35:42 UTC (rev 2574)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -203,7 +203,7 @@
Collection<String> filteredResult = new ArrayList<String>(matches.size());
for (Table table : matches) {
- if (vdbMetaData == null ||
vdbMetaData.getModel(table.getParent().getName()).isVisible()) {
+ if (vdbMetaData == null || vdbMetaData.isVisible(table.getParent().getName())) {
filteredResult.add(table.getFullName());
}
}
@@ -354,7 +354,7 @@
for (StoredProcedureInfo storedProcedureInfo : results) {
Schema schema = (Schema)storedProcedureInfo.getModelID();
- if(vdbMetaData == null || vdbMetaData.getModel(schema.getName()).isVisible()){
+ if(vdbMetaData == null || vdbMetaData.isVisible(schema.getName())){
if (result != null) {
throw new
QueryMetadataException(QueryPlugin.Util.getString("ambiguous_procedure",
fullyQualifiedProcedureName)); //$NON-NLS-1$
}
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-09-14
20:35:42 UTC (rev 2574)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -171,9 +171,6 @@
IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new
IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
for (Model model:deployment.getModels()) {
- if (model.getName().equals(CoreConstants.SYSTEM_MODEL) ||
model.getName().equals(CoreConstants.ODBC_MODEL)){
- continue;
- }
for (String source:model.getSourceNames()) {
if (cmr.getConnectorManager(source) != null) {
continue;
@@ -206,9 +203,6 @@
for(Model m:deployment.getModels()) {
ModelMetaData model = (ModelMetaData)m;
List<SourceMappingMetadata> mappings = model.getSourceMappings();
- if (model.getName().equals(CoreConstants.SYSTEM_MODEL) ||
model.getName().equals(CoreConstants.ODBC_MODEL)) {
- continue;
- }
for (SourceMappingMetadata mapping:mappings) {
ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
String msg = cm.getStausMessage();
@@ -274,10 +268,6 @@
// make sure we are configured correctly first
for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (model.getName().equals(CoreConstants.SYSTEM_MODEL) ||
model.getName().equals(CoreConstants.ODBC_MODEL)){
- continue;
- }
-
if (model.getSourceNames().isEmpty()) {
throw new
DeploymentException(RuntimePlugin.Util.getString("fail_to_deploy",
vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$
//$NON-NLS-2$
}
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
---
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-09-14
20:35:42 UTC (rev 2574)
+++
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -46,7 +46,6 @@
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.core.CoreConstants;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.VdbConstants;
@@ -190,9 +189,6 @@
if (vdbMO != null) {
VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
for (Model m : vdb.getModels()) {
- if (m.getName().equals(CoreConstants.SYSTEM_MODEL) ||
m.getName().equals(CoreConstants.ODBC_MODEL) ) {
- continue;
- }
ManagedObject mo = this.mof.initManagedObject(m, ModelMetaData.class,
m.getName(),m.getName());
if (mo == null) {
throw new DeploymentException("could not create managed object");
//$NON-NLS-1$
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-09-14
20:35:42 UTC (rev 2574)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-09-14
21:21:26 UTC (rev 2575)
@@ -35,8 +35,6 @@
import org.jboss.deployers.spi.DeploymentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.CoreConstants;
import org.teiid.core.types.DataTypeManager;
@@ -78,37 +76,14 @@
}
if (this.odbcStore == null) {
- addSystemModel(vdb);
this.vdbRepo.put(vdbId(vdb), new CompositeVDB(vdb, stores, visibilityMap, udf, cmr,
this.systemStore));
}
else {
- addSystemModel(vdb);
- addODBCModel(vdb);
this.vdbRepo.put(vdbId(vdb), new CompositeVDB(vdb, stores, visibilityMap, udf, cmr,
this.systemStore, odbcStore));
}
notifyAdd(vdb.getName(), vdb.getVersion());
}
- private void addODBCModel(VDBMetaData vdb) {
- // add the ODBC model
- ModelMetaData odbcSystem = new ModelMetaData();
- odbcSystem.setName(CoreConstants.ODBC_MODEL);
- odbcSystem.setVisible(true);
- odbcSystem.setModelType(Model.Type.VIRTUAL);
- vdb.addModel(odbcSystem);
- }
-
- private void addSystemModel(VDBMetaData vdb) {
- // Add system model to the deployed VDB
- ModelMetaData system = new ModelMetaData();
- system.setName(CoreConstants.SYSTEM_MODEL);
- system.setVisible(true);
- system.setModelType(Model.Type.PHYSICAL);
- system.addSourceMapping(CoreConstants.SYSTEM_MODEL, CoreConstants.SYSTEM_MODEL,
CoreConstants.SYSTEM_MODEL);
- system.setSupportsMultiSourceBindings(false);
- vdb.addModel(system);
- }
-
public VDBMetaData getVDB(String name, int version) {
CompositeVDB v = this.vdbRepo.get(new VDBKey(name, version));
if (v != null) {