Author: rareddy
Date: 2012-04-11 13:45:00 -0400 (Wed, 11 Apr 2012)
New Revision: 3993
Modified:
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
Log:
TEIID-1998: When the translator is deployed as JAR (instead of JAR), there is implicit
module, however it can not be accessed by the named module, thus it was an issue. Captured
the class loader of the deployment, and also when defined with module such that the
loading of the translator only refers to class loader not a module.
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-04-11 15:38:10 UTC
(rev 3992)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-04-11 17:45:00 UTC
(rev 3993)
@@ -641,6 +641,7 @@
TEIID31093,
TEIID31094,
TEIID31095,
- TEIID31096
+ TEIID31096,
+ TEIID31097
}
}
Modified:
trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java 2012-04-11
15:38:10 UTC (rev 3992)
+++
trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java 2012-04-11
17:45:00 UTC (rev 3993)
@@ -42,6 +42,10 @@
throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30591,
factory.getName()));
}
+ if (connectionFactory == null) {
+ throw new TranslatorException(QueryPlugin.Event.TEIID31097,
QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31097));
+ }
+
Object connection = executionFactory.getConnection(connectionFactory, null);
Object unwrapped = null;
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-04-11 15:38:10
UTC (rev 3992)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-04-11 17:45:00
UTC (rev 3993)
@@ -921,6 +921,7 @@
failed_to_cache=Failed to store the result set contents to disk.
TEIID30480=Failed to unwrap the source connection.
TEIID30481=Failed to find the Connection Factory with JNDI name {0}. Please check the
name or deploy the Connection Factory with specified name.
+TEIID31097=Connection Factory (no data source found) provided is null; Can not proceed
with metadata load.
TEIID30256=Source UPDATE or DELETE command "{0}" contains non-pushdown
constructs and no compensating action can be taken as the table lacks a unique key or the
source does not support equality predicates.
TEIID30254=Source UPDATE or DELETE command "{0}" contains non-pushdown
constructs that cannot be simplified into a compensating action.
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java 2012-04-11
15:38:10 UTC (rev 3992)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java 2012-04-11
17:45:00 UTC (rev 3993)
@@ -220,7 +220,7 @@
newControllers.add(target.addService(TeiidServiceNames.VDB_REPO,
vdbRepositoryService).install());
// VDB Status manager
- final VDBStatusCheckerExecutorService statusChecker = new
VDBStatusCheckerExecutorService(vdbRepository);
+ final VDBStatusCheckerExecutorService statusChecker = new
VDBStatusCheckerExecutorService();
statusChecker.setTranslatorRepository(translatorRepo);
ValueService<VDBStatusChecker> statusService = new
ValueService<VDBStatusChecker>(new
org.jboss.msc.value.Value<VDBStatusChecker>() {
@Override
@@ -230,6 +230,7 @@
});
ServiceBuilder<VDBStatusChecker> statusBuilder =
target.addService(TeiidServiceNames.VDB_STATUS_CHECKER, statusService);
statusBuilder.addDependency(TeiidServiceNames.executorServiceName(asyncThreadPoolName),
Executor.class, statusChecker.executorInjector);
+ statusBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,
statusChecker.vdbRepoInjector);
newControllers.add(statusBuilder.install());
// System VDB Service
@@ -557,14 +558,16 @@
static class VDBStatusCheckerExecutorService extends VDBStatusChecker{
final InjectedValue<Executor> executorInjector = new
InjectedValue<Executor>();
+ final InjectedValue<VDBRepository> vdbRepoInjector = new
InjectedValue<VDBRepository>();
- public VDBStatusCheckerExecutorService(VDBRepository vdbRepository) {
- super(vdbRepository);
- }
-
@Override
public Executor getExecutor() {
return this.executorInjector.getValue();
- }
+ }
+
+ @Override
+ public VDBRepository getVDBRepository() {
+ return this.vdbRepoInjector.getValue();
+ }
}
}
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-04-11
15:38:10 UTC (rev 3992)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-04-11
17:45:00 UTC (rev 3993)
@@ -826,7 +826,7 @@
}
}
- private SessionMetadata createTemporarySession(final String vdbName, final int version,
final String userName) {
+ private SessionMetadata createTemporarySession(final String vdbName, final int version,
final String userName) throws OperationFailedException{
long creationTime = System.currentTimeMillis();
@@ -840,7 +840,11 @@
newSession.setVDBName(vdbName);
newSession.setVDBVersion(version);
- newSession.setVdb(this.vdbRepo.getVDB(vdbName, version));
+ VDBMetaData vdb = this.vdbRepo.getVDB(vdbName, version);
+ if (vdb == null) {
+ throw new OperationFailedException(new
ModelNode().set(IntegrationPlugin.Util.getString("wrong_vdb")));//$NON-NLS-1$
+ }
+ newSession.setVdb(vdb);
return newSession;
}
}
@@ -906,6 +910,9 @@
ModelNode result = context.getResult();
List<VDBMetaData> vdbs = repo.getVDBs();
for (VDBMetaData vdb:vdbs) {
+ if (vdb == null) {
+ continue; // when vdb deployed but metadata is still being loaded this reports as
null
+ }
VDBMetadataMapper.INSTANCE.wrap(vdb, result.add());
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-04-11
15:38:10 UTC (rev 3992)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-04-11
17:45:00 UTC (rev 3993)
@@ -171,12 +171,12 @@
vdbService.addDependency(TeiidServiceNames.translatorServiceName(type));
}
- vdbService.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,
vdb.getVDBRepositoryInjector());
- vdbService.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class,
vdb.getTranslatorRepositoryInjector());
- vdbService.addDependency(TeiidServiceNames.executorServiceName(this.asyncThreadPoolName),
Executor.class, vdb.getExecutorInjector());
- vdbService.addDependency(TeiidServiceNames.OBJECT_SERIALIZER, ObjectSerializer.class,
vdb.getSerializerInjector());
- vdbService.addDependency(TeiidServiceNames.BUFFER_MGR, BufferManager.class,
vdb.getBufferManagerInjector());
- vdbService.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR,
ObjectReplicator.class, vdb.getObjectReplicatorInjector());
+ vdbService.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,
vdb.vdbRepositoryInjector);
+ vdbService.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class,
vdb.translatorRepositoryInjector);
+ vdbService.addDependency(TeiidServiceNames.executorServiceName(this.asyncThreadPoolName),
Executor.class, vdb.executorInjector);
+ vdbService.addDependency(TeiidServiceNames.OBJECT_SERIALIZER, ObjectSerializer.class,
vdb.serializerInjector);
+ vdbService.addDependency(TeiidServiceNames.BUFFER_MGR, BufferManager.class,
vdb.bufferManagerInjector);
+ vdbService.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR,
ObjectReplicator.class, vdb.objectReplicatorInjector);
vdbService.setInitialMode(Mode.PASSIVE).install();
ServiceController<?> scMain =
deploymentUnit.getServiceRegistry().getService(deploymentUnit.getServiceName().append("contents"));
//$NON-NLS-1$
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-04-11
15:38:10 UTC (rev 3992)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-04-11
17:45:00 UTC (rev 3993)
@@ -35,9 +35,6 @@
import javax.xml.stream.XMLStreamException;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
@@ -82,12 +79,12 @@
class VDBService implements Service<VDBMetaData> {
private VDBMetaData vdb;
- private final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
- private final InjectedValue<TranslatorRepository> translatorRepositoryInjector =
new InjectedValue<TranslatorRepository>();
- private final InjectedValue<Executor> executorInjector = new
InjectedValue<Executor>();
- private final InjectedValue<ObjectSerializer> serializerInjector = new
InjectedValue<ObjectSerializer>();
- private final InjectedValue<BufferManager> bufferManagerInjector = new
InjectedValue<BufferManager>();
- private final InjectedValue<ObjectReplicator> objectReplicatorInjector = new
InjectedValue<ObjectReplicator>();
+ protected final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
+ protected final InjectedValue<TranslatorRepository> translatorRepositoryInjector =
new InjectedValue<TranslatorRepository>();
+ protected final InjectedValue<Executor> executorInjector = new
InjectedValue<Executor>();
+ protected final InjectedValue<ObjectSerializer> serializerInjector = new
InjectedValue<ObjectSerializer>();
+ protected final InjectedValue<BufferManager> bufferManagerInjector = new
InjectedValue<BufferManager>();
+ protected final InjectedValue<ObjectReplicator> objectReplicatorInjector = new
InjectedValue<ObjectReplicator>();
private VDBLifeCycleListener vdbListener;
public VDBService(VDBMetaData metadata) {
@@ -140,9 +137,9 @@
}
// add object replication to temp/matview tables
GlobalTableStore gts = new GlobalTableStoreImpl(getBuffermanager(),
vdb.getVDB().getAttachment(TransformationMetadata.class));
- if (getObjectReplicatorInjector().getValue() != null) {
+ if (objectReplicatorInjector.getValue() != null) {
try {
- gts = getObjectReplicatorInjector().getValue().replicate(name + version,
GlobalTableStore.class, gts, 300000);
+ gts = objectReplicatorInjector.getValue().replicate(name + version,
GlobalTableStore.class, gts, 300000);
vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
} catch (Exception e) {
LogManager.logError(LogConstants.CTX_RUNTIME, e,
IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50023, gts));
@@ -187,9 +184,9 @@
@Override
public void stop(StopContext context) {
// stop object replication
- if (getObjectReplicatorInjector().getValue() != null) {
+ if (this.objectReplicatorInjector.getValue() != null) {
GlobalTableStore gts = vdb.getAttachment(GlobalTableStore.class);
- getObjectReplicatorInjector().getValue().stop(gts);
+ this.objectReplicatorInjector.getValue().stop(gts);
}
getVDBRepository().removeListener(this.vdbListener);
getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
@@ -253,15 +250,9 @@
ExecutionFactory<Object, Object> ef = map.get(translator);
if ( ef == null) {
- ClassLoader classloader = Thread.currentThread().getContextClassLoader();
- if (translator.getModuleName() != null) {
- try {
- final ModuleIdentifier moduleId =
ModuleIdentifier.create(translator.getModuleName());
- final Module module = Module.getCallerModuleLoader().loadModule(moduleId);
- classloader = module.getClassLoader();
- } catch (ModuleLoadException e) {
- throw new TeiidException(IntegrationPlugin.Event.TEIID50057, e,
IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50057, translator.getModuleName(),
translator.getName()));
- }
+ ClassLoader classloader = translator.getAttachment(ClassLoader.class);
+ if (classloader == null) {
+ classloader = Thread.currentThread().getContextClassLoader();
}
ef = TranslatorUtil.buildExecutionFactory(translator, classloader);
@@ -406,50 +397,26 @@
}
}
- public InjectedValue<VDBRepository> getVDBRepositoryInjector(){
- return this.vdbRepositoryInjector;
- }
-
private VDBRepository getVDBRepository() {
return vdbRepositoryInjector.getValue();
}
- public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector(){
- return this.translatorRepositoryInjector;
- }
-
private TranslatorRepository getTranslatorRepository() {
return this.translatorRepositoryInjector.getValue();
}
- public InjectedValue<Executor> getExecutorInjector(){
- return this.executorInjector;
- }
-
private Executor getExecutor() {
return this.executorInjector.getValue();
}
- public InjectedValue<ObjectSerializer> getSerializerInjector() {
- return serializerInjector;
- }
-
private ObjectSerializer getSerializer() {
return serializerInjector.getValue();
}
- public InjectedValue<BufferManager> getBufferManagerInjector() {
- return bufferManagerInjector;
- }
-
private BufferManager getBuffermanager() {
- return getBufferManagerInjector().getValue();
+ return bufferManagerInjector.getValue();
}
- public InjectedValue<ObjectReplicator> getObjectReplicatorInjector() {
- return objectReplicatorInjector;
- }
-
public void addDataRole(String policyName, String mappedRole) throws
AdminProcessingException{
DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-04-11
15:38:10 UTC (rev 3992)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-04-11
17:45:00 UTC (rev 3993)
@@ -80,6 +80,7 @@
TEIID50075=No "path" information found to load the FUNCTION model {0}; FUNCTION
model must have path information.
TEIID50076=For {0}.{1} VDB, recursive delegation {2} found.
TEIID50077=The parent translator type "{0}" was not found in configuration
"{1}"
+wrong_vdb= Wrong VDB name and/or version supplied, or VDB is not active, or not
available.
# subsystem description
teiid.add = Add the Teiid Subsystem
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-04-11 15:38:10
UTC (rev 3992)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-04-11 17:45:00
UTC (rev 3993)
@@ -158,7 +158,7 @@
return false;
}
- private VDBMetaData buildVDB() {
+ VDBMetaData buildVDB() {
if (this.children == null || this.children.isEmpty()) {
this.vdb.addAttchment(ConnectorManagerRepository.class, this.cmr);
@@ -343,4 +343,8 @@
public void setMetaloadFinished(boolean flag) {
this.metadataloadFinished = flag;
}
+
+ public boolean isMetadataloadFinished() {
+ return this.metadataloadFinished;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-04-11 15:38:10
UTC (rev 3992)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-04-11 17:45:00
UTC (rev 3993)
@@ -108,6 +108,23 @@
}
return vdbs;
}
+
+ /**
+ * This returns the all the VDBS that loaded and still loading or stalled due to data
source unavailability.
+ * @return
+ */
+ public List<VDBMetaData> getAllDeployedVDBs(){
+ ArrayList<VDBMetaData> vdbs = new ArrayList<VDBMetaData>();
+ for(CompositeVDB cVDB:this.vdbRepo.values()) {
+ if (!cVDB.isMetadataloadFinished()) {
+ vdbs.add(cVDB.buildVDB());
+ }
+ else {
+ vdbs.add(cVDB.getVDB());
+ }
+ }
+ return vdbs;
+ }
protected VDBKey vdbId(VDBMetaData vdb) {
return new VDBKey(vdb.getName(), vdb.getVersion());
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-04-11
15:38:10 UTC (rev 3992)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-04-11
17:45:00 UTC (rev 3993)
@@ -42,13 +42,8 @@
public abstract class VDBStatusChecker {
private static final String JAVA_CONTEXT = "java:/"; //$NON-NLS-1$
- private VDBRepository vdbRepository;
private TranslatorRepository translatorRepository;
- public VDBStatusChecker(VDBRepository vdbRepository) {
- this.vdbRepository = vdbRepository;
- }
-
public void translatorAdded(String translatorName) {
resourceAdded(translatorName, true);
}
@@ -78,7 +73,7 @@
dsName = dsName.substring(5);
}
- VDBMetaData vdb = this.vdbRepository.getVDB(vdbName, vdbVersion);
+ VDBMetaData vdb = getVDBRepository().getVDB(vdbName, vdbVersion);
ModelMetaData model = vdb.getModel(modelName);
synchronized (vdb) {
@@ -123,12 +118,11 @@
}
}
- public void setVDBRepository(VDBRepository repo) {
- this.vdbRepository = repo;
- }
-
public void resourceAdded(String resourceName, boolean translator) {
- for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+ for (VDBMetaData vdb:getVDBRepository().getAllDeployedVDBs()) {
+ if (vdb == null) {
+ continue;
+ }
if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
continue;
}
@@ -184,7 +178,10 @@
}
public void resourceRemoved(String resourceName, boolean translator) {
- for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+ for (VDBMetaData vdb:getVDBRepository().getAllDeployedVDBs()) {
+ if (vdb == null) {
+ continue;
+ }
if (vdb.isPreview()) {
continue;
}
@@ -232,6 +229,8 @@
public abstract Executor getExecutor();
+ public abstract VDBRepository getVDBRepository();
+
public void setTranslatorRepository(TranslatorRepository repo) {
this.translatorRepository = repo;
}