teiid SVN: r4185 - in trunk: runtime/src/test/java/org/teiid/runtime and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-06-18 20:14:18 -0400 (Mon, 18 Jun 2012)
New Revision: 4185
Modified:
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java
Log:
TEIID-2076 fix for not performing implicit update
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-06-18 16:09:18 UTC (rev 4184)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-06-19 00:14:18 UTC (rev 4185)
@@ -211,7 +211,7 @@
}
}
- GroupSymbol symbol = new GroupSymbol(t.getName(), t.getFullName());
+ GroupSymbol symbol = new GroupSymbol(t.getName());
ResolverUtil.resolveGroup(symbol, metadata);
// this seems to parse, resolve and validate.
Modified: trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java 2012-06-18 16:09:18 UTC (rev 4184)
+++ trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java 2012-06-19 00:14:18 UTC (rev 4185)
@@ -34,9 +34,12 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.teiid.adminapi.Model.Type;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.jdbc.TeiidDriver;
+import org.teiid.language.Command;
import org.teiid.language.QueryExpression;
+import org.teiid.metadata.Column;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.RuntimeMetadata;
import org.teiid.metadata.Table;
@@ -47,6 +50,7 @@
import org.teiid.translator.ResultSetExecution;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.TypeFacility;
+import org.teiid.translator.UpdateExecution;
@SuppressWarnings("nls")
public class TestEmbeddedServer {
@@ -82,7 +86,9 @@
throws TranslatorException {
assertEquals(conn, Integer.valueOf(1));
Table t = metadataFactory.addTable("my-table");
- metadataFactory.addColumn("my-column", TypeFacility.RUNTIME_NAMES.STRING, t);
+ t.setSupportsUpdate(true);
+ Column c = metadataFactory.addColumn("my-column", TypeFacility.RUNTIME_NAMES.STRING, t);
+ c.setUpdatable(true);
}
@Override
@@ -114,6 +120,37 @@
};
return rse;
}
+
+ @Override
+ public UpdateExecution createUpdateExecution(Command command,
+ ExecutionContext executionContext,
+ RuntimeMetadata metadata, Object connection)
+ throws TranslatorException {
+ UpdateExecution ue = new UpdateExecution() {
+
+ @Override
+ public void execute() throws TranslatorException {
+
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ @Override
+ public void cancel() throws TranslatorException {
+
+ }
+
+ @Override
+ public int[] getUpdateCounts() throws DataNotAvailableException,
+ TranslatorException {
+ return new int[] {2};
+ }
+ };
+ return ue;
+ }
});
final AtomicInteger counter = new AtomicInteger();
ConnectionFactoryProvider<AtomicInteger> cfp = new ConnectionFactoryProvider<AtomicInteger>() {
@@ -130,14 +167,23 @@
mmd.setName("my-schema");
mmd.addSourceMapping("x", "y", "z");
- es.deployVDB("test", Arrays.asList(mmd));
+ ModelMetaData mmd1 = new ModelMetaData();
+ mmd1.setName("virt");
+ mmd1.setModelType(Type.VIRTUAL);
+ mmd1.setSchemaSourceType("ddl");
+ mmd1.setSchemaText("create view \"my-view\" (\"my-column\" string OPTIONS (UPDATABLE 'true')) OPTIONS (UPDATABLE 'true') as select * from \"my-table\"");
+
+ es.deployVDB("test", Arrays.asList(mmd, mmd1));
TeiidDriver td = es.getDriver();
Connection c = td.connect("jdbc:teiid:test", null);
Statement s = c.createStatement();
- ResultSet rs = s.executeQuery("select * from \"my-table\"");
+ ResultSet rs = s.executeQuery("select * from \"my-view\"");
assertFalse(rs.next());
assertEquals("my-column", rs.getMetaData().getColumnLabel(1));
+
+ s.execute("update \"my-view\" set \"my-column\" = 'a'");
+ assertEquals(2, s.getUpdateCount());
}
}
12 years, 6 months
teiid SVN: r4184 - in trunk: admin/src/main/java/org/teiid/adminapi/impl and 14 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-06-18 12:09:18 -0400 (Mon, 18 Jun 2012)
New Revision: 4184
Added:
trunk/runtime/src/main/java/org/teiid/runtime/AbstractVDBDeployer.java
trunk/runtime/src/test/java/org/teiid/runtime/
trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java
trunk/test-integration/common/src/test/resources/reuse-vdb.xml
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.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/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java
trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java
trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-2062 adding metadata load to the embedded logic
Modified: trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -92,12 +92,6 @@
public List<String> getValidityErrors();
/**
- * Shows any validity errors present in the VDB
- * @return
- */
- public List<String> getRuntimeErrors();
-
- /**
* Shows if VDB is a valid entity
* @return
*/
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -24,8 +24,8 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
-
import org.teiid.adminapi.DataPolicy;
@@ -39,7 +39,7 @@
protected PermissionMap permissions = new PermissionMap();
- protected List<String> mappedRoleNames = new ArrayList<String>();
+ protected List<String> mappedRoleNames = new CopyOnWriteArrayList<String>();
@Override
public String getName() {
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -49,15 +49,6 @@
protected String schemaSourceType;
protected String schemaText;
- public String getName() {
- return super.getName();
- }
-
- // This is needed by JAXB
- public void setName(String name) {
- super.setName(name);
- }
-
@Override
public String getDescription() {
return description;
@@ -170,53 +161,39 @@
this.addSourceMapping(source.getName(), source.getTranslatorName(), source.getConnectionJndiName());
}
- public List<ValidationError> getErrors(){
- return getValidationErrors(Severity.ERROR);
- }
+ public synchronized List<ValidationError> getErrors(){
+ return getErrors(true);
+ }
- public synchronized List<ValidationError> getValidationErrors(ValidationError.Severity severity){
- if (this.validationErrors == null) {
+ public synchronized List<ValidationError> getErrors(boolean includeRuntime){
+ if (this.validationErrors == null && this.runtimeErrors == null) {
return Collections.emptyList();
}
List<ValidationError> list = new ArrayList<ValidationError>();
- for (ValidationError ve: this.validationErrors) {
- if (Severity.valueOf(ve.severity) == severity) {
- list.add(ve);
- }
+ if (this.validationErrors != null) {
+ list.addAll(validationErrors);
}
+ if (includeRuntime && this.runtimeErrors != null) {
+ list.addAll(runtimeErrors);
+ }
return list;
- }
+ }
- public synchronized ValidationError addError(String severity, String message) {
- if (this.validationErrors == null) {
- this.validationErrors = new LinkedList<ValidationError>();
- }
+ public ValidationError addError(String severity, String message) {
ValidationError ve = new ValidationError(severity, message);
- this.validationErrors.add(ve);
- if (this.validationErrors.size() > DEFAULT_ERROR_HISTORY) {
- this.validationErrors.remove(0);
- }
+ addError(ve);
return ve;
}
- public List<ValidationError> getRuntimeErrors(){
- if (this.runtimeErrors == null) {
- return Collections.emptyList();
- }
- List<ValidationError> list = new ArrayList<ValidationError>();
- for (ValidationError ve: this.runtimeErrors) {
- if (Severity.valueOf(ve.severity) == Severity.ERROR) {
- list.add(ve);
- }
- }
- return list;
+ public synchronized boolean hasRuntimeErrors(){
+ return this.runtimeErrors != null && !this.runtimeErrors.isEmpty();
}
- public synchronized ValidationError addRuntimeError(String severity, String message) {
+ public synchronized ValidationError addRuntimeError(String message) {
+ ValidationError ve = new ValidationError(Severity.ERROR.name(), message);
if (this.runtimeErrors == null) {
this.runtimeErrors = new LinkedList<ValidationError>();
}
- ValidationError ve = new ValidationError(severity, message);
this.runtimeErrors.add(ve);
if (this.runtimeErrors.size() > DEFAULT_ERROR_HISTORY) {
this.runtimeErrors.remove(0);
@@ -229,18 +206,13 @@
this.validationErrors = new LinkedList<ValidationError>();
}
this.validationErrors.add(ve);
- if (this.validationErrors.size() > DEFAULT_ERROR_HISTORY) {
- this.validationErrors.remove(0);
- }
return ve;
}
- public synchronized void clearErrors() {
- this.validationErrors.clear();
- }
-
public synchronized void clearRuntimeErrors() {
- this.runtimeErrors.clear();
+ if (runtimeErrors != null) {
+ runtimeErrors = null;
+ }
}
public static class ValidationError implements Serializable{
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -170,41 +170,8 @@
}
@Override
- public List<String> getRuntimeErrors(){
- List<String> allErrors = new ArrayList<String>();
- for (ModelMetaData model:this.models.values()) {
- List<ValidationError> errors = model.getRuntimeErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ValidationError m:errors) {
- if (ValidationError.Severity.valueOf(m.getSeverity()).equals(ValidationError.Severity.ERROR)) {
- allErrors.add(m.getValue());
- }
- }
- }
- }
- return allErrors;
- }
-
- @Override
public boolean isValid() {
- if (!getValidityErrors().isEmpty()) {
- return false;
- }
- if (!getRuntimeErrors().isEmpty()) {
- return false;
- }
- if (getModels().isEmpty()) {
- return false;
- }
- for(ModelMetaData m: this.models.values()) {
- if (m.isSource()) {
- List<String> resourceNames = m.getSourceNames();
- if (resourceNames.isEmpty()) {
- return false;
- }
- }
- }
- return true;
+ return Status.ACTIVE.equals(this.status);
}
public String toString() {
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -519,7 +519,7 @@
}
// model validation errors
- for (ValidationError ve:model.getErrors()) {
+ for (ValidationError ve:model.getErrors(false)) {
writer.writeStartElement(Element.VALIDATION_ERROR.getLocalName());
writer.writeAttribute(Element.VALIDATION_SEVERITY_ATTR.getLocalName(), ve.getSeverity());
if (ve.getPath() != null) {
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -47,6 +47,7 @@
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.RuntimeMetadata;
import org.teiid.translator.TypeFacility.RUNTIME_CODES;
+import org.teiid.translator.TypeFacility.RUNTIME_NAMES;
@@ -687,6 +688,14 @@
return pushdownFunctionMethods;
}
+ /**
+ * Adds a pushdown function.
+ * @param qualifier will be pre-pended to the name
+ * @param name
+ * @param returnType see {@link RUNTIME_NAMES} for type names
+ * @param paramTypes see {@link RUNTIME_NAMES} for type names
+ * @return the FunctionMethod created.
+ */
protected FunctionMethod addPushDownFunction(String qualifier, String name, String returnType, String...paramTypes) {
FunctionMethod method = FunctionMethod.createFunctionMethod(qualifier + '.' + name, name, qualifier,
returnType, paramTypes);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -62,7 +62,7 @@
public class TransactionServerImpl implements TransactionService {
- private static class TransactionMapping {
+ protected static class TransactionMapping {
// (connection -> transaction for global and local)
private Map<String, TransactionContext> threadToTransactionContext = new HashMap<String, TransactionContext>();
@@ -112,10 +112,10 @@
}
}
- private TransactionMapping transactions = new TransactionMapping();
+ protected TransactionMapping transactions = new TransactionMapping();
private XATerminator xaTerminator;
- private TransactionManager transactionManager;
+ protected TransactionManager transactionManager;
private WorkManager workManager;
public void setXaTerminator(XATerminator xaTerminator) {
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -177,8 +177,8 @@
}
private static void log(ValidatorReport report, ModelMetaData model, String msg) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
- LogManager.logInfo(LogConstants.CTX_QUERY_RESOLVER, msg);
+ model.addRuntimeError(msg);
+ LogManager.logWarning(LogConstants.CTX_QUERY_RESOLVER, msg);
report.handleValidationError(msg);
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -100,50 +100,51 @@
for (SetState setState : dependentSetStates) {
setState.valueIterator = dvs.getValueIterator(setState.valueExpression);
int distinctCount = dvs.getTupleBuffer().getRowCount();
- if (setState.maxNdv > 0 && setState.maxNdv < distinctCount) {
- if (dvs.getTupleBuffer().getSchema().size() > 1) {
- distinctCount = 0;
- ValueIterator vi = dvs.getValueIterator(setState.valueExpression);
- if (dvs.getTupleBuffer().getSchema().indexOf(setState.valueExpression) == 0) {
- Object last = null;
- while (vi.hasNext()) {
- Object next = vi.next();
- if (next != null && (last == null || Constant.COMPARATOR.compare(next, last) != 0)) {
- distinctCount++;
- }
- last = next;
- }
- } else {
- //secondary attributes are not in sorted order, so we use an approximate count
- Set<Object> set = null;
- int maxSize = Math.min(10000, dvs.getTupleBuffer().getRowCount());
- List<Object> buffer = Arrays.asList(new Object[maxSize]);
- if (!DataTypeManager.isHashable(setState.valueExpression.getType())) {
- set = new TreeSet<Object>(Constant.COMPARATOR);
- } else {
- set = new HashSet<Object>();
- }
- int i = 0;
- while (vi.hasNext()) {
- Object next = vi.next();
- if (next == null) {
- continue;
- }
- if (set.add(next)) {
- distinctCount++;
- }
- Object old = buffer.set(i++%maxSize, next);
- if (set.size() > maxSize) {
- set.remove(old);
- }
- }
- }
+ if (setState.maxNdv <= 0 || setState.maxNdv >= distinctCount) {
+ continue;
+ }
+ if (dvs.getTupleBuffer().getSchema().size() > 1) {
+ distinctCount = 0;
+ ValueIterator vi = dvs.getValueIterator(setState.valueExpression);
+ if (dvs.getTupleBuffer().getSchema().indexOf(setState.valueExpression) == 0) {
+ Object last = null;
+ while (vi.hasNext()) {
+ Object next = vi.next();
+ if (next != null && (last == null || Constant.COMPARATOR.compare(next, last) != 0)) {
+ distinctCount++;
+ }
+ last = next;
+ }
+ } else {
+ //secondary attributes are not in sorted order, so we use an approximate count
+ Set<Object> set = null;
+ int maxSize = Math.min(10000, dvs.getTupleBuffer().getRowCount());
+ List<Object> buffer = Arrays.asList(new Object[maxSize]);
+ if (!DataTypeManager.isHashable(setState.valueExpression.getType())) {
+ set = new TreeSet<Object>(Constant.COMPARATOR);
+ } else {
+ set = new HashSet<Object>();
+ }
+ int i = 0;
+ while (vi.hasNext()) {
+ Object next = vi.next();
+ if (next == null) {
+ continue;
+ }
+ if (set.add(next)) {
+ distinctCount++;
+ }
+ Object old = buffer.set(i++%maxSize, next);
+ if (set.size() > maxSize) {
+ set.remove(old);
+ }
+ }
}
- if (!setState.overMax && distinctCount > setState.maxNdv) {
- LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30011, valueSource, setState.valueExpression, setState.maxNdv));
- setState.overMax = true;
- }
- }
+ }
+ if (!setState.overMax && distinctCount > setState.maxNdv) {
+ LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30011, valueSource, setState.valueExpression, setState.maxNdv));
+ setState.overMax = true;
+ }
}
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -65,7 +65,6 @@
TEIID50026, // VDB undeployed
TEIID50029, // dynamic metadata loaded
TEIID50030,
- TEIID50032, // duplicate VDB
TEIID50035, // translator not found
TEIID50036,
TEIID50037, // odbc enabled
@@ -85,8 +84,6 @@
TEIID50055,
TEIID50056,
TEIID50057,
- TEIID50064,
- TEIID50065,
TEIID50066,
TEIID50067,
TEIID50069,
@@ -98,8 +95,6 @@
TEIID50076,
TEIID50077,
TEIID50078,
- TEIID50086,
- TEIID50087,
TEIID50088
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -23,8 +23,6 @@
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.ServiceLoader;
-import java.util.StringTokenizer;
import java.util.concurrent.Executor;
import org.jboss.as.naming.deployment.ContextNames;
@@ -34,24 +32,20 @@
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
-import org.jboss.modules.ModuleLoader;
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.VDBImport;
import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.common.buffer.BufferManager;
@@ -62,12 +56,9 @@
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.index.IndexMetadataRepository;
import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.query.ObjectReplicator;
-import org.teiid.query.metadata.DDLMetadataRepository;
-import org.teiid.query.metadata.NativeMetadataRepository;
import org.teiid.query.metadata.TransformationMetadata.Resource;
@@ -122,8 +113,8 @@
Translator translator = this.translatorRepository.getTranslatorMetaData(translatorName);
if ( translator == null) {
String msg = IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50077, translatorName, deployment.getName(), deployment.getVersion());
- model.addError(ValidationError.Severity.ERROR.name(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+ model.addRuntimeError(msg);
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, msg);
}
}
}
@@ -150,17 +141,11 @@
indexRepo = new IndexMetadataRepository(indexFactory);
visibilityMap = indexFactory.getEntriesPlusVisibilities();
}
-
- for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
- if (model.isSource() && model.getSourceNames().isEmpty()) {
- throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50087, model.getName(), deployment.getName(), deployment.getVersion()));
- }
- MetadataRepository repo = getMetadataRepository(deployment, model.getName(), indexRepo);
- model.addAttchment(MetadataRepository.class, repo);
- }
-
// build a VDB service
VDBService vdb = new VDBService(deployment, visibilityMap);
+ if (indexRepo != null) {
+ vdb.addMetadataRepository("index", indexRepo); //$NON-NLS-1$
+ }
final ServiceBuilder<RuntimeVDB> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
// add dependencies to data-sources
@@ -241,7 +226,7 @@
@Override
public void start(StartContext context) throws StartException {
- ServiceController s = context.getController().getServiceContainer().getService(this.svcName);
+ ServiceController<?> s = context.getController().getServiceContainer().getService(this.svcName);
if (s != null) {
this.vdbStatusChecker.dataSourceAdded(this.dsName);
}
@@ -249,7 +234,7 @@
@Override
public void stop(StopContext context) {
- ServiceController s = context.getController().getServiceContainer().getService(this.svcName);
+ ServiceController<?> s = context.getController().getServiceContainer().getService(this.svcName);
if (s.getMode().equals(Mode.REMOVE) || s.getState().equals(State.STOPPING)) {
this.vdbStatusChecker.dataSourceRemoved(this.dsName);
}
@@ -282,74 +267,4 @@
}
}
- private MetadataRepository getMetadataRepository(VDBMetaData vdb, String modelName, IndexMetadataRepository indexRepo) throws DeploymentUnitProcessingException {
- final ModelMetaData model = vdb.getModel(modelName);
-
- if (model.getSchemaSourceType() == null) {
- if (!vdb.isDynamic()) {
- return indexRepo;
- }
-
- if (vdb.isDynamic() && model.isSource()) {
- return new NativeMetadataRepository();
- }
- return null;
- }
-
- MetadataRepository first = null;
- MetadataRepository current = null;
- MetadataRepository previous = null;
- StringTokenizer st = new StringTokenizer(model.getSchemaSourceType(), ","); //$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String repoType = st.nextToken().trim();
- if (repoType.equalsIgnoreCase("DDL")) { //$NON-NLS-1$
- current = new DDLMetadataRepository();
- }
- else if (repoType.equalsIgnoreCase("INDEX")) { //$NON-NLS-1$
- current = indexRepo;
- }
- else if (repoType.equalsIgnoreCase("NATIVE")) { //$NON-NLS-1$
- current = new NativeMetadataRepository();
- }
- else {
- // if the schema type is a module based
- current = getModuleBasedMetadataRepository(repoType);
- }
-
- if (current != null) {
- if (first == null) {
- first = current;
- }
-
- if (previous != null) {
- previous.setNext(current);
- }
- previous = current;
- current = null;
- }
- }
- return first;
- }
-
- private MetadataRepository getModuleBasedMetadataRepository(final String moduleName) throws DeploymentUnitProcessingException {
- final Module module;
- ClassLoader moduleLoader = this.getClass().getClassLoader();
- ModuleLoader ml = Module.getCallerModuleLoader();
- if (moduleName != null && ml != null) {
- try {
- module = ml.loadModule(ModuleIdentifier.create(moduleName));
- moduleLoader = module.getClassLoader();
- } catch (ModuleLoadException e) {
- throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50057, moduleName));
- }
- }
-
- final ServiceLoader<MetadataRepository> serviceLoader = ServiceLoader.load(MetadataRepository.class, moduleLoader);
- if (serviceLoader != null) {
- for (MetadataRepository loader:serviceLoader) {
- return loader;
- }
- }
- return null;
- }
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -31,12 +31,17 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.stream.XMLStreamException;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleLoader;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceContainer;
@@ -46,11 +51,9 @@
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBMetadataParser;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
@@ -66,8 +69,8 @@
import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository.ConnectorManagerException;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.Datatype;
@@ -80,11 +83,12 @@
import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.tempdata.GlobalTableStore;
import org.teiid.query.tempdata.GlobalTableStoreImpl;
+import org.teiid.runtime.AbstractVDBDeployer;
import org.teiid.translator.DelegatingExecutionFactory;
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.TranslatorException;
-class VDBService implements Service<RuntimeVDB> {
+class VDBService extends AbstractVDBDeployer implements Service<RuntimeVDB> {
private VDBMetaData vdb;
private RuntimeVDB runtimeVDB;
protected final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
@@ -136,19 +140,19 @@
final ServiceBuilder<Void> vdbService = addVDBFinishedService(context);
this.vdbListener = new VDBLifeCycleListener() {
@Override
- public void added(String name, int version, CompositeVDB vdb) {
+ public void added(String name, int version, CompositeVDB cvdb) {
}
@Override
- public void removed(String name, int version, CompositeVDB vdb) {
+ public void removed(String name, int version, CompositeVDB cvdb) {
}
@Override
- public void finishedDeployment(String name, int version, CompositeVDB vdb) {
+ public void finishedDeployment(String name, int version, CompositeVDB cvdb) {
if (!name.equals(VDBService.this.vdb.getName()) || version != VDBService.this.vdb.getVersion()) {
return;
}
- VDBMetaData vdbInstance = vdb.getVDB();
+ VDBMetaData vdbInstance = cvdb.getVDB();
// add object replication to temp/matview tables
GlobalTableStore gts = new GlobalTableStoreImpl(getBuffermanager(), vdbInstance.getAttachment(TransformationMetadata.class));
if (objectReplicatorInjector.getValue() != null) {
@@ -168,31 +172,20 @@
MetadataStore store = new MetadataStore();
try {
+ this.assignMetadataRepositories(vdb, super.getMetadataRepository("index")); //$NON-NLS-1$
// add transformation metadata to the repository.
getVDBRepository().addVDB(this.vdb, store, visibilityMap, udf, cmr);
} catch (VirtualDatabaseException e) {
- throw new StartException(IntegrationPlugin.Event.TEIID50032.name(), e);
+ throw new StartException(e);
}
this.vdb.removeAttachment(UDFMetaData.class);
-
- // load metadata from the models
- AtomicInteger loadCount = new AtomicInteger(this.vdb.getModelMetaDatas().values().size());
- for (ModelMetaData model: this.vdb.getModelMetaDatas().values()) {
- MetadataRepository metadataRepository = model.getAttachment(MetadataRepository.class);
- if (metadataRepository == null) {
- throw new StartException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50086, model.getName(), vdb.getName(), vdb.getVersion()));
- }
- model.addAttchment(MetadataRepository.class, metadataRepository);
- if (model.getModelType() == Model.Type.PHYSICAL || model.getModelType() == Model.Type.VIRTUAL) {
- loadMetadata(this.vdb, model, cmr, metadataRepository, store, loadCount);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " was being loaded from its repository in separate thread"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " skipped being loaded because of its type ", model.getModelType()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ try {
+ loadMetadata(this.vdb, cmr, store);
+ } catch (TranslatorException e) {
+ throw new StartException(e);
}
-
+
this.runtimeVDB = buildRuntimeVDB(this.vdb);
}
@@ -232,13 +225,13 @@
}
@Override
- public void start(StartContext context)
+ public void start(StartContext sc)
throws StartException {
}
@Override
- public void stop(StopContext context) {
+ public void stop(StopContext sc) {
}
});
@@ -324,14 +317,12 @@
}
}
+ protected void loadMetadata(final VDBMetaData vdb, final ModelMetaData model, final ConnectorManagerRepository cmr, final MetadataRepository metadataRepo, final MetadataStore vdbMetadataStore, final AtomicInteger loadCount) {
- private boolean loadMetadata(final VDBMetaData vdb, final ModelMetaData model, final ConnectorManagerRepository cmr, final MetadataRepository metadataRepo, final MetadataStore vdbMetadataStore, final AtomicInteger loadCount) {
-
String msg = IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50029,vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date()));
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ model.addRuntimeError(msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
- boolean asynch = false;
Runnable job = new Runnable() {
@Override
public void run() {
@@ -368,7 +359,6 @@
try {
metadataRepo.loadMetadata(factory, ef, cf);
- model.setSchemaText(null); // avoid carrying non required data around.
metadataLoaded = true;
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50030,vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())));
} catch (TranslatorException e) {
@@ -385,18 +375,11 @@
cacheMetadataStore(model, factory);
}
- // merge into VDB metadata
- factory.mergeInto(vdbMetadataStore);
-
- model.clearErrors();
-
- if (loadCount.decrementAndGet() == 0) {
- getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
- }
+ metadataLoaded(vdb, model, vdbMetadataStore, loadCount, factory);
}
else {
for (String errorMsg:errorMessages) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), errorMsg);
+ model.addRuntimeError(errorMsg);
LogManager.logWarning(LogConstants.CTX_RUNTIME, errorMsg);
}
}
@@ -414,22 +397,10 @@
job.run();
}
else {
- asynch = true;
executor.execute(job);
}
- return asynch;
}
- private ConnectorManager getConnectorManager(final ModelMetaData model, final ConnectorManagerRepository cmr) {
- if (model.isSource()) {
- List<SourceMappingMetadata> mappings = model.getSourceMappings();
- for (SourceMappingMetadata mapping:mappings) {
- return cmr.getConnectorManager(mapping.getName());
- }
- }
- return null;
- }
-
// if is not dynamic always cache; else check for the flag (this may need to be revisited with index vdb)
private void cacheMetadataStore(final ModelMetaData model, MetadataFactory schema) {
boolean cache = !vdb.isDynamic();
@@ -447,7 +418,7 @@
}
}
- private VDBRepository getVDBRepository() {
+ protected VDBRepository getVDBRepository() {
return vdbRepositoryInjector.getValue();
}
@@ -467,14 +438,46 @@
return bufferManagerInjector.getValue();
}
- private void save() throws AdminProcessingException {
+ private void save() throws AdminProcessingException{
try {
ObjectSerializer os = getSerializer();
VDBMetadataParser.marshell(this.vdb, os.getVdbXmlOutputStream(this.vdb));
} catch (IOException e) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50064, e);
+ throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50048, e);
} catch (XMLStreamException e) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50065, e);
+ throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50049, e);
}
}
+
+ /**
+ * Override for module based loading
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected MetadataRepository<?, ?> getMetadataRepository(String repoType) throws VirtualDatabaseException {
+ MetadataRepository<?, ?> repo = super.getMetadataRepository(repoType);
+ if (repo != null) {
+ return repo;
+ }
+ final Module module;
+ ClassLoader moduleLoader = this.getClass().getClassLoader();
+ ModuleLoader ml = Module.getCallerModuleLoader();
+ if (repoType != null && ml != null) {
+ try {
+ module = ml.loadModule(ModuleIdentifier.create(repoType));
+ moduleLoader = module.getClassLoader();
+ } catch (ModuleLoadException e) {
+ throw new VirtualDatabaseException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50057, repoType));
+ }
+ }
+
+ final ServiceLoader<MetadataRepository> serviceLoader = ServiceLoader.load(MetadataRepository.class, moduleLoader);
+ if (serviceLoader != null) {
+ for (MetadataRepository loader:serviceLoader) {
+ return loader;
+ }
+ }
+ return null;
+ }
+
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-06-18 16:09:18 UTC (rev 4184)
@@ -51,9 +51,7 @@
TEIID50023=replication failed {0}
TEIID50024=Failed to load metadata for VDB {0}.{1}
TEIID50044=Failed to save metadata for VDB {0}.{1} for model {2}
-TEIID50086=No metadata defined for model {0} for VDB {1}.{2}
TEIID50025=VDB "{0}" deployed in {1} state.
-TEIID50087=Model {0} specified with no source information in VDB {1}.{2}
TEIID50026=VDB "{0}" undeployed.
TEIID50029=VDB {0}.{1} model "{2}" metadata is currently being loaded. Start Time: {3}
TEIID50030=VDB {0}.{1} model "{2}" metadata loaded. End Time: {3}
Modified: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -240,27 +240,7 @@
if (!this.loaded) {
if (systemDatatypes == null) {
- InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/teiid/metadata/types.dat"); //$NON-NLS-1$
- try {
- InputStreamReader isr = new InputStreamReader(is, Charset.forName("UTF-8")); //$NON-NLS-1$
- BufferedReader br = new BufferedReader(isr);
- String s = br.readLine();
- String[] props = s.split("\\|"); //$NON-NLS-1$
- while ((s = br.readLine()) != null) {
- Datatype dt = new Datatype();
- String[] vals = s.split("\\|"); //$NON-NLS-1$
- Properties p = new Properties();
- for (int i = 0; i < props.length; i++) {
- if (vals[i].length() != 0) {
- p.setProperty(props[i], new String(vals[i]));
- }
- }
- PropertiesUtils.setBeanProperties(dt, p, null);
- addDatatype(dt);
- }
- } finally {
- is.close();
- }
+ loadSystemDatatypes(this);
}
ArrayList<Index> tmp = new ArrayList<Index>();
for (VirtualFile f : indexFiles) {
@@ -299,6 +279,30 @@
}
}
+ public static void loadSystemDatatypes(MetadataStore ms) throws IOException {
+ InputStream is = IndexMetadataStore.class.getClassLoader().getResourceAsStream("org/teiid/metadata/types.dat"); //$NON-NLS-1$
+ try {
+ InputStreamReader isr = new InputStreamReader(is, Charset.forName("UTF-8")); //$NON-NLS-1$
+ BufferedReader br = new BufferedReader(isr);
+ String s = br.readLine();
+ String[] props = s.split("\\|"); //$NON-NLS-1$
+ while ((s = br.readLine()) != null) {
+ Datatype dt = new Datatype();
+ String[] vals = s.split("\\|"); //$NON-NLS-1$
+ Properties p = new Properties();
+ for (int i = 0; i < props.length; i++) {
+ if (vals[i].length() != 0) {
+ p.setProperty(props[i], new String(vals[i]));
+ }
+ }
+ PropertiesUtils.setBeanProperties(dt, p, null);
+ ms.addDatatype(dt);
+ }
+ } finally {
+ is.close();
+ }
+ }
+
public void addIndexFile(VirtualFile f) {
this.indexFiles.add(f);
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -78,7 +78,7 @@
Collection <FunctionTree> udfs = new ArrayList<FunctionTree>();
if (udf != null) {
for (Map.Entry<String, Collection<FunctionMethod>> entry : udf.getFunctions().entrySet()) {
- udfs.add(new FunctionTree(entry.getKey(), new UDFSource(entry.getValue()), true));
+ udfs.add(new FunctionTree(entry.getKey(), new UDFSource(entry.getValue()), true, udf.getClassLoader()));
}
}
@@ -87,7 +87,7 @@
compositeStore.merge(s);
for (Schema schema:s.getSchemas().values()) {
if (!schema.getFunctions().isEmpty()) {
- udfs.add(new FunctionTree(schema.getName(), new UDFSource(schema.getFunctions().values()), true));
+ udfs.add(new FunctionTree(schema.getName(), new UDFSource(schema.getFunctions().values()), true, udf.getClassLoader()));
}
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -43,6 +43,7 @@
public class UDFMetaData {
private HashMap<String, Collection <FunctionMethod>> methods = new HashMap<String, Collection<FunctionMethod>>();
private HashMap<String, VirtualFile> files = new HashMap<String, VirtualFile>();
+ private ClassLoader classLoader;
public void addModelFile(VirtualFile file) {
this.files.put(file.getPathName(), file);
@@ -92,11 +93,10 @@
}
public void setFunctionClassLoader(ClassLoader functionClassLoader) {
- for (String name : this.methods.keySet()) {
- Collection <FunctionMethod> funcs = this.methods.get(name);
- for(FunctionMethod fm:funcs) {
- fm.setClassloader(functionClassLoader);
- }
- }
- }
+ this.classLoader = functionClassLoader;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -284,7 +284,7 @@
valid = true;
}
else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40073, name, version));
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40073, name, version));
}
// check the data sources available
@@ -314,7 +314,7 @@
if (cm != null) {
String msg = cm.getStausMessage();
if (msg != null && msg.length() > 0) {
- model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
+ model.addRuntimeError(cm.getStausMessage());
LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -86,7 +86,7 @@
if (!cm.getConnectionName().equals(dsName)){
markInvalid(vdb);
String msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40076, vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName), dsName);
- model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ model.addRuntimeError(msg);
cm = new ConnectorManager(translatorName, dsName);
cm.setExecutionFactory(ef);
cmr.addConnectorManager(sourceName, cm);
@@ -137,7 +137,7 @@
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (model.getRuntimeErrors().isEmpty()) {
+ if (!model.hasRuntimeErrors()) {
continue;
}
@@ -149,7 +149,7 @@
ConnectorManager cm = cmr.getConnectorManager(sourceName);
String status = cm.getStausMessage();
if (status != null && status.length() > 0) {
- model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
+ model.addRuntimeError(status);
LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
} else {
//get the pending metadata load
@@ -164,7 +164,7 @@
boolean valid = true;
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (!model.getRuntimeErrors().isEmpty()) {
+ if (model.hasRuntimeErrors()) {
valid = false;
break;
}
@@ -203,7 +203,7 @@
else {
msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40012, vdb.getName(), vdb.getVersion(), resourceName);
}
- model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ model.addRuntimeError(msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion(), vdb.getStatus()));
}
Added: trunk/runtime/src/main/java/org/teiid/runtime/AbstractVDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/AbstractVDBDeployer.java (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/runtime/AbstractVDBDeployer.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.runtime;
+
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Model.Type;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.deployers.VirtualDatabaseException;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataRepository;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.query.metadata.DDLMetadataRepository;
+import org.teiid.query.metadata.NativeMetadataRepository;
+import org.teiid.translator.TranslatorException;
+
+public abstract class AbstractVDBDeployer {
+
+ private Map<String, MetadataRepository<?, ?>> repositories = new ConcurrentSkipListMap<String, MetadataRepository<?, ?>>(String.CASE_INSENSITIVE_ORDER);
+
+ public AbstractVDBDeployer() {
+ repositories.put("ddl", new DDLMetadataRepository()); //$NON-NLS-1$
+ repositories.put("native", new NativeMetadataRepository()); //$NON-NLS-1$
+ }
+
+ public void addMetadataRepository(String name, MetadataRepository<?, ?> metadataRepository) {
+ this.repositories.put(name, metadataRepository);
+ }
+
+ protected void assignMetadataRepositories(VDBMetaData deployment, MetadataRepository<?, ?> defaultRepo) throws VirtualDatabaseException {
+ for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
+ if (model.isSource() && model.getSourceNames().isEmpty()) {
+ throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40093, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40093, model.getName(), deployment.getName(), deployment.getVersion()));
+ }
+ if (model.getModelType() == Type.FUNCTION || model.getModelType() == Type.OTHER) {
+ continue;
+ }
+ MetadataRepository<?, ?> repo = getMetadataRepository(deployment, model, defaultRepo);
+ model.addAttchment(MetadataRepository.class, repo);
+ }
+ }
+
+ private MetadataRepository<?, ?> getMetadataRepository(VDBMetaData vdb, ModelMetaData model, MetadataRepository<?, ?> defaultRepo) throws VirtualDatabaseException {
+ if (model.getSchemaSourceType() == null) {
+ if (!vdb.isDynamic()) {
+ return defaultRepo;
+ }
+
+ if (model.isSource()) {
+ return new NativeMetadataRepository();
+ }
+ throw new VirtualDatabaseException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40094, model.getName(), vdb.getName(), vdb.getVersion(), null));
+ }
+
+ MetadataRepository<?, ?> first = null;
+ MetadataRepository<?, ?> current = null;
+ MetadataRepository<?, ?> previous = null;
+ StringTokenizer st = new StringTokenizer(model.getSchemaSourceType(), ","); //$NON-NLS-1$
+ while (st.hasMoreTokens()) {
+ String repoType = st.nextToken().trim();
+ current = getMetadataRepository(repoType);
+ if (current == null) {
+ throw new VirtualDatabaseException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40094, model.getName(), vdb.getName(), vdb.getVersion(), repoType));
+ }
+
+ if (first == null) {
+ first = current;
+ }
+
+ if (previous != null) {
+ previous.setNext(current);
+ }
+ previous = current;
+ current = null;
+ }
+ return first;
+ }
+
+ protected ConnectorManager getConnectorManager(final ModelMetaData model, final ConnectorManagerRepository cmr) {
+ if (model.isSource()) {
+ List<SourceMappingMetadata> mappings = model.getSourceMappings();
+ for (SourceMappingMetadata mapping:mappings) {
+ return cmr.getConnectorManager(mapping.getName());
+ }
+ }
+ return null;
+ }
+
+ protected void loadMetadata(VDBMetaData vdb, ConnectorManagerRepository cmr,
+ MetadataStore store) throws TranslatorException {
+ // load metadata from the models
+ AtomicInteger loadCount = new AtomicInteger();
+ for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
+ if (model.getModelType() == Model.Type.PHYSICAL || model.getModelType() == Model.Type.VIRTUAL) {
+ loadCount.incrementAndGet();
+ }
+ }
+ for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
+ MetadataRepository metadataRepository = model.getAttachment(MetadataRepository.class);
+ if (model.getModelType() == Model.Type.PHYSICAL || model.getModelType() == Model.Type.VIRTUAL) {
+ loadMetadata(vdb, model, cmr, metadataRepository, store, loadCount);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " was being loaded from its repository"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ else {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " skipped being loaded because of its type ", model.getModelType()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (loadCount.decrementAndGet() == 0) {
+ getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+ }
+ }
+ }
+ }
+
+ protected abstract VDBRepository getVDBRepository();
+
+ protected abstract void loadMetadata(VDBMetaData vdb, ModelMetaData model,
+ ConnectorManagerRepository cmr,
+ MetadataRepository metadataRepository, MetadataStore store,
+ AtomicInteger loadCount) throws TranslatorException;
+
+ protected void metadataLoaded(final VDBMetaData vdb,
+ final ModelMetaData model,
+ final MetadataStore vdbMetadataStore,
+ final AtomicInteger loadCount, MetadataFactory factory) {
+ // merge into VDB metadata
+ factory.mergeInto(vdbMetadataStore);
+
+ //TODO: this is not quite correct, the source may be missing
+ model.clearRuntimeErrors();
+
+ if (loadCount.decrementAndGet() == 0) {
+ getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+ }
+ }
+
+ /**
+ * @throws VirtualDatabaseException
+ */
+ protected MetadataRepository<?, ?> getMetadataRepository(String repoType) throws VirtualDatabaseException {
+ return repositories.get(repoType);
+ }
+}
Property changes on: trunk/runtime/src/main/java/org/teiid/runtime/AbstractVDBDeployer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedConfiguration.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -42,6 +42,7 @@
private MetadataStore systemStore;
private ObjectReplicator objectReplicator;
private WorkManager workManager;
+ private boolean useDisk = true;
public SecurityHelper getSecurityHelper() {
return securityHelper;
@@ -98,6 +99,17 @@
if (workManager == null) {
return super.getTeiidExecutor();
}
+ //TODO: if concurrency is 1, then use a direct executor
+ //the only scheduled task right now just restarts a workitem,
+ //so that can be done in the scheduler thread
return new WorkManagerTeiidExecutor(workManager);
}
+
+ public boolean isUseDisk() {
+ return useDisk;
+ }
+
+ public void setUseDisk(boolean useDisk) {
+ this.useDisk = useDisk;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/runtime/EmbeddedServer.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -22,6 +22,7 @@
package org.teiid.runtime;
+import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@@ -29,9 +30,15 @@
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import org.teiid.Replicated;
@@ -55,12 +62,15 @@
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository.ConnectorManagerException;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository.ExecutionFactoryProvider;
import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.dqp.internal.process.PreparedPlan;
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.internal.process.TransactionServerImpl;
import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.TransactionContext;
+import org.teiid.dqp.service.TransactionContext.Scope;
import org.teiid.events.EventDistributor;
import org.teiid.events.EventDistributorFactory;
import org.teiid.jdbc.ConnectionImpl;
@@ -69,7 +79,11 @@
import org.teiid.jdbc.TeiidSQLException;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
import org.teiid.query.ObjectReplicator;
@@ -95,8 +109,47 @@
* Needs to be started prior to use with a call to {@link #start(EmbeddedConfiguration)}
*/
@SuppressWarnings("serial")
-public class EmbeddedServer implements EventDistributorFactory {
+public class EmbeddedServer extends AbstractVDBDeployer implements EventDistributorFactory, ExecutionFactoryProvider {
+ protected final class TransactionDetectingTransactionServer extends
+ TransactionServerImpl {
+
+ /**
+ * Override to detect existing thread bound transactions.
+ * This may be of interest for local connections as well, but
+ * we assume there that a managed datasource will be used.
+ * A managed datasource is not possible here.
+ */
+ public TransactionContext getOrCreateTransactionContext(final String threadId) {
+ TransactionContext tc = super.getOrCreateTransactionContext(threadId);
+ if (useCallingThread && detectTransactions && tc.getTransaction() == null) {
+ try {
+ Transaction tx = transactionManager.getTransaction();
+ if (tx != null) {
+ tx.registerSynchronization(new Synchronization() {
+
+ @Override
+ public void beforeCompletion() {
+ }
+
+ @Override
+ public void afterCompletion(int status) {
+ transactions.removeTransactionContext(threadId);
+ }
+ });
+ tc.setTransaction(tx);
+ tc.setTransactionType(Scope.LOCAL);
+ }
+ } catch (SystemException e) {
+ } catch (IllegalStateException e) {
+ } catch (RollbackException e) {
+ }
+ }
+
+ return tc;
+ }
+ }
+
protected class ProviderAwareConnectorManagerRepository extends
ConnectorManagerRepository {
protected ConnectorManager createConnectorManager(
@@ -143,7 +196,7 @@
protected SessionServiceImpl sessionService = new SessionServiceImpl();
protected ObjectReplicator replicator;
protected BufferServiceImpl bufferService = new BufferServiceImpl();
- protected TransactionServerImpl transactionService = new TransactionServerImpl();
+ protected TransactionDetectingTransactionServer transactionService = new TransactionDetectingTransactionServer();
protected ClientServiceRegistryImpl services = new ClientServiceRegistryImpl();
protected LogonImpl logon;
private TeiidDriver driver = new TeiidDriver();
@@ -197,6 +250,9 @@
}
};
protected boolean useCallingThread = true;
+ //TODO: allow for configurablity - in environments that support subtransations it would be fine
+ //to allow teiid to start a request transaction under an existing thread bound transaction
+ protected boolean detectTransactions = true;
private Boolean running;
public EmbeddedServer() {
@@ -215,7 +271,17 @@
this.eventDistributorFactoryService.start();
this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor());
this.replicator = dqpConfiguration.getObjectReplicator();
- this.repo.setSystemStore(dqpConfiguration.getSystemStore());
+ if (dqpConfiguration.getSystemStore() == null) {
+ MetadataStore ms = new MetadataStore();
+ try {
+ IndexMetadataStore.loadSystemDatatypes(ms);
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ this.repo.setSystemStore(ms);
+ } else {
+ this.repo.setSystemStore(dqpConfiguration.getSystemStore());
+ }
if (dqpConfiguration.getTransactionManager() == null) {
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089));
this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() {
@@ -226,6 +292,7 @@
throw new UnsupportedOperationException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089));
}
}));
+ this.detectTransactions = false;
} else {
this.transactionService.setTransactionManager(dqpConfiguration.getTransactionManager());
}
@@ -241,7 +308,7 @@
}
this.sessionService.setVDBRepository(repo);
-
+ this.bufferService.setUseDisk(dqpConfiguration.isUseDisk());
BufferService bs = getBufferService();
this.dqp.setBufferManager(bs.getBufferManager());
@@ -349,42 +416,75 @@
return bufferService;
}
+ /**
+ * Add an {@link ExecutionFactory}. The {@link ExecutionFactory#start()} method
+ * should have already been called.
+ * @param ef
+ */
public void addTranslator(ExecutionFactory<?, ?> ef) {
Translator t = ef.getClass().getAnnotation(Translator.class);
String name = ef.getClass().getName();
if (t != null) {
name = t.name();
}
+ addTranslator(name, ef);
+ }
+
+ void addTranslator(String name, ExecutionFactory<?, ?> ef) {
translators.put(name, ef);
}
+ /**
+ * Deploy the given set of models as vdb name.1
+ * @param name
+ * @param models
+ * @throws ConnectorManagerException
+ * @throws VirtualDatabaseException
+ * @throws TranslatorException
+ */
public void deployVDB(String name, List<ModelMetaData> models)
- throws ConnectorManagerException, VirtualDatabaseException {
+ throws ConnectorManagerException, VirtualDatabaseException, TranslatorException {
checkStarted();
VDBMetaData vdb = new VDBMetaData();
+ vdb.setDynamic(true);
vdb.setName(name);
vdb.setModels(models);
- cmr.createConnectorManagers(vdb,
- new ConnectorManagerRepository.ExecutionFactoryProvider() {
-
- @SuppressWarnings("unchecked")
- @Override
- public ExecutionFactory<Object, Object> getExecutionFactory(
- String translator) throws ConnectorManagerException {
- ExecutionFactory<?, ?> ef = translators.get(translator);
- if (ef == null) {
- throw new ConnectorManagerException(translator);
- }
- return (ExecutionFactory<Object, Object>) ef;
- }
- });
+ cmr.createConnectorManagers(vdb, this);
MetadataStore metadataStore = new MetadataStore();
- repo.addVDB(vdb, metadataStore, new LinkedHashMap<String, Resource>(),
- new UDFMetaData(), cmr);
- // metadata load
-
+ UDFMetaData udfMetaData = new UDFMetaData();
+ udfMetaData.setFunctionClassLoader(Thread.currentThread().getContextClassLoader());
+ this.assignMetadataRepositories(vdb, null);
+ repo.addVDB(vdb, metadataStore, new LinkedHashMap<String, Resource>(), udfMetaData, cmr);
+ this.loadMetadata(vdb, cmr, metadataStore);
}
-
+
+ /**
+ * TODO: consolidate this logic more into the abstract deployer
+ */
+ @Override
+ protected void loadMetadata(VDBMetaData vdb, ModelMetaData model,
+ ConnectorManagerRepository cmr,
+ MetadataRepository metadataRepository, MetadataStore store,
+ AtomicInteger loadCount) throws TranslatorException {
+ Map<String, Datatype> datatypes = this.repo.getBuiltinDatatypes();
+ MetadataFactory factory = new MetadataFactory(vdb.getName(), vdb.getVersion(), model.getName(), datatypes, model.getProperties(), model.getSchemaText());
+ factory.getSchema().setPhysical(model.isSource());
+
+ ExecutionFactory ef = null;
+ Object cf = null;
+
+ try {
+ ConnectorManager cm = getConnectorManager(model, cmr);
+ ef = ((cm == null)?null:cm.getExecutionFactory());
+ cf = ((cm == null)?null:cm.getConnectionFactory());
+ } catch (TranslatorException e1) {
+ //ignore data source not availability, it may not be required.
+ }
+
+ metadataRepository.loadMetadata(factory, ef, cf);
+ metadataLoaded(vdb, model, store, loadCount, factory);
+ }
+
public void undeployVDB(String vdbName) {
this.repo.removeVDB(vdbName, 1);
}
@@ -416,4 +516,21 @@
return this.eventDistributorFactoryService.getEventDistributor();
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public ExecutionFactory<Object, Object> getExecutionFactory(String name)
+ throws ConnectorManagerException {
+ ExecutionFactory<?, ?> ef = translators.get(name);
+ if (ef == null) {
+ //TODO: consolidate this exception into the connectormanagerrepository
+ throw new ConnectorManagerException(name);
+ }
+ return (ExecutionFactory<Object, Object>) ef;
+ }
+
+ @Override
+ protected VDBRepository getVDBRepository() {
+ return this.repo;
+ }
+
}
Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -104,6 +104,9 @@
TEIID40089, //txn disabled
TEIID40090,
TEIID40091,
- TEIID40092
+ TEIID40092,
+ TEIID40093, //no sources
+ TEIID40094, //invalid metadata repso
+
}
}
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-06-18 16:09:18 UTC (rev 4184)
@@ -95,3 +95,5 @@
TEIID40090=Model name "{0}" not found in the VDB with name "{1}" version "{2}"
TEIID40091=Source name "{0}" not found for model {1} in the VDB with name "{2}" version "{3}"
TEIID40092=Policy {0} not found in VDB {1}.{2}
+TEIID40093=Model {0} specified with no source information in VDB {1}.{2}
+TEIID40094=No metadata repository of type {3} defined for model {0} for VDB {1}.{2}
Added: trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java (rev 0)
+++ trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.runtime;
+
+import static org.junit.Assert.*;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.jdbc.TeiidDriver;
+import org.teiid.language.QueryExpression;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.metadata.Table;
+import org.teiid.runtime.EmbeddedServer.ConnectionFactoryProvider;
+import org.teiid.translator.DataNotAvailableException;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
+
+@SuppressWarnings("nls")
+public class TestEmbeddedServer {
+ EmbeddedServer es;
+
+ @Before public void setup() {
+ es = new EmbeddedServer();
+ }
+
+ @After public void teardown() {
+ es.stop();
+ }
+
+ @Test public void testDeploy() throws Exception {
+ EmbeddedConfiguration ec = new EmbeddedConfiguration();
+ ec.setUseDisk(false);
+ es.start(ec);
+
+ es.addTranslator("y", new ExecutionFactory<AtomicInteger, Object> () {
+ @Override
+ public Object getConnection(AtomicInteger factory)
+ throws TranslatorException {
+ return factory.incrementAndGet();
+ }
+
+ @Override
+ public void closeConnection(Object connection, AtomicInteger factory) {
+
+ }
+
+ @Override
+ public void getMetadata(MetadataFactory metadataFactory, Object conn)
+ throws TranslatorException {
+ assertEquals(conn, Integer.valueOf(1));
+ Table t = metadataFactory.addTable("my-table");
+ metadataFactory.addColumn("my-column", TypeFacility.RUNTIME_NAMES.STRING, t);
+ }
+
+ @Override
+ public ResultSetExecution createResultSetExecution(
+ QueryExpression command, ExecutionContext executionContext,
+ RuntimeMetadata metadata, Object connection)
+ throws TranslatorException {
+ ResultSetExecution rse = new ResultSetExecution() {
+
+ @Override
+ public void execute() throws TranslatorException {
+
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ @Override
+ public void cancel() throws TranslatorException {
+
+ }
+
+ @Override
+ public List<?> next() throws TranslatorException, DataNotAvailableException {
+ return null;
+ }
+ };
+ return rse;
+ }
+ });
+ final AtomicInteger counter = new AtomicInteger();
+ ConnectionFactoryProvider<AtomicInteger> cfp = new ConnectionFactoryProvider<AtomicInteger>() {
+ @Override
+ public AtomicInteger getConnectionFactory()
+ throws TranslatorException {
+ return counter;
+ }
+ };
+
+ es.addConnectionFactoryProvider("z", cfp);
+
+ ModelMetaData mmd = new ModelMetaData();
+ mmd.setName("my-schema");
+ mmd.addSourceMapping("x", "y", "z");
+
+ es.deployVDB("test", Arrays.asList(mmd));
+
+ TeiidDriver td = es.getDriver();
+ Connection c = td.connect("jdbc:teiid:test", null);
+ Statement s = c.createStatement();
+ ResultSet rs = s.executeQuery("select * from \"my-table\"");
+ assertFalse(rs.next());
+ assertEquals("my-column", rs.getMetaData().getColumnLabel(1));
+ }
+
+}
Property changes on: trunk/runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-06-18 14:37:59 UTC (rev 4183)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-06-18 16:09:18 UTC (rev 4184)
@@ -105,6 +105,7 @@
config.setTransactionManager(SimpleMock.createSimpleMock(TransactionManager.class));
this.transactionService.setXaTerminator(SimpleMock.createSimpleMock(XATerminator.class));
this.transactionService.setWorkManager(new FakeWorkManager());
+ detectTransactions = false;
}
this.repo.odbcEnabled();
this.realBufferManager = realBufferMangaer;
Added: trunk/test-integration/common/src/test/resources/reuse-vdb.xml
===================================================================
--- trunk/test-integration/common/src/test/resources/reuse-vdb.xml (rev 0)
+++ trunk/test-integration/common/src/test/resources/reuse-vdb.xml 2012-06-18 16:09:18 UTC (rev 4184)
@@ -0,0 +1,13 @@
+<vdb name="reuse" version= "1">
+ <import-vdb name="dynamic" version="1"/>
+ <model visible = "true" type = "VIRTUAL" name = "portfolio1">
+ <metadata type = "DDL"><![CDATA[
+ CREATE VIEW stock1 (
+ symbol varchar,
+ price decimal
+ ) AS
+ select * from stock;
+ ]]>
+ </metadata>
+ </model>
+</vdb>
\ No newline at end of file
Property changes on: trunk/test-integration/common/src/test/resources/reuse-vdb.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 6 months
teiid SVN: r4183 - in trunk: jboss-integration/src/main/java/org/teiid/jboss and 4 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-06-18 10:37:59 -0400 (Mon, 18 Jun 2012)
New Revision: 4183
Added:
trunk/runtime/src/main/java/org/teiid/deployers/RuntimeVDB.java
Removed:
trunk/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.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/runtime/RuntimePlugin.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-2057: fixing the VDB modify operations to be synchronous, removing the duplicated code in TeiidOperationHandler and VDBService. Now all the VDB runtime operations should be handled through RuntimeVDB. Removed ListOverMap objects in the AdminObject(s) that was previously used in support of JAXB.
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -24,11 +24,9 @@
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
-
import org.teiid.adminapi.AdminObject;
public abstract class AdminObjectImpl implements AdminObject, Serializable {
@@ -40,15 +38,7 @@
private String serverName;
private String hostName;
- private ListOverMap<PropertyMetadata> properties = new ListOverMap<PropertyMetadata>(new KeyBuilder<PropertyMetadata>() {
- private static final long serialVersionUID = 3687928367250819142L;
-
- @Override
- public String getKey(PropertyMetadata entry) {
- return entry.getName();
- }
- });
-
+ private Properties properties = new Properties();
private transient Map<String, Object> attachments = Collections.synchronizedMap(new HashMap<String, Object>());
@Override
@@ -87,8 +77,8 @@
@Override
public Properties getProperties() {
Properties props = new Properties();
- for (PropertyMetadata p:this.properties.getMap().values()) {
- props.setProperty(p.getName(), p.getValue());
+ for (String key:this.properties.stringPropertyNames()) {
+ props.setProperty(key, this.properties.getProperty(key));
}
return props;
}
@@ -102,110 +92,93 @@
}
}
- public List<PropertyMetadata> getJAXBProperties(){
- return properties;
- }
-
- public void setJAXBProperties(List<PropertyMetadata> props){
- this.properties.clear();
- if (props != null) {
- for (PropertyMetadata prop:props) {
- addProperty(prop.getName(), prop.getValue());
- }
- }
- }
-
@Override
public String getPropertyValue(String name) {
- PropertyMetadata prop = this.properties.getMap().get(name);
- if (prop == null) {
- return null;
- }
- return prop.getValue();
+ return this.properties.getProperty(name);
}
public void addProperty(String key, String value) {
- this.properties.getMap().put(key, new PropertyMetadata(key, value));
+ this.properties.setProperty(key, value);
}
- /**
- * Add attachment
- *
- * @param <T> the expected type
- * @param attachment the attachment
- * @param type the type
- * @return any previous attachment
- * @throws IllegalArgumentException for a null name, attachment or type
- * @throws UnsupportedOperationException when not supported by the implementation
- */
- public <T> T addAttchment(Class<T> type, T attachment) {
- if (type == null)
+ /**
+ * Add attachment
+ *
+ * @param <T> the expected type
+ * @param attachment the attachment
+ * @param type the type
+ * @return any previous attachment
+ * @throws IllegalArgumentException for a null name, attachment or type
+ * @throws UnsupportedOperationException when not supported by the implementation
+ */
+ public <T> T addAttchment(Class<T> type, T attachment) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.put(type.getName(), attachment);
+ if (result == null)
+ return null;
+ return type.cast(result);
+
+ }
+
+ public Object addAttchment(String key, Object attachment) {
+ if (key == null)
throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
- Object result = this.attachments.put(type.getName(), attachment);
+ Object result = this.attachments.put(key, attachment);
if (result == null)
return null;
- return type.cast(result);
-
- }
-
- public Object addAttchment(String key, Object attachment) {
- if (key == null)
- throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
- Object result = this.attachments.put(key, attachment);
- if (result == null)
- return null;
- return result;
- }
-
- /**
- * Remove attachment
- *
- * @param <T> the expected type
- * @return the attachment or null if not present
- * @param type the type
- * @throws IllegalArgumentException for a null name or type
- */
- public <T> T removeAttachment(Class<T> type) {
- if (type == null)
- throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
- Object result = this.attachments.remove(type.getName());
- if (result == null)
- return null;
- return type.cast(result);
- }
-
- public Object removeAttachment(String key) {
- if (key == null)
- throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
- Object result = this.attachments.remove(key);
- if (result == null)
- return null;
- return result;
- }
- /**
- * Get attachment
- *
- * @param <T> the expected type
- * @param type the type
- * @return the attachment or null if not present
- * @throws IllegalArgumentException for a null name or type
- */
- public <T> T getAttachment(Class<T> type) {
- if (type == null)
+ return result;
+ }
+
+ /**
+ * Remove attachment
+ *
+ * @param <T> the expected type
+ * @return the attachment or null if not present
+ * @param type the type
+ * @throws IllegalArgumentException for a null name or type
+ */
+ public <T> T removeAttachment(Class<T> type) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.remove(type.getName());
+ if (result == null)
+ return null;
+ return type.cast(result);
+ }
+
+ public Object removeAttachment(String key) {
+ if (key == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.remove(key);
+ if (result == null)
+ return null;
+ return result;
+ }
+ /**
+ * Get attachment
+ *
+ * @param <T> the expected type
+ * @param type the type
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ public <T> T getAttachment(Class<T> type) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.get(type.getName());
+ if (result == null)
+ return null;
+ return type.cast(result);
+ }
+
+ public Object getAttachment(String key) {
+ if (key == null)
throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
- Object result = this.attachments.get(type.getName());
+ Object result = this.attachments.get(key);
if (result == null)
return null;
- return type.cast(result);
- }
-
- public Object getAttachment(String key) {
- if (key == null)
- throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
- Object result = this.attachments.get(key);
- if (result == null)
- return null;
- return result;
- }
+ return result;
+ }
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -37,13 +37,7 @@
protected boolean anyAuthenticated;
protected Boolean allowCreateTemporaryTables;
- protected PermissionMap permissions = new PermissionMap(new KeyBuilder<PermissionMetaData>() {
- private static final long serialVersionUID = -6992984146431492449L;
- @Override
- public String getKey(PermissionMetaData entry) {
- return entry.getResourceName().toLowerCase();
- }
- });
+ protected PermissionMap permissions = new PermissionMap();
protected List<String> mappedRoleNames = new ArrayList<String>();
@@ -67,19 +61,19 @@
@Override
public List<DataPermission> getPermissions() {
- return new ArrayList<DataPermission>(this.permissions.getMap().values());
+ return new ArrayList<DataPermission>(this.permissions.values());
}
public void setPermissions(List<DataPermission> permissions) {
- this.permissions.getMap().clear();
+ this.permissions.clear();
for (DataPermission permission:permissions) {
- this.permissions.add((PermissionMetaData)permission);
+ this.permissions.put(permission.getResourceName().toLowerCase(), (PermissionMetaData)permission);
}
}
public void addPermission(PermissionMetaData... permissions) {
for (PermissionMetaData permission:permissions) {
- this.permissions.add(permission);
+ this.permissions.put(permission.getResourceName().toLowerCase(), permission);
}
}
@@ -104,7 +98,7 @@
public boolean allows(String resourceName, DataPolicy.PermissionType type) {
resourceName = resourceName.toLowerCase();
while (resourceName.length() > 0) {
- PermissionMetaData p = this.permissions.getMap().get(resourceName);
+ PermissionMetaData p = this.permissions.get(resourceName);
if (p != null) {
Boolean allowed = p.allows(type);
if (allowed != null) {
Deleted: trunk/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (C) 2008 Red Hat, Inc.
- * Licensed to Red Hat, Inc. under one or more contributor
- * license agreements. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.io.Serializable;
-import java.util.AbstractList;
-import java.util.LinkedHashMap;
-import java.util.Set;
-
-class ListOverMap<E> extends AbstractList<E> implements Serializable {
-
- private static final long serialVersionUID = 5171741731121210240L;
-
- protected LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
- protected KeyBuilder<E> builder;
-
- public ListOverMap(KeyBuilder<E> builder) {
- this.builder = builder;
- }
-
- public LinkedHashMap<String, E> getMap() {
- return map;
- }
-
- @Override
- public void add(int index, E element) {
- this.map.put(builder.getKey(element), element);
- }
-
- @Override
- public E remove(int index) {
- String key = getKey(index);
- if (key == null) {
- throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return this.map.remove(key);
- }
-
- @Override
- public E get(int index) {
- String key = getKey(index);
- if (key == null) {
- throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return this.map.get(key);
- }
-
- private String getKey(int index) {
- Set<String> keys = this.map.keySet();
- int i = 0;
- for (String key:keys) {
- if (i == index) {
- return key;
- }
- i++;
- }
- return null;
- }
-
- @Override
- public int size() {
- return this.map.size();
- }
-}
-
-interface KeyBuilder<E> extends Serializable {
- String getKey(E entry);
-}
-
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -25,6 +25,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@@ -38,15 +39,7 @@
private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
private static final long serialVersionUID = 3714234763056162230L;
- protected ListOverMap<SourceMappingMetadata> sources = new ListOverMap<SourceMappingMetadata>(new KeyBuilder<SourceMappingMetadata>() {
- private static final long serialVersionUID = 2273673984691112369L;
-
- @Override
- public String getKey(SourceMappingMetadata entry) {
- return entry.getName();
- }
- });
-
+ protected LinkedHashMap<String, SourceMappingMetadata> sources = new LinkedHashMap<String, SourceMappingMetadata>();
protected String modelType = Type.PHYSICAL.name();
protected String description;
protected String path;
@@ -107,11 +100,6 @@
return Boolean.parseBoolean(supports);
}
- @Override
- public List<PropertyMetadata> getJAXBProperties(){
- return super.getJAXBProperties();
- }
-
public void setSupportsMultiSourceBindings(boolean supports) {
addProperty(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY, Boolean.toString(supports));
}
@@ -137,15 +125,15 @@
}
public List<SourceMappingMetadata> getSourceMappings(){
- return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
+ return new ArrayList<SourceMappingMetadata>(this.sources.values());
}
public SourceMappingMetadata getSourceMapping(String sourceName){
- return this.sources.getMap().get(sourceName);
+ return this.sources.get(sourceName);
}
public void setSourceMappings(List<SourceMappingMetadata> sources){
- this.sources.getMap().clear();
+ this.sources.clear();
for (SourceMappingMetadata source: sources) {
addSourceMapping(source.getName(), source.getTranslatorName(), source.getConnectionJndiName());
}
@@ -153,12 +141,12 @@
@Override
public List<String> getSourceNames() {
- return new ArrayList<String>(this.sources.getMap().keySet());
+ return new ArrayList<String>(this.sources.keySet());
}
@Override
public String getSourceConnectionJndiName(String sourceName) {
- SourceMappingMetadata s = this.sources.getMap().get(sourceName);
+ SourceMappingMetadata s = this.sources.get(sourceName);
if (s == null) {
return null;
}
@@ -167,7 +155,7 @@
@Override
public String getSourceTranslatorName(String sourceName) {
- SourceMappingMetadata s = this.sources.getMap().get(sourceName);
+ SourceMappingMetadata s = this.sources.get(sourceName);
if (s == null) {
return null;
}
@@ -175,7 +163,7 @@
}
public SourceMappingMetadata addSourceMapping(String name, String translatorName, String connJndiName) {
- return this.sources.getMap().put(name, new SourceMappingMetadata(name, translatorName, connJndiName));
+ return this.sources.put(name, new SourceMappingMetadata(name, translatorName, connJndiName));
}
public void addSourceMapping(SourceMappingMetadata source) {
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -22,19 +22,17 @@
*/
package org.teiid.adminapi.impl;
+import java.util.LinkedHashMap;
+
import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
-public class PermissionMap extends ListOverMap<PermissionMetaData> {
+public class PermissionMap extends LinkedHashMap<String, PermissionMetaData> {
private static final long serialVersionUID = -1170556665834875267L;
- public PermissionMap(KeyBuilder<PermissionMetaData> builder) {
- super(builder);
- }
-
@Override
- public void add(int index, PermissionMetaData element) {
- PermissionMetaData previous = this.map.get(builder.getKey(element));
+ public PermissionMetaData put(String key, PermissionMetaData element) {
+ PermissionMetaData previous = get(element.getResourceName().toLowerCase());
if (previous != null) {
if (element.allowCreate != null) {
previous.setAllowCreate(element.allowCreate);
@@ -48,10 +46,8 @@
if (element.allowDelete != null) {
previous.setAllowDelete(element.allowDelete);
}
+ return previous;
}
- else {
- super.add(index, element);
- }
+ return super.put(element.getResourceName().toLowerCase(), element);
}
-
}
Deleted: trunk/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.io.Serializable;
-
-/**
- * <pre>
- * <complexType name="property">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-public class PropertyMetadata implements Serializable{
- private static final long serialVersionUID = -5040224539939758816L;
-
- protected String name;
- protected String value;
-
- public PropertyMetadata() {
- }
-
- public PropertyMetadata(String key, String value) {
- this.name = key;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String toString() {
- return this.name+"="+this.value; //$NON-NLS-1$
- }
-}
\ No newline at end of file
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -25,6 +25,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -42,43 +43,12 @@
private static final long serialVersionUID = -4723595252013356436L;
- /**
- * This simulating a list over a map. JAXB requires a list and performance recommends
- * map and we would like to keep one variable to represent both.
- */
- protected ListOverMap<ModelMetaData> models = new ListOverMap<ModelMetaData>(new KeyBuilder<ModelMetaData>() {
- private static final long serialVersionUID = 846247100420118961L;
-
- @Override
- public String getKey(ModelMetaData entry) {
- return entry.getName();
- }
- });
-
- protected ListOverMap<VDBTranslatorMetaData> translators = new ListOverMap<VDBTranslatorMetaData>(new KeyBuilder<VDBTranslatorMetaData>() {
- private static final long serialVersionUID = 3890502172003653563L;
-
- @Override
- public String getKey(VDBTranslatorMetaData entry) {
- return entry.getName();
- }
- });
-
- protected ListOverMap<DataPolicyMetadata> dataPolicies = new ListOverMap<DataPolicyMetadata>(new KeyBuilder<DataPolicyMetadata>() {
- private static final long serialVersionUID = 4954591545242715254L;
-
- @Override
- public String getKey(DataPolicyMetadata entry) {
- return entry.getName();
- }
- });
-
+ private LinkedHashMap<String, ModelMetaData> models = new LinkedHashMap<String, ModelMetaData>();
+ private LinkedHashMap<String, VDBTranslatorMetaData> translators = new LinkedHashMap<String, VDBTranslatorMetaData>();
+ private LinkedHashMap<String, DataPolicyMetadata> dataPolicies = new LinkedHashMap<String, DataPolicyMetadata>();
private List<VDBImportMetadata> imports = new ArrayList<VDBImportMetadata>(2);
-
private int version = 1;
-
- protected String description;
-
+ private String description;
private boolean dynamic = false;
private volatile VDB.Status status = VDB.Status.ACTIVE;
private ConnectionType connectionType = VDB.ConnectionType.BY_VERSION;
@@ -134,44 +104,44 @@
@Override
public List<Model> getModels(){
- return new ArrayList<Model>(this.models.getMap().values());
+ return new ArrayList<Model>(this.models.values());
}
public Map<String, ModelMetaData> getModelMetaDatas() {
- return this.models.getMap();
+ return this.models;
}
/**
* @param models
*/
public void setModels(Collection<ModelMetaData> models) {
- this.models.getMap().clear();
+ this.models.clear();
for (ModelMetaData obj : models) {
addModel(obj);
}
}
public ModelMetaData addModel(ModelMetaData m) {
- return this.models.getMap().put(m.getName(), m);
+ return this.models.put(m.getName(), m);
}
@Override
public List<Translator> getOverrideTranslators() {
- return new ArrayList<Translator>(this.translators.getMap().values());
+ return new ArrayList<Translator>(this.translators.values());
}
public void setOverrideTranslators(List<Translator> translators) {
for (Translator t: translators) {
- this.translators.getMap().put(t.getName(), (VDBTranslatorMetaData)t);
+ this.translators.put(t.getName(), (VDBTranslatorMetaData)t);
}
}
public void addOverideTranslator(VDBTranslatorMetaData t) {
- this.translators.getMap().put(t.getName(), t);
+ this.translators.put(t.getName(), t);
}
public boolean isOverideTranslator(String name) {
- return this.translators.getMap().containsKey(name);
+ return this.translators.containsKey(name);
}
@Override
@@ -186,7 +156,7 @@
@Override
public List<String> getValidityErrors(){
List<String> allErrors = new ArrayList<String>();
- for (ModelMetaData model:this.models.getMap().values()) {
+ for (ModelMetaData model:this.models.values()) {
List<ValidationError> errors = model.getErrors();
if (errors != null && !errors.isEmpty()) {
for (ValidationError m:errors) {
@@ -202,7 +172,7 @@
@Override
public List<String> getRuntimeErrors(){
List<String> allErrors = new ArrayList<String>();
- for (ModelMetaData model:this.models.getMap().values()) {
+ for (ModelMetaData model:this.models.values()) {
List<ValidationError> errors = model.getRuntimeErrors();
if (errors != null && !errors.isEmpty()) {
for (ValidationError m:errors) {
@@ -226,7 +196,7 @@
if (getModels().isEmpty()) {
return false;
}
- for(ModelMetaData m: this.models.getMap().values()) {
+ for(ModelMetaData m: this.models.values()) {
if (m.isSource()) {
List<String> resourceNames = m.getSourceNames();
if (resourceNames.isEmpty()) {
@@ -238,7 +208,7 @@
}
public String toString() {
- return getName()+VERSION_DELIM+getVersion()+ models.getMap().values();
+ return getName()+VERSION_DELIM+getVersion()+ models.values();
}
public boolean isVisible(String modelName) {
@@ -247,12 +217,12 @@
}
public ModelMetaData getModel(String modelName) {
- return this.models.getMap().get(modelName);
+ return this.models.get(modelName);
}
public Set<String> getMultiSourceModelNames(){
Set<String> list = new HashSet<String>();
- for(ModelMetaData m: models.getMap().values()) {
+ for(ModelMetaData m: models.values()) {
if (m.isSupportsMultiSourceBindings()) {
list.add(m.getName());
}
@@ -270,7 +240,7 @@
@Override
public List<DataPolicy> getDataPolicies(){
- return new ArrayList<DataPolicy>(this.dataPolicies.getMap().values());
+ return new ArrayList<DataPolicy>(this.dataPolicies.values());
}
/**
@@ -279,22 +249,22 @@
* @param policies
*/
public void setDataPolicies(List<DataPolicy> policies){
- this.dataPolicies.getMap().clear();
+ this.dataPolicies.clear();
for (DataPolicy policy:policies) {
- this.dataPolicies.getMap().put(policy.getName(), (DataPolicyMetadata)policy);
+ this.dataPolicies.put(policy.getName(), (DataPolicyMetadata)policy);
}
}
public DataPolicyMetadata addDataPolicy(DataPolicyMetadata policy){
- return this.dataPolicies.getMap().put(policy.getName(), policy);
+ return this.dataPolicies.put(policy.getName(), policy);
}
public DataPolicyMetadata getDataPolicy(String policyName) {
- return this.dataPolicies.getMap().get(policyName);
+ return this.dataPolicies.get(policyName);
}
public VDBTranslatorMetaData getTranslator(String name) {
- return this.translators.getMap().get(name);
+ return this.translators.get(name);
}
public boolean isPreview() {
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
@@ -68,11 +69,11 @@
node.get(DYNAMIC).set(vdb.isDynamic());
//PROPERTIES
- List<PropertyMetadata> properties = vdb.getJAXBProperties();
+ Properties properties = vdb.getProperties();
if (properties!= null && !properties.isEmpty()) {
- ModelNode propsNode = node.get(PROPERTIES);
- for (PropertyMetadata prop:properties) {
- propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(prop, new ModelNode()));
+ ModelNode propsNode = node.get(PROPERTIES);
+ for (String key:properties.stringPropertyNames()) {
+ propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(key, properties.getProperty(key), new ModelNode()));
}
}
@@ -144,9 +145,9 @@
if (node.get(PROPERTIES).isDefined()) {
List<ModelNode> propNodes = node.get(PROPERTIES).asList();
for (ModelNode propNode:propNodes) {
- PropertyMetadata prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+ String[] prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
if (prop != null) {
- vdb.addProperty(prop.getName(), prop.getValue());
+ vdb.addProperty(prop[0], prop[1]);
}
}
}
@@ -282,11 +283,11 @@
node.get(MODELPATH).set(model.getPath());
}
- List<PropertyMetadata> properties = model.getJAXBProperties();
+ Properties properties = model.getProperties();
if (properties!= null && !properties.isEmpty()) {
ModelNode propsNode = node.get(PROPERTIES);
- for (PropertyMetadata prop:properties) {
- propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(prop, new ModelNode()));
+ for (String key:properties.stringPropertyNames()) {
+ propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(key, properties.getProperty(key), new ModelNode()));
}
}
@@ -339,9 +340,9 @@
if (node.get(PROPERTIES).isDefined()) {
List<ModelNode> propNodes = node.get(PROPERTIES).asList();
for (ModelNode propNode:propNodes) {
- PropertyMetadata prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+ String[] prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
if (prop != null) {
- model.addProperty(prop.getName(), prop.getValue());
+ model.addProperty(prop[0], prop[1]);
}
}
}
@@ -582,11 +583,11 @@
node.get(MODULE_NAME).set(translator.getModuleName());
}
- List<PropertyMetadata> properties = translator.getJAXBProperties();
+ Properties properties = translator.getProperties();
if (properties!= null && !properties.isEmpty()) {
ModelNode propsNode = node.get(PROPERTIES);
- for (PropertyMetadata prop:properties) {
- propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(prop, new ModelNode()));
+ for (String key:properties.stringPropertyNames()) {
+ propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(key, properties.getProperty(key), new ModelNode()));
}
}
wrapDomain(translator, node);
@@ -614,9 +615,9 @@
if (node.get(PROPERTIES).isDefined()) {
List<ModelNode> propNodes = node.get(PROPERTIES).asList();
for (ModelNode propNode:propNodes) {
- PropertyMetadata prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+ String[] prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
if (prop != null) {
- translator.addProperty(prop.getName(), prop.getValue());
+ translator.addProperty(prop[0], prop[1]);
}
}
}
@@ -638,38 +639,35 @@
}
}
+
/**
* Property Metadata mapper
*/
- public static class PropertyMetaDataMapper implements MetadataMapper<PropertyMetadata>{
+ public static class PropertyMetaDataMapper {
private static final String PROPERTY_NAME = "property-name"; //$NON-NLS-1$
private static final String PROPERTY_VALUE = "property-value"; //$NON-NLS-1$
public static PropertyMetaDataMapper INSTANCE = new PropertyMetaDataMapper();
- public ModelNode wrap(PropertyMetadata property, ModelNode node) {
- if (property == null) {
- return null;
- }
-
- node.get(PROPERTY_NAME).set(property.getName());
- node.get(PROPERTY_VALUE).set(property.getValue());
-
+ public ModelNode wrap(String key, String value, ModelNode node) {
+ node.get(PROPERTY_NAME).set(key);
+ node.get(PROPERTY_VALUE).set(value);
return node;
}
- public PropertyMetadata unwrap(ModelNode node) {
+ public String[] unwrap(ModelNode node) {
if(node == null) {
return null;
}
- PropertyMetadata property = new PropertyMetadata();
+ String key = null;
+ String value = null;
if (node.has(PROPERTY_NAME)) {
- property.setName(node.get(PROPERTY_NAME).asString());
+ key = node.get(PROPERTY_NAME).asString();
}
if(node.has(PROPERTY_VALUE)) {
- property.setValue(node.get(PROPERTY_VALUE).asString());
+ value = node.get(PROPERTY_VALUE).asString();
}
- return property;
+ return new String[] {key, value};
}
public ModelNode describe(ModelNode node) {
@@ -688,12 +686,6 @@
private static final String MAPPED_ROLE_NAMES = "mapped-role-names"; //$NON-NLS-1$
private static final String ALLOW_CREATE_TEMP_TABLES = "allow-create-temp-tables"; //$NON-NLS-1$
private static final String ANY_AUTHENTICATED = "any-authenticated"; //$NON-NLS-1$
- private static final String ALLOW_CREATE = "allow-create"; //$NON-NLS-1$
- private static final String ALLOW_READ = "allow-read"; //$NON-NLS-1$
- private static final String ALLOW_UPDATE = "allow-update"; //$NON-NLS-1$
- private static final String ALLOW_DELETE = "allow-delete"; //$NON-NLS-1$
- private static final String ALLOW_EXECUTE = "allow-execute"; //$NON-NLS-1$
- private static final String ALLOW_ALTER= "allow-alter"; //$NON-NLS-1$
private static final String POLICY_DESCRIPTION = "policy-description"; //$NON-NLS-1$
public static DataPolicyMetadataMapper INSTANCE = new DataPolicyMetadataMapper();
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -21,8 +21,6 @@
*/
package org.teiid.adminapi.impl;
-import java.util.List;
-
import org.teiid.adminapi.Translator;
@@ -51,11 +49,6 @@
this.type = type;
}
- @Override
- public List<PropertyMetadata> getJAXBProperties(){
- return super.getJAXBProperties();
- }
-
public String toString() {
return getName();
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -81,13 +81,10 @@
TEIID50047,
TEIID50048,
TEIID50049,
- TEIID50051,
TEIID50054,
TEIID50055,
TEIID50056,
TEIID50057,
- TEIID50062,
- TEIID50063,
TEIID50064,
TEIID50065,
TEIID50066,
@@ -101,7 +98,6 @@
TEIID50076,
TEIID50077,
TEIID50078,
-
TEIID50086,
TEIID50087,
TEIID50088
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -21,9 +21,16 @@
*/
package org.teiid.jboss;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ALLOWED;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEFAULT;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_ONLY;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REPLY_PROPERTIES;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUIRED;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.TYPE;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE_TYPE;
-import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Blob;
@@ -39,8 +46,6 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import javax.xml.stream.XMLStreamException;
-
import org.jboss.as.connector.metadata.xmldescriptors.ConnectorXmlDescriptor;
import org.jboss.as.controller.AbstractWriteAttributeHandler;
import org.jboss.as.controller.OperationContext;
@@ -58,15 +63,24 @@
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.impl.*;
+import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.impl.CacheStatisticsMetadata;
+import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.adminapi.impl.TransactionMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.VDBMetadataMapper;
import org.teiid.adminapi.impl.VDBMetadataMapper.TransactionMetadataMapper;
import org.teiid.adminapi.impl.VDBMetadataMapper.VDBTranslatorMetaDataMapper;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
import org.teiid.client.plan.PlanNode;
import org.teiid.client.util.ResultsFuture;
import org.teiid.core.TeiidComponentException;
import org.teiid.deployers.ExtendedPropertyMetadata;
+import org.teiid.deployers.RuntimeVDB;
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VDBStatusChecker;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
@@ -934,15 +948,14 @@
}
}
-abstract class VDBOperations extends BaseOperationHandler<VDBMetaData>{
- private ObjectSerializer serializer;
+abstract class VDBOperations extends BaseOperationHandler<RuntimeVDB>{
public VDBOperations(String operationName) {
super(operationName);
}
@Override
- public VDBMetaData getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
+ public RuntimeVDB getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
}
@@ -954,11 +967,8 @@
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- ServiceController<?> osSvc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.OBJECT_SERIALIZER);
- this.serializer = ObjectSerializer.class.cast(osSvc.getValue());
-
ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.vdbServiceName(vdbName, vdbVersion));
- return VDBMetaData.class.cast(sc.getValue());
+ return RuntimeVDB.class.cast(sc.getValue());
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -970,16 +980,6 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
}
-
- protected void save(VDBMetaData vdb) throws AdminProcessingException{
- try {
- VDBMetadataParser.marshell(vdb, this.serializer.getVdbXmlOutputStream(vdb));
- } catch (IOException e) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50048, e);
- } catch (XMLStreamException e) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50049, e);
- }
- }
}
class AddDataRole extends VDBOperations {
@@ -989,7 +989,7 @@
}
@Override
- protected void executeOperation(OperationContext context, VDBMetaData vdb, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(OperationContext context, RuntimeVDB vdb, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
}
@@ -1002,10 +1002,7 @@
String mappedRole = operation.get(OperationsConstants.MAPPED_ROLE).asString();
try {
- DataPolicyMetadata policy = VDBService.getPolicy(vdb, policyName);
-
- policy.addMappedRoleName(mappedRole);
- save(vdb);
+ vdb.addDataRole(policyName, mappedRole);
} catch (AdminProcessingException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
@@ -1033,7 +1030,7 @@
}
@Override
- protected void executeOperation(OperationContext context, VDBMetaData vdb, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(OperationContext context, RuntimeVDB vdb, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
}
@@ -1046,10 +1043,7 @@
String mappedRole = operation.get(OperationsConstants.MAPPED_ROLE).asString();
try {
- DataPolicyMetadata policy = VDBService.getPolicy(vdb, policyName);
-
- policy.removeMappedRoleName(mappedRole);
- save(vdb);
+ vdb.remoteDataRole(policyName, mappedRole);
} catch (AdminProcessingException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
@@ -1077,18 +1071,14 @@
}
@Override
- protected void executeOperation(OperationContext context, VDBMetaData vdb, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(OperationContext context, RuntimeVDB vdb, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
}
String policyName = operation.get(OperationsConstants.DATA_ROLE).asString();
-
try {
- DataPolicyMetadata policy = VDBService.getPolicy(vdb, policyName);
-
- policy.setAnyAuthenticated(true);
- save(vdb);
+ vdb.addAnyAuthenticated(policyName);
} catch (AdminProcessingException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
@@ -1113,18 +1103,14 @@
}
@Override
- protected void executeOperation(OperationContext context, VDBMetaData vdb, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(OperationContext context, RuntimeVDB vdb, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
}
String policyName = operation.get(OperationsConstants.DATA_ROLE).asString();
-
try {
- DataPolicyMetadata policy = VDBService.getPolicy(vdb, policyName);
-
- policy.setAnyAuthenticated(false);
- save(vdb);
+ vdb.removeAnyAuthenticated(policyName);
} catch (AdminProcessingException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
@@ -1148,15 +1134,14 @@
}
@Override
- protected void executeOperation(OperationContext context, VDBMetaData vdb, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(OperationContext context, RuntimeVDB vdb, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.CONNECTION_TYPE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CONNECTION_TYPE+MISSING)));
}
String connectionType = operation.get(OperationsConstants.CONNECTION_TYPE).asString();
try {
- vdb.setConnectionType(connectionType);
- save(vdb);
+ vdb.changeConnectionType(ConnectionType.valueOf(connectionType));
} catch (AdminProcessingException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
@@ -1180,7 +1165,7 @@
}
@Override
- protected void executeOperation(OperationContext context, VDBMetaData vdb, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(OperationContext context, RuntimeVDB vdb, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.MODEL_NAME)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.MODEL_NAME+MISSING)));
}
@@ -1204,23 +1189,7 @@
String dsName = operation.get(OperationsConstants.DS_NAME).asString();
try {
- ModelMetaData model = vdb.getModel(modelName);
-
- if (model == null) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50054, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50054, modelName, vdb.getName(), vdb.getVersion()));
- }
-
- SourceMappingMetadata source = model.getSourceMapping(sourceName);
- if(source == null) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50055, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50055, sourceName, modelName, vdb.getName(), vdb.getVersion()));
- }
- source.setTranslatorName(translatorName);
- source.setConnectionJndiName(dsName);
- save(vdb);
- ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_STATUS_CHECKER);
- VDBStatusChecker vsc = VDBStatusChecker.class.cast(sc.getValue());
- // enforce the changes in the engine.
- vsc.dataSourceReplaced(vdb.getName(), vdb.getVersion(), modelName, sourceName, translatorName, dsName);
+ vdb.assignDatasource(modelName, sourceName, translatorName, dsName);
} catch (AdminProcessingException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -55,6 +55,7 @@
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.deployers.RuntimeVDB;
import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VDBStatusChecker;
@@ -160,7 +161,7 @@
// build a VDB service
VDBService vdb = new VDBService(deployment, visibilityMap);
- final ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
+ final ServiceBuilder<RuntimeVDB> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
// add dependencies to data-sources
dataSourceDependencies(deployment, new DependentServices() {
@@ -195,6 +196,8 @@
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(TeiidServiceNames.VDB_STATUS_CHECKER, VDBStatusChecker.class, vdb.vdbStatusCheckInjector);
+
vdbService.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, vdb.objectReplicatorInjector);
vdbService.setInitialMode(Mode.PASSIVE).install();
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -49,8 +49,6 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.VDB.ConnectionType;
-import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -59,15 +57,17 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidException;
import org.teiid.deployers.CompositeVDB;
+import org.teiid.deployers.RuntimeVDB;
import org.teiid.deployers.TranslatorUtil;
import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
+import org.teiid.deployers.VDBStatusChecker;
import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository.ConnectorManagerException;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.Datatype;
@@ -84,14 +84,17 @@
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.TranslatorException;
-class VDBService implements Service<VDBMetaData> {
+class VDBService implements Service<RuntimeVDB> {
private VDBMetaData vdb;
+ private RuntimeVDB runtimeVDB;
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>();
+ protected final InjectedValue<VDBStatusChecker> vdbStatusCheckInjector = new InjectedValue<VDBStatusChecker>();
+
private VDBLifeCycleListener vdbListener;
private LinkedHashMap<String, Resource> visibilityMap;
@@ -101,7 +104,7 @@
}
@Override
- public void start(StartContext context) throws StartException {
+ public void start(final StartContext context) throws StartException {
ConnectorManagerRepository cmr = new ConnectorManagerRepository();
TranslatorRepository repo = new TranslatorRepository();
@@ -189,8 +192,32 @@
LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " skipped being loaded because of its type ", model.getModelType()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
+
+ this.runtimeVDB = buildRuntimeVDB(this.vdb);
}
+ private RuntimeVDB buildRuntimeVDB(VDBMetaData vdbMetadata) {
+ RuntimeVDB.VDBModificationListener modificationListener = new RuntimeVDB.VDBModificationListener() {
+ @Override
+ public void dataRoleChanged(String policyName) throws AdminProcessingException {
+ save();
+ }
+ @Override
+ public void connectionTypeChanged() throws AdminProcessingException {
+ save();
+ }
+ @Override
+ public void dataSourceChanged(String modelName, String sourceName,String translatorName, String dsName) throws AdminProcessingException {
+ save();
+ }
+ };
+ return new RuntimeVDB(vdbMetadata, modificationListener) {
+ protected VDBStatusChecker getVDBStatusChecker() {
+ return VDBService.this.vdbStatusCheckInjector.getValue();
+ }
+ };
+ }
+
private ServiceBuilder<Void> addVDBFinishedService(StartContext context) {
ServiceContainer serviceContainer = context.getController().getServiceContainer();
final ServiceController<?> controller = serviceContainer.getService(TeiidServiceNames.vdbFinishedServiceName(vdb.getName(), vdb.getVersion()));
@@ -237,8 +264,8 @@
}
@Override
- public VDBMetaData getValue() throws IllegalStateException,IllegalArgumentException {
- return this.vdb;
+ public RuntimeVDB getValue() throws IllegalStateException,IllegalArgumentException {
+ return this.runtimeVDB;
}
private void createConnectorManagers(ConnectorManagerRepository cmr, final TranslatorRepository repo, final VDBMetaData deployment) throws StartException {
@@ -440,74 +467,14 @@
return bufferManagerInjector.getValue();
}
- public void addDataRole(String policyName, String mappedRole) throws AdminProcessingException{
- DataPolicyMetadata policy = getPolicy(vdb, policyName);
-
- policy.addMappedRoleName(mappedRole);
- save();
- }
-
- public void remoteDataRole(String policyName, String mappedRole) throws AdminProcessingException{
- DataPolicyMetadata policy = getPolicy(vdb, policyName);
-
- policy.removeMappedRoleName(mappedRole);
- save();
- }
-
- public void addAnyAuthenticated(String policyName) throws AdminProcessingException{
- DataPolicyMetadata policy = getPolicy(vdb, policyName);
-
- policy.setAnyAuthenticated(true);
- save();
- }
-
- public void removeAnyAuthenticated(String policyName) throws AdminProcessingException{
- DataPolicyMetadata policy = getPolicy(vdb, policyName);
-
- policy.setAnyAuthenticated(false);
- save();
- }
-
- public void changeConnectionType(ConnectionType type) throws AdminProcessingException {
- this.vdb.setConnectionType(type);
- save();
- }
-
- public void assignDatasource(String modelName, String sourceName, String translatorName, String dsName) throws AdminProcessingException{
- ModelMetaData model = this.vdb.getModel(modelName);
-
- if (model == null) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50062, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50062, modelName, this.vdb.getName(), this.vdb.getVersion()));
- }
-
- SourceMappingMetadata source = model.getSourceMapping(sourceName);
- if(source == null) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50063, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50063, sourceName, modelName, this.vdb.getName(), this.vdb.getVersion()));
- }
- source.setTranslatorName(translatorName);
- source.setConnectionJndiName(dsName);
- save();
- }
-
- private void save() throws AdminProcessingException{
+ private void save() throws AdminProcessingException {
try {
ObjectSerializer os = getSerializer();
VDBMetadataParser.marshell(this.vdb, os.getVdbXmlOutputStream(this.vdb));
} catch (IOException e) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50064, e);
+ throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50064, e);
} catch (XMLStreamException e) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50065, e);
+ throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50065, e);
}
}
-
- static DataPolicyMetadata getPolicy(VDBMetaData vdb, String policyName)
- throws AdminProcessingException {
- DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
-
- if (policy == null) {
- throw new AdminProcessingException(IntegrationPlugin.Event.TEIID50051, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50051, policyName, vdb.getName(), vdb.getVersion()));
- }
- return policy;
- }
-
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-06-18 14:37:59 UTC (rev 4183)
@@ -28,14 +28,9 @@
TEIID50038=Teiid Embedded transport enabled. Bound to: {0}
TEIID50041=Teiid Embedded transport disabled. Local Connections will fail. UnBound : {0}
TEIID50002=Teiid Engine stopped {0}
-TEIID50062=Model name "{0}" not found in the VDB with name "{1}" version "{2}"
-TEIID50062=Source name "{0}" not found for model {1} in the VDB with name "{2}" version "{3}"
-TEIID50063=Source with name {0} not found in the Model {1} in VDB {2}.{3}
-TEIID50062=Model with name {0} not found in the VDB {1}.{2}
event_distributor_bound=org.teiid.events.EventDistributorFactory is bound to {0} for manual control of Teiid events.
TEIID50019=Re-deploying VDB {0}
TEIID50066=Cache system has been shutdown
-TEIID50051=Policy {0} not found in VDB {1}.{2}
TEIID50054=Model {0} not found in VDB {1}.{2}
TEIID50055=Source name {0} not found in Model {1} in VDB {1}.{2}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -114,7 +114,7 @@
newMergedVDB.setDataPolicies(this.vdb.getDataPolicies());
newMergedVDB.setDescription(this.vdb.getDescription());
newMergedVDB.setStatus(this.vdb.getStatus());
- newMergedVDB.setJAXBProperties(this.vdb.getJAXBProperties());
+ newMergedVDB.setProperties(this.vdb.getProperties());
newMergedVDB.setConnectionType(this.vdb.getConnectionType());
ConnectorManagerRepository mergedRepo = new ConnectorManagerRepository();
mergedRepo.getConnectorManagers().putAll(this.cmr.getConnectorManagers());
Added: trunk/runtime/src/main/java/org/teiid/deployers/RuntimeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/RuntimeVDB.java (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/deployers/RuntimeVDB.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.deployers;
+
+import java.util.List;
+
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.impl.DataPolicyMetadata;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.runtime.RuntimePlugin;
+
+public abstract class RuntimeVDB {
+ private VDBMetaData vdb;
+ private VDBModificationListener listener;
+
+ public interface VDBModificationListener {
+ void dataRoleChanged(String policyName) throws AdminProcessingException;
+ void connectionTypeChanged() throws AdminProcessingException;
+ void dataSourceChanged(String modelName, String sourceName, String translatorName, String dsName) throws AdminProcessingException;
+ }
+
+ public RuntimeVDB(VDBMetaData vdb, VDBModificationListener listener) {
+ this.vdb = vdb;
+ this.listener = listener;
+ }
+
+ public void addDataRole(String policyName, String mappedRole) throws AdminProcessingException {
+ synchronized (this.vdb) {
+ DataPolicyMetadata policy = getPolicy(policyName);
+ List<String> previous = policy.getMappedRoleNames();
+ policy.addMappedRoleName(mappedRole);
+ try {
+ this.listener.dataRoleChanged(policyName);
+ } catch(AdminProcessingException e) {
+ policy.setMappedRoleNames(previous);
+ throw e;
+ }
+ }
+ }
+
+ public void remoteDataRole(String policyName, String mappedRole) throws AdminProcessingException{
+ synchronized (this.vdb) {
+ DataPolicyMetadata policy = getPolicy(policyName);
+ List<String> previous = policy.getMappedRoleNames();
+ policy.removeMappedRoleName(mappedRole);
+ try {
+ this.listener.dataRoleChanged(policyName);
+ } catch(AdminProcessingException e) {
+ policy.setMappedRoleNames(previous);
+ throw e;
+ }
+ }
+ }
+
+ public void addAnyAuthenticated(String policyName) throws AdminProcessingException{
+ synchronized (this.vdb) {
+ DataPolicyMetadata policy = getPolicy(policyName);
+ boolean previous = policy.isAnyAuthenticated();
+ policy.setAnyAuthenticated(true);
+ try {
+ this.listener.dataRoleChanged(policyName);
+ } catch(AdminProcessingException e) {
+ policy.setAnyAuthenticated(previous);
+ throw e;
+ }
+ }
+ }
+
+ public void removeAnyAuthenticated(String policyName) throws AdminProcessingException{
+ synchronized (this.vdb) {
+ DataPolicyMetadata policy = getPolicy(policyName);
+ boolean previous = policy.isAnyAuthenticated();
+ policy.setAnyAuthenticated(false);
+ try {
+ this.listener.dataRoleChanged(policyName);
+ } catch(AdminProcessingException e) {
+ policy.setAnyAuthenticated(previous);
+ throw e;
+ }
+ }
+ }
+
+ public void changeConnectionType(ConnectionType type) throws AdminProcessingException {
+ synchronized (this.vdb) {
+ ConnectionType previous = this.vdb.getConnectionType();
+ this.vdb.setConnectionType(type);
+ try {
+ this.listener.connectionTypeChanged();
+ } catch(AdminProcessingException e) {
+ this.vdb.setConnectionType(previous);
+ throw e;
+ }
+ }
+ }
+
+ public void assignDatasource(String modelName, String sourceName, String translatorName, String dsName) throws AdminProcessingException{
+ synchronized (this.vdb) {
+ ModelMetaData model = this.vdb.getModel(modelName);
+
+ if (model == null) {
+ throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, this.vdb.getName(), this.vdb.getVersion()));
+ }
+
+ SourceMappingMetadata source = model.getSourceMapping(sourceName);
+ if(source == null) {
+ throw new AdminProcessingException(RuntimePlugin.Event.TEIID40091, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40091, sourceName, modelName, this.vdb.getName(), this.vdb.getVersion()));
+ }
+
+ String previousTranslatorName = source.getTranslatorName();
+ String previousDsName = source.getConnectionJndiName();
+
+ source.setTranslatorName(translatorName);
+ source.setConnectionJndiName(dsName);
+
+ try {
+ this.listener.dataSourceChanged(modelName, sourceName, translatorName, dsName);
+ getVDBStatusChecker().dataSourceReplaced(vdb.getName(), vdb.getVersion(), modelName, sourceName, translatorName, dsName);
+ } catch(AdminProcessingException e) {
+ source.setTranslatorName(previousTranslatorName);
+ source.setConnectionJndiName(previousDsName);
+ throw e;
+ }
+ }
+ }
+
+ private DataPolicyMetadata getPolicy(String policyName)
+ throws AdminProcessingException {
+ DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
+
+ if (policy == null) {
+ throw new AdminProcessingException(RuntimePlugin.Event.TEIID40092, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40092, policyName, vdb.getName(), vdb.getVersion()));
+ }
+ return policy;
+ }
+
+ protected abstract VDBStatusChecker getVDBStatusChecker();
+}
Property changes on: trunk/runtime/src/main/java/org/teiid/deployers/RuntimeVDB.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-06-18 14:37:59 UTC (rev 4183)
@@ -102,5 +102,8 @@
TEIID40087, //pass-through failed
TEIID40088, //event distributor replication failed
TEIID40089, //txn disabled
+ TEIID40090,
+ TEIID40091,
+ TEIID40092
}
}
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-06-15 17:53:09 UTC (rev 4182)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-06-18 14:37:59 UTC (rev 4183)
@@ -91,4 +91,7 @@
TEIID40087=Passthrough authentication failed. No authentication information found.
TEIID40088=Could not replicate object {0}
-TEIID40089=No transaction manager set, transaction support is not enabled.
\ No newline at end of file
+TEIID40089=No transaction manager set, transaction support is not enabled.
+TEIID40090=Model name "{0}" not found in the VDB with name "{1}" version "{2}"
+TEIID40091=Source name "{0}" not found for model {1} in the VDB with name "{2}" version "{3}"
+TEIID40092=Policy {0} not found in VDB {1}.{2}
12 years, 6 months
teiid SVN: r4182 - in trunk/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-06-15 13:53:09 -0400 (Fri, 15 Jun 2012)
New Revision: 4182
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
Log:
TEIID-2074 fix for npe with dep join processing
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java 2012-06-15 13:43:29 UTC (rev 4181)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java 2012-06-15 17:53:09 UTC (rev 4182)
@@ -28,6 +28,7 @@
import org.teiid.common.buffer.BlockedException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.query.QueryPlugin;
@@ -100,18 +101,43 @@
setState.valueIterator = dvs.getValueIterator(setState.valueExpression);
int distinctCount = dvs.getTupleBuffer().getRowCount();
if (setState.maxNdv > 0 && setState.maxNdv < distinctCount) {
- if (dvs.getTupleBuffer().getSchema().size() >= 1) {
+ if (dvs.getTupleBuffer().getSchema().size() > 1) {
distinctCount = 0;
ValueIterator vi = dvs.getValueIterator(setState.valueExpression);
- Object last = null;
- distinctCount = 0;
- while (vi.hasNext()) {
- Object next = vi.next();
- if (last == null || Constant.COMPARATOR.compare(next, last) != 0) {
- distinctCount++;
- }
- last = next;
- }
+ if (dvs.getTupleBuffer().getSchema().indexOf(setState.valueExpression) == 0) {
+ Object last = null;
+ while (vi.hasNext()) {
+ Object next = vi.next();
+ if (next != null && (last == null || Constant.COMPARATOR.compare(next, last) != 0)) {
+ distinctCount++;
+ }
+ last = next;
+ }
+ } else {
+ //secondary attributes are not in sorted order, so we use an approximate count
+ Set<Object> set = null;
+ int maxSize = Math.min(10000, dvs.getTupleBuffer().getRowCount());
+ List<Object> buffer = Arrays.asList(new Object[maxSize]);
+ if (!DataTypeManager.isHashable(setState.valueExpression.getType())) {
+ set = new TreeSet<Object>(Constant.COMPARATOR);
+ } else {
+ set = new HashSet<Object>();
+ }
+ int i = 0;
+ while (vi.hasNext()) {
+ Object next = vi.next();
+ if (next == null) {
+ continue;
+ }
+ if (set.add(next)) {
+ distinctCount++;
+ }
+ Object old = buffer.set(i++%maxSize, next);
+ if (set.size() > maxSize) {
+ set.remove(old);
+ }
+ }
+ }
}
if (!setState.overMax && distinctCount > setState.maxNdv) {
LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30011, valueSource, setState.valueExpression, setState.maxNdv));
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java 2012-06-15 13:43:29 UTC (rev 4181)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java 2012-06-15 17:53:09 UTC (rev 4182)
@@ -34,6 +34,7 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.Assertion;
+import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.util.ValueIterator;
import org.teiid.query.sql.util.ValueIteratorSource;
@@ -89,7 +90,7 @@
Assertion.assertTrue(index != -1);
Class<?> type = ((Expression)buffer.getSchema().get(index)).getType();
if (!DataTypeManager.isHashable(type)) {
- result = new TreeSet<Object>();
+ result = new TreeSet<Object>(Constant.COMPARATOR);
} else {
result = new HashSet<Object>();
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-06-15 13:43:29 UTC (rev 4181)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-06-15 17:53:09 UTC (rev 4182)
@@ -569,15 +569,16 @@
dataMgr.registerTuples(
metadata,
"pm1.g1", new List[] {
- Arrays.asList(new Object[] { "a", 0, Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", 1, Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "a", 0, Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "q", null, Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", 1, Boolean.TRUE, null }), //$NON-NLS-1$
Arrays.asList(new Object[] { "c", 2, Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
} );
dataMgr.registerTuples(
metadata,
"pm6.g1", new List[] {
- Arrays.asList(new Object[] { "b", 0 }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", 1 }), //$NON-NLS-1$
Arrays.asList(new Object[] { "d", 3 }), //$NON-NLS-1$
Arrays.asList(new Object[] { "e", 1 }), //$NON-NLS-1$
} );
@@ -840,7 +841,7 @@
FakeDataManager dataManager = helpTestBackoff(true);
//note that the dependent join was not actually performed
- assertEquals(new HashSet<String>(Arrays.asList("SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm6.g1.e1 FROM pm6.g1 ORDER BY pm6.g1.e1")),
+ assertEquals(new HashSet<String>(Arrays.asList("SELECT pm6.g1.e1, pm6.g1.e2 FROM pm6.g1 ORDER BY pm6.g1.e1, pm6.g1.e2", "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1")),
new HashSet<String>(dataManager.getQueries()));
}
@@ -895,7 +896,7 @@
QueryMetadataException, TeiidComponentException,
TeiidProcessingException {
// Create query
- String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm6.g1 WHERE pm1.g1.e1=pm6.g1.e1"; //$NON-NLS-1$
+ String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm6.g1 WHERE pm1.g1.e1=pm6.g1.e1 and pm1.g1.e2=pm6.g1.e2"; //$NON-NLS-1$
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
@@ -906,10 +907,12 @@
RealMetadataFactory.setCardinality("pm1.g1", 1, fakeMetadata);
if (setNdv) {
fakeMetadata.getElementID("pm1.g1.e1").setDistinctValues(1);
+ fakeMetadata.getElementID("pm1.g1.e2").setDistinctValues(1);
}
RealMetadataFactory.setCardinality("pm6.g1", 1000, fakeMetadata);
if (setNdv) {
fakeMetadata.getElementID("pm6.g1.e1").setDistinctValues(1000);
+ fakeMetadata.getElementID("pm6.g1.e2").setDistinctValues(1000);
}
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -929,8 +932,8 @@
new String("b")})}; //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql, fakeMetadata, new String[] {
- "SELECT pm6.g1.e1 FROM pm6.g1 WHERE pm6.g1.e1 IN (<dependent values>) ORDER BY pm6.g1.e1",
- "SELECT pm1.g1.e1 FROM pm1.g1"
+ "SELECT pm6.g1.e1, pm6.g1.e2 FROM pm6.g1 WHERE (pm6.g1.e1 IN (<dependent values>)) AND (pm6.g1.e2 IN (<dependent values>)) ORDER BY pm6.g1.e1, pm6.g1.e2",
+ "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"
}, capFinder, ComparisonMode.EXACT_COMMAND_STRING);
// Run query
12 years, 6 months
teiid SVN: r4181 - trunk/engine/src/main/java/org/teiid/query/validator.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-06-15 09:43:29 -0400 (Fri, 15 Jun 2012)
New Revision: 4181
Modified:
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
Log:
TEIID-2022: fixing the message
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2012-06-15 11:45:16 UTC (rev 4180)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2012-06-15 13:43:29 UTC (rev 4181)
@@ -713,7 +713,7 @@
if (info != null && info.isInherentUpdate()) {
Set<ElementSymbol> updateCols = update.getChangeList().getClauseMap().keySet();
if (!info.hasValidUpdateMapping(updateCols)) {
- handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.nonUpdatable", updateCols), update); //$NON-NLS-1$
+ handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30376, updateCols), update);
}
}
} catch(TeiidException e) {
12 years, 6 months
teiid SVN: r4180 - in trunk: engine/src/main/java/org/teiid/query/util and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-06-15 07:45:16 -0400 (Fri, 15 Jun 2012)
New Revision: 4180
Modified:
trunk/api/src/main/java/org/teiid/CommandContext.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
Log:
TEIID-2073 adding a public call to add warnings via the commandcontext
Modified: trunk/api/src/main/java/org/teiid/CommandContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/CommandContext.java 2012-06-15 02:39:19 UTC (rev 4179)
+++ trunk/api/src/main/java/org/teiid/CommandContext.java 2012-06-15 11:45:16 UTC (rev 4180)
@@ -23,6 +23,7 @@
package org.teiid;
import java.io.Serializable;
+import java.sql.Statement;
import java.util.Map;
import java.util.TimeZone;
@@ -31,6 +32,7 @@
import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Session;
import org.teiid.adminapi.VDB;
+import org.teiid.jdbc.TeiidSQLWarning;
/**
* Context information for the currently executing command.
@@ -156,5 +158,12 @@
* @return
*/
ClassLoader getVDBClassLoader();
+
+ /**
+ * Add an exception as a warning. The exception will be wrapped by a {@link TeiidSQLWarning} for the client.
+ * The warnings can be consumed through the {@link Statement#getWarnings()} method.
+ * @param ex
+ */
+ void addWarning(Exception ex);
}
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-06-15 02:39:19 UTC (rev 4179)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-06-15 11:45:16 UTC (rev 4180)
@@ -39,7 +39,6 @@
import org.teiid.api.exception.query.QueryProcessingException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
import org.teiid.core.util.ArgCheck;
import org.teiid.core.util.ExecutorUtils;
import org.teiid.core.util.LRUCache;
@@ -773,17 +772,24 @@
if (globalState.warnings == null) {
return null;
}
- List<Exception> copied = globalState.warnings;
- globalState.warnings = null;
- return copied;
+ synchronized (this.globalState) {
+ List<Exception> copied = globalState.warnings;
+ globalState.warnings = null;
+ return copied;
+ }
}
- public void addWarning(TeiidException warning) {
- if (globalState.warnings == null) {
- globalState.warnings = new ArrayList<Exception>(1);
- }
+ public void addWarning(Exception warning) {
+ if (warning == null) {
+ return;
+ }
+ synchronized (this.globalState) {
+ if (globalState.warnings == null) {
+ globalState.warnings = new ArrayList<Exception>(1);
+ }
+ globalState.warnings.add(warning);
+ }
LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31105, warning.getMessage()));
- globalState.warnings.add(warning);
}
}
12 years, 6 months
teiid SVN: r4179 - in trunk/engine/src: main/java/org/teiid/query/optimizer/xml and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-06-14 22:39:19 -0400 (Thu, 14 Jun 2012)
New Revision: 4179
Modified:
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java
trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java
trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/RecurseProgramCondition.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/query/processor/FakeProcessorPlan.java
trunk/engine/src/test/java/org/teiid/query/processor/TestBaseProcessorPlan.java
trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java
trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
Log:
TEIID-2073 TEIID-2068 stopping short of implementing the full recursion record feature, but moving the plan warning logic onto the CommandContext for ease of use.
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -524,5 +524,7 @@
TEIID31101,
TEIID31102,
TEIID31103,
+ TEIID31104, //recursion limit hit
+ TEIID31105, //warning
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -132,7 +132,7 @@
Program programPlan = XMLPlanToProcessVisitor.planProgram(planEnv.mappingDoc, planEnv);
// create plan from program and initialized environment
- XMLProcessorEnvironment env = planEnv.createProcessorEnvironment(programPlan);
+ XMLProcessorEnvironment env = new XMLProcessorEnvironment(programPlan, planEnv.documentGroup);
XMLPlan plan = new XMLPlan(env);
plan.setXMLSchemas(metadata.getXMLSchemas(group.getMetadataID()));
if(debug) {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -35,8 +35,6 @@
import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
-import org.teiid.query.processor.xml.Program;
-import org.teiid.query.processor.xml.XMLProcessorEnvironment;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.symbol.Symbol;
@@ -110,14 +108,6 @@
this.metadata = qmi;
}
- XMLProcessorEnvironment createProcessorEnvironment(Program mainProgram) {
- XMLProcessorEnvironment processorEnv = new XMLProcessorEnvironment(mainProgram);
-
- processorEnv.setDocumentGroup(documentGroup);
- return processorEnv;
- }
-
-
TempMetadataAdapter getGlobalMetadata() {
return new TempMetadataAdapter(metadata, this.globalTempMetadata, this.stagingTableMap, this.queryNodeMap);
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -24,7 +24,6 @@
import static org.teiid.query.analysis.AnalysisRecord.*;
-import java.util.ArrayList;
import java.util.List;
import org.teiid.client.plan.PlanNode;
@@ -55,8 +54,6 @@
*/
public abstract class ProcessorPlan implements Cloneable, BatchProducer {
- private List<Exception> warnings = null;
-
private CommandContext context;
/**
@@ -69,36 +66,20 @@
* @param dataMgr Data manager reference
* @param bufferMgr Buffer manager reference
*/
- public abstract void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr);
+ public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {
+ this.context = context;
+ }
+ public void addWarning(TeiidException warning) {
+ if (context != null) {
+ context.addWarning(warning);
+ }
+ }
+
/**
- * Get all warnings found while processing this plan. These warnings may
- * be detected throughout the plan lifetime, which means new ones may arrive
- * at any time. This method returns all current warnings and clears
- * the current warnings list. The warnings are in order they were detected.
- * @return Current list of warnings, never null
- */
- public List<Exception> getAndClearWarnings() {
- if (warnings == null) {
- return null;
- }
- List<Exception> copied = warnings;
- warnings = null;
- return copied;
- }
-
- protected void addWarning(TeiidException warning) {
- if (warnings == null) {
- warnings = new ArrayList<Exception>(1);
- }
- warnings.add(warning);
- }
-
- /**
* Reset a plan so that it can be processed again.
*/
public void reset() {
- this.warnings = null;
}
/**
Modified: trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -226,7 +226,7 @@
}
public List<Exception> getAndClearWarnings() {
- return this.processPlan.getAndClearWarnings();
+ return this.context.getAndClearWarnings();
}
/**
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/RecurseProgramCondition.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/RecurseProgramCondition.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/RecurseProgramCondition.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -27,6 +27,8 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
import org.teiid.query.QueryPlugin;
import org.teiid.query.sql.lang.Criteria;
@@ -91,8 +93,13 @@
terminate = env.getProgramRecursionCount(this.getThenProgram()) >= this.recursionLimit;
//handle the case of exception on recursion limit reached
- if (terminate && this.exceptionOnRecursionLimit){
- throw new TeiidComponentException(QueryPlugin.Event.TEIID30212, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30212));
+ if (terminate){
+ if (this.exceptionOnRecursionLimit) {
+ throw new TeiidComponentException(QueryPlugin.Event.TEIID30212, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30212));
+ }
+ //TODO: if record, then add a log/warning
+ //env.getProcessorContext().addWarning(new TeiidException(QueryPlugin.Event.TEIID31104, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31104, recursionLimit)));
+ LogManager.logDetail(LogConstants.CTX_XML_PLAN, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31104, recursionLimit));
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -123,9 +123,9 @@
super.reset();
nextBatchCount = 1;
+ this.context = new XMLContext();
+ this.env = this.env.clone();
- this.env = (XMLProcessorEnvironment)this.env.clone();
-
LogManager.logTrace(LogConstants.CTX_XML_PLAN, "XMLPlan reset"); //$NON-NLS-1$
}
@@ -213,9 +213,7 @@
}
/**
- * Validate the document against the Apache Xerces parser
- * The constants in the code are specific to the Apache Xerces parser and must be used
- * Known limitiation is when it is attempted to validate against multiple schemas
+ * Validate the document against
* @param xmlDoc
* @throws TeiidComponentException if the document cannot be validated against the schema
*
@@ -282,9 +280,9 @@
// determine if we have any warnings, errors, or fatal errors and report as necessary
if (errorHandler.hasExceptions()) {
- List exceptionList = errorHandler.getExceptionList();
- for (Iterator i = exceptionList.iterator(); i.hasNext();) {
- addWarning((TeiidException)i.next());
+ List<TeiidException> exceptionList = errorHandler.getExceptionList();
+ for (Iterator<TeiidException> i = exceptionList.iterator(); i.hasNext();) {
+ addWarning(i.next());
}
}
}
@@ -455,7 +453,7 @@
* meaning the plan has finished processing.
*/
public XMLPlan clone(){
- XMLPlan xmlPlan = new XMLPlan((XMLProcessorEnvironment)this.env.clone());
+ XMLPlan xmlPlan = new XMLPlan(this.env.clone());
xmlPlan.xmlSchemas = this.xmlSchemas;
return xmlPlan;
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -65,8 +65,9 @@
protected XMLProcessorEnvironment(){
}
- public XMLProcessorEnvironment(Program mainProgram){
+ public XMLProcessorEnvironment(Program mainProgram, GroupSymbol docGroup){
pushProgram(mainProgram);
+ this.documentGroup = docGroup;
}
/**
@@ -262,7 +263,7 @@
return this.commandContext;
}
- public Object clone() {
+ public XMLProcessorEnvironment clone() {
XMLProcessorEnvironment clone = new XMLProcessorEnvironment();
copyIntoClone(clone);
return clone;
@@ -288,11 +289,6 @@
return this.documentGroup;
}
- public void setDocumentGroup(GroupSymbol documentGroup) {
- this.documentGroup = documentGroup;
- }
-
-
boolean isStagingTableLoaded(String tableName) {
return this.loadedStagingTables.contains(tableName);
}
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -25,15 +25,7 @@
import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.TimeZone;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicLong;
@@ -47,6 +39,7 @@
import org.teiid.api.exception.query.QueryProcessingException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.util.ArgCheck;
import org.teiid.core.util.ExecutorUtils;
import org.teiid.core.util.LRUCache;
@@ -151,6 +144,8 @@
private LRUCache<String, SimpleDateFormat> dateFormatCache;
private AtomicLong reuseCount = new AtomicLong();
private ClassLoader classLoader;
+
+ private List<Exception> warnings = null;
}
private GlobalState globalState = new GlobalState();
@@ -766,4 +761,29 @@
public void setVDBClassLoader(ClassLoader classLoader) {
this.globalState.classLoader = classLoader;
}
+
+ /**
+ * Get all warnings found while processing this plan. These warnings may
+ * be detected throughout the plan lifetime, which means new ones may arrive
+ * at any time. This method returns all current warnings and clears
+ * the current warnings list. The warnings are in order they were detected.
+ * @return Current list of warnings, never null
+ */
+ public List<Exception> getAndClearWarnings() {
+ if (globalState.warnings == null) {
+ return null;
+ }
+ List<Exception> copied = globalState.warnings;
+ globalState.warnings = null;
+ return copied;
+ }
+
+ public void addWarning(TeiidException warning) {
+ if (globalState.warnings == null) {
+ globalState.warnings = new ArrayList<Exception>(1);
+ }
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31105, warning.getMessage()));
+ globalState.warnings.add(warning);
+ }
+
}
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-06-15 02:39:19 UTC (rev 4179)
@@ -1023,3 +1023,6 @@
TEIID31101=Source names are not unique for model {0} in {1}.{2}
TEIID31102=Multiple sources on non multi-source model {0} in {1}.{2}
TEIID31103=There are different sources with the name {0} in {1}.{2}
+
+TEIID31104=Recursion limit of {0} reached.
+TEIID31105=Returing warning to client: {0}
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeProcessorPlan.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeProcessorPlan.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeProcessorPlan.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -29,11 +29,9 @@
import java.util.List;
import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.util.CommandContext;
/**
@@ -80,17 +78,6 @@
}
/**
- * @see org.teiid.query.processor.ProcessorPlan#initialize(org.teiid.query.processor.ProcessorDataManager, java.lang.Object, org.teiid.common.buffer.BufferManager, java.lang.String, int)
- */
- public void initialize(
- CommandContext context,
- ProcessorDataManager dataMgr,
- BufferManager bufferMgr) {
-
- // nothing
- }
-
- /**
* @see org.teiid.query.processor.ProcessorPlan#getOutputElements()
*/
public List getOutputElements() {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestBaseProcessorPlan.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestBaseProcessorPlan.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestBaseProcessorPlan.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -22,28 +22,28 @@
package org.teiid.query.processor;
+import static org.junit.Assert.*;
+
import java.util.Collections;
import java.util.List;
+import org.junit.Test;
import org.teiid.core.TeiidException;
+import org.teiid.query.util.CommandContext;
-import junit.framework.TestCase;
+public class TestBaseProcessorPlan {
-public class TestBaseProcessorPlan extends TestCase {
-
- public TestBaseProcessorPlan(String name) {
- super(name);
- }
-
- public void testGetAndClearWarnings() {
+ @Test public void testGetAndClearWarnings() {
FakeProcessorPlan plan = new FakeProcessorPlan(Collections.emptyList(), Collections.emptyList());
+ CommandContext cc = new CommandContext();
+ plan.initialize(cc, null, null);
TeiidException warning = new TeiidException("test"); //$NON-NLS-1$
plan.addWarning(warning);
- List warnings = plan.getAndClearWarnings();
+ List<Exception> warnings = cc.getAndClearWarnings();
assertEquals("Did not get expected number of warnings", 1, warnings.size()); //$NON-NLS-1$
assertEquals("Did not get expected warning", warning, warnings.get(0)); //$NON-NLS-1$
- assertNull("Did not clear warnings from plan", plan.getAndClearWarnings()); //$NON-NLS-1$
+ assertNull("Did not clear warnings from plan", cc.getAndClearWarnings()); //$NON-NLS-1$
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -53,7 +53,8 @@
/**
* @see ProcessorEnvironment#clone()
*/
- public Object clone() {
+ @Override
+ public FakeXMLProcessorEnvironment clone() {
FakeXMLProcessorEnvironment clone = new FakeXMLProcessorEnvironment();
super.copyIntoClone(clone);
clone.dataMap = this.dataMap;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java 2012-06-14 17:20:06 UTC (rev 4178)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java 2012-06-15 02:39:19 UTC (rev 4179)
@@ -5719,10 +5719,9 @@
* termination criteria - should the chunk of document that meets the
* criteria be included or not? In this test below, it is expected to
* be included, but is not included in actual results due to recent
- * changes for Booz Allen POC. I could see it going either way.
+ * changes. I could see it going either way.
*
- * sbale 4/27/05 I have changed expected results as a result of changes for
- * Booz Allen POC. Previously, the recursive fragment of the document that
+ * sbale 4/27/05 Previously, the recursive fragment of the document that
* satisfied the recursion termination criteria was included, now it is not.
* See commented out section below for previous expected results.
* @throws Exception
@@ -5905,8 +5904,7 @@
}
/**
- * sbale 4/27/05 I have changed expected results as a result of changes for
- * Booz Allen POC. Previously, the recursive fragment of the document that
+ * sbale 4/27/05. Previously, the recursive fragment of the document that
* satisfied the recursion termination criteria was included, now it is not.
* See commented out section below for previous expected results.
* @throws Exception
12 years, 6 months
teiid SVN: r4178 - in trunk: admin/src/main/java/org/teiid/adminapi/impl and 1 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-06-14 13:20:06 -0400 (Thu, 14 Jun 2012)
New Revision: 4178
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
Log:
TEIID-2057: weeding out the runtime errors from the validation errors to avoid any ephemeral errors that could be introduced for vdb persistent state.
Modified: trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-06-13 13:57:08 UTC (rev 4177)
+++ trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-06-14 17:20:06 UTC (rev 4178)
@@ -92,6 +92,12 @@
public List<String> getValidityErrors();
/**
+ * Shows any validity errors present in the VDB
+ * @return
+ */
+ public List<String> getRuntimeErrors();
+
+ /**
* Shows if VDB is a valid entity
* @return
*/
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-06-13 13:57:08 UTC (rev 4177)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-06-14 17:20:06 UTC (rev 4178)
@@ -51,7 +51,8 @@
protected String description;
protected String path;
protected Boolean visible = true;
- protected List<ValidationError> errors;
+ protected List<ValidationError> validationErrors;
+ protected transient List<ValidationError> runtimeErrors;
protected String schemaSourceType;
protected String schemaText;
@@ -185,16 +186,12 @@
return getValidationErrors(Severity.ERROR);
}
- public void setErrors(List<ValidationError> errors){
- this.errors = errors;
- }
-
public synchronized List<ValidationError> getValidationErrors(ValidationError.Severity severity){
- if (this.errors == null) {
+ if (this.validationErrors == null) {
return Collections.emptyList();
}
List<ValidationError> list = new ArrayList<ValidationError>();
- for (ValidationError ve: this.errors) {
+ for (ValidationError ve: this.validationErrors) {
if (Severity.valueOf(ve.severity) == severity) {
list.add(ve);
}
@@ -203,39 +200,60 @@
}
public synchronized ValidationError addError(String severity, String message) {
- if (this.errors == null) {
- this.errors = new LinkedList<ValidationError>();
+ if (this.validationErrors == null) {
+ this.validationErrors = new LinkedList<ValidationError>();
}
ValidationError ve = new ValidationError(severity, message);
- this.errors.add(ve);
- if (this.errors.size() > DEFAULT_ERROR_HISTORY) {
- this.errors.remove(0);
+ this.validationErrors.add(ve);
+ if (this.validationErrors.size() > DEFAULT_ERROR_HISTORY) {
+ this.validationErrors.remove(0);
}
return ve;
}
+ public List<ValidationError> getRuntimeErrors(){
+ if (this.runtimeErrors == null) {
+ return Collections.emptyList();
+ }
+ List<ValidationError> list = new ArrayList<ValidationError>();
+ for (ValidationError ve: this.runtimeErrors) {
+ if (Severity.valueOf(ve.severity) == Severity.ERROR) {
+ list.add(ve);
+ }
+ }
+ return list;
+ }
+
+ public synchronized ValidationError addRuntimeError(String severity, String message) {
+ if (this.runtimeErrors == null) {
+ this.runtimeErrors = new LinkedList<ValidationError>();
+ }
+ ValidationError ve = new ValidationError(severity, message);
+ this.runtimeErrors.add(ve);
+ if (this.runtimeErrors.size() > DEFAULT_ERROR_HISTORY) {
+ this.runtimeErrors.remove(0);
+ }
+ return ve;
+ }
+
public synchronized ValidationError addError(ValidationError ve) {
- if (this.errors == null) {
- this.errors = new LinkedList<ValidationError>();
+ if (this.validationErrors == null) {
+ this.validationErrors = new LinkedList<ValidationError>();
}
- this.errors.add(ve);
- if (this.errors.size() > DEFAULT_ERROR_HISTORY) {
- this.errors.remove(0);
+ this.validationErrors.add(ve);
+ if (this.validationErrors.size() > DEFAULT_ERROR_HISTORY) {
+ this.validationErrors.remove(0);
}
return ve;
}
-
- public synchronized boolean removeError(ValidationError remove) {
- if (this.errors == null) {
- return false;
- }
- return this.errors.remove(remove);
+ public synchronized void clearErrors() {
+ this.validationErrors.clear();
}
- public synchronized void clearErrors() {
- this.errors.clear();
- }
+ public synchronized void clearRuntimeErrors() {
+ this.runtimeErrors.clear();
+ }
public static class ValidationError implements Serializable{
private static final long serialVersionUID = 2044197069467559527L;
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-06-13 13:57:08 UTC (rev 4177)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-06-14 17:20:06 UTC (rev 4178)
@@ -198,12 +198,31 @@
}
return allErrors;
}
+
+ @Override
+ public List<String> getRuntimeErrors(){
+ List<String> allErrors = new ArrayList<String>();
+ for (ModelMetaData model:this.models.getMap().values()) {
+ List<ValidationError> errors = model.getRuntimeErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ValidationError m:errors) {
+ if (ValidationError.Severity.valueOf(m.getSeverity()).equals(ValidationError.Severity.ERROR)) {
+ allErrors.add(m.getValue());
+ }
+ }
+ }
+ }
+ return allErrors;
+ }
@Override
public boolean isValid() {
if (!getValidityErrors().isEmpty()) {
return false;
}
+ if (!getRuntimeErrors().isEmpty()) {
+ return false;
+ }
if (getModels().isEmpty()) {
return false;
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-06-13 13:57:08 UTC (rev 4177)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-06-14 17:20:06 UTC (rev 4178)
@@ -314,7 +314,7 @@
if (cm != null) {
String msg = cm.getStausMessage();
if (msg != null && msg.length() > 0) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
+ model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-06-13 13:57:08 UTC (rev 4177)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-06-14 17:20:06 UTC (rev 4178)
@@ -86,7 +86,7 @@
if (!cm.getConnectionName().equals(dsName)){
markInvalid(vdb);
String msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40076, vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName), dsName);
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
cm = new ConnectorManager(translatorName, dsName);
cm.setExecutionFactory(ef);
cmr.addConnectorManager(sourceName, cm);
@@ -137,7 +137,7 @@
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (model.getErrors().isEmpty()) {
+ if (model.getRuntimeErrors().isEmpty()) {
continue;
}
@@ -149,7 +149,7 @@
ConnectorManager cm = cmr.getConnectorManager(sourceName);
String status = cm.getStausMessage();
if (status != null && status.length() > 0) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
+ model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
} else {
//get the pending metadata load
@@ -157,14 +157,14 @@
if (r != null) {
runnables.add(r);
} else {
- model.clearErrors();
+ model.clearRuntimeErrors();
}
}
}
boolean valid = true;
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (!model.getErrors().isEmpty()) {
+ if (!model.getRuntimeErrors().isEmpty()) {
valid = false;
break;
}
@@ -203,7 +203,7 @@
else {
msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40012, vdb.getName(), vdb.getVersion(), resourceName);
}
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ model.addRuntimeError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion(), vdb.getStatus()));
}
12 years, 6 months
teiid SVN: r4177 - in trunk: client/src/main/java/org/teiid/client/security and 19 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-06-13 09:57:08 -0400 (Wed, 13 Jun 2012)
New Revision: 4177
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java
trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
trunk/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java
trunk/client/src/main/java/org/teiid/client/security/LogonException.java
trunk/client/src/main/java/org/teiid/jdbc/JDBCPlugin.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
trunk/common-core/src/main/java/org/teiid/core/types/TransformationException.java
trunk/engine/src/main/java/org/teiid/api/exception/query/ExpressionEvaluationException.java
trunk/engine/src/main/java/org/teiid/api/exception/query/FunctionExecutionException.java
trunk/engine/src/main/java/org/teiid/api/exception/query/QueryPlannerException.java
trunk/engine/src/main/java/org/teiid/api/exception/query/QueryProcessingException.java
trunk/engine/src/main/java/org/teiid/api/exception/query/QueryResolverException.java
trunk/engine/src/main/java/org/teiid/api/exception/query/QueryValidatorException.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
trunk/engine/src/main/java/org/teiid/query/function/source/SecuritySystemFunctions.java
trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java
trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/TupleSourceValueIterator.java
trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
Log:
TEIID-2022: Removing the duplicate eventid from the exceptions. Carry the original exception's eventid.
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -66,7 +66,7 @@
}
AdminException(Throwable cause) {
- this(cause.getMessage(), cause);
+ super(cause);
}
/**
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -339,7 +339,7 @@
driverList.addAll(drivers);
}
} catch (Exception e) {
- throw new AdminProcessingException(e.getMessage(), e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70052, e);
}
}
else {
@@ -442,7 +442,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70006, Util.getFailureDescription(outcome));
}
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70007, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70007, e);
}
}
@@ -512,7 +512,7 @@
return false;
}
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70009, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70009, e);
}
return true;
}
@@ -523,7 +523,7 @@
try {
request = buildUndeployRequest(deployedName);
} catch (OperationFormatException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70010, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70010, e);
}
execute(request);
}
@@ -614,9 +614,9 @@
}
return composite;
} catch (OperationFormatException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70011, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70011, e);
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70011, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70011, e);
}
}
@@ -629,7 +629,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.CacheStatisticsMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70013, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70013, e);
}
return null;
}
@@ -647,7 +647,7 @@
return Util.getList(outcome);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70014, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70014, e);
}
return Collections.emptyList();
}
@@ -660,7 +660,7 @@
return Util.getList(outcome);
}
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70015, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70015, e);
}
return Collections.emptyList();
@@ -772,7 +772,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.WorkerPoolStatisticsMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70020, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70020, e);
}
}
return null;
@@ -791,7 +791,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70021, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70022, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70022, e);
}
}
@@ -805,7 +805,7 @@
return getDomainAwareList(outcome, RequestMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70023, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70023, e);
}
}
return Collections.emptyList();
@@ -821,7 +821,7 @@
return getDomainAwareList(outcome, RequestMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70024, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70024, e);
}
}
return Collections.emptyList();
@@ -837,7 +837,7 @@
return getDomainAwareList(outcome, SessionMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70025, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70025, e);
}
}
return Collections.emptyList();
@@ -868,7 +868,7 @@
}
result = outcome.get("result");
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70027, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70027, e);
}
}
else {
@@ -999,7 +999,7 @@
return getDomainAwareList(outcome, TransactionMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70028, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70028, e);
}
}
return Collections.emptyList();
@@ -1017,7 +1017,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70029, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70030, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70030, e);
}
}
@@ -1033,7 +1033,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70031, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70032, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70032, e);
}
}
@@ -1061,7 +1061,7 @@
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70033, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70033, e);
}
return null;
}
@@ -1075,7 +1075,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70034, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70034, e);
}
return Collections.emptyList();
@@ -1177,7 +1177,7 @@
}
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70035, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70035, e);
}
return null;
}
@@ -1191,7 +1191,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70036, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70036, e);
}
return Collections.emptyList();
@@ -1210,7 +1210,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70039, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70040, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70040, e);
}
}
@@ -1227,7 +1227,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70041, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70042, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70042, e);
}
}
@@ -1250,7 +1250,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70043, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70044, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70044, e);
}
}
@@ -1266,7 +1266,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70045, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70046, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70046, e);
}
}
@@ -1286,7 +1286,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70047, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70048, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70048, e);
}
}
@@ -1299,7 +1299,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70049, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70050, e, e.getMessage());
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70050, e);
}
}
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -77,5 +77,6 @@
TEIID70049,
TEIID70050,
TEIID70051,
+ TEIID70052
}
}
Modified: trunk/client/src/main/java/org/teiid/client/security/LogonException.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/security/LogonException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/client/src/main/java/org/teiid/client/security/LogonException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -58,5 +58,8 @@
super(event, t, message );
}
+ public LogonException(Throwable t) {
+ super(t);
+ }
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/JDBCPlugin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCPlugin.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/client/src/main/java/org/teiid/jdbc/JDBCPlugin.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -50,18 +50,12 @@
TEIID20012,
TEIID20013,
TEIID20014,
- TEIID20015,
TEIID20016,
- TEIID20017,
TEIID20018,
TEIID20019,
TEIID20020,
TEIID20021,
- TEIID20022,
TEIID20023,
- TEIID20024,
- TEIID20025,
- TEIID20026,
TEIID20027,
TEIID20028
}
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -139,7 +139,7 @@
} catch (LogonException e) {
// Propagate the original message as it contains the message we want
// to give to the user
- throw new ConnectionException(JDBCPlugin.Event.TEIID20017, e, e.getMessage());
+ throw new ConnectionException(e);
} catch (TeiidComponentException e) {
if (e.getCause() instanceof CommunicationException) {
throw (CommunicationException)e.getCause();
@@ -233,7 +233,7 @@
try {
return selectServerInstance(false);
} catch (ConnectionException e) {
- throw new CommunicationException(JDBCPlugin.Event.TEIID20022, e, e.getMessage());
+ throw new CommunicationException(e);
}
}
@@ -333,7 +333,7 @@
try {
return selectServerInstance(false).getHostInfo().equals(((SocketServerConnection)otherService).selectServerInstance(false).getHostInfo());
} catch (ConnectionException e) {
- throw new CommunicationException(JDBCPlugin.Event.TEIID20024, e, e.getMessage());
+ throw new CommunicationException(e);
}
}
@@ -359,9 +359,9 @@
try {
this.logon(logonInstance, true);
} catch (LogonException e) {
- throw new ConnectionException(JDBCPlugin.Event.TEIID20025, e, e.getMessage());
+ throw new ConnectionException(e);
} catch (TeiidComponentException e) {
- throw new CommunicationException(JDBCPlugin.Event.TEIID20026, e, e.getMessage());
+ throw new CommunicationException(e);
}
}
}
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -303,7 +303,7 @@
try {
discovery = (ServerDiscovery)ReflectionHelper.create(discoveryStrategyName, null, this.getClass().getClassLoader());
} catch (TeiidException e) {
- throw new ConnectionException(JDBCPlugin.Event.TEIID20015, e, e.getMessage());
+ throw new ConnectionException(e);
}
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/TransformationException.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/TransformationException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/common-core/src/main/java/org/teiid/core/types/TransformationException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -48,7 +48,10 @@
super(message);
}
-
+ public TransformationException(Exception e) {
+ super(e);
+ }
+
/**
* Construct an instance from a message and an exception to chain to this one.
*
Modified: trunk/engine/src/main/java/org/teiid/api/exception/query/ExpressionEvaluationException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/api/exception/query/ExpressionEvaluationException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/api/exception/query/ExpressionEvaluationException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -48,6 +48,10 @@
super( message );
}
+ public ExpressionEvaluationException(Throwable e) {
+ super(e);
+ }
+
/**
* Construct an instance from a message and an exception to chain to this one.
*
Modified: trunk/engine/src/main/java/org/teiid/api/exception/query/FunctionExecutionException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/api/exception/query/FunctionExecutionException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/api/exception/query/FunctionExecutionException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -47,6 +47,10 @@
super( message );
}
+ public FunctionExecutionException(Throwable e) {
+ super(e);
+ }
+
/**
* Construct an instance from a message and an exception to chain to this one.
*
Modified: trunk/engine/src/main/java/org/teiid/api/exception/query/QueryPlannerException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/api/exception/query/QueryPlannerException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/api/exception/query/QueryPlannerException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -49,6 +49,10 @@
super( message );
}
+ public QueryPlannerException(Throwable e) {
+ super(e);
+ }
+
/**
* Construct an instance from a message and an exception to chain to this one.
*
Modified: trunk/engine/src/main/java/org/teiid/api/exception/query/QueryProcessingException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/api/exception/query/QueryProcessingException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/api/exception/query/QueryProcessingException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -48,6 +48,10 @@
public QueryProcessingException( String message ) {
super( message );
}
+
+ public QueryProcessingException(Throwable e) {
+ super(e);
+ }
/**
* Construct an instance from a message and an exception to chain to this one.
Modified: trunk/engine/src/main/java/org/teiid/api/exception/query/QueryResolverException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/api/exception/query/QueryResolverException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/api/exception/query/QueryResolverException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -51,6 +51,10 @@
super( message );
}
+ public QueryResolverException(Throwable e) {
+ super(e);
+ }
+
/**
* Construct an instance from a message and an exception to chain to this one.
*
Modified: trunk/engine/src/main/java/org/teiid/api/exception/query/QueryValidatorException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/api/exception/query/QueryValidatorException.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/api/exception/query/QueryValidatorException.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -48,6 +48,10 @@
super( message );
}
+ public QueryValidatorException(Throwable e) {
+ super(e);
+ }
+
/**
* Construct an instance from a message and an exception to chain to this one.
*
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -212,9 +212,9 @@
try {
sqlxml = XMLSystemFunctions.saveToBufferManager(dtm.getBufferManager(), sxt);
} catch (TeiidComponentException e) {
- throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30501, e);
+ throw new TeiidRuntimeException(e);
} catch (TeiidProcessingException e) {
- throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30502, e);
+ throw new TeiidRuntimeException(e);
}
return new XMLType(sqlxml);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -109,7 +109,7 @@
try {
return multiSourceModify((AccessNode)node);
} catch (TeiidProcessingException e) {
- throw new QueryPlannerException(QueryPlugin.Event.TEIID30560, e, e.getMessage());
+ throw new QueryPlannerException(e);
}
} else if (node instanceof ProjectIntoNode) {
ProjectIntoNode pin = (ProjectIntoNode)node;
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -102,7 +102,6 @@
TEIID30059,
TEIID30060,
TEIID30061,
- TEIID30062,
TEIID30063,
TEIID30064,
TEIID30065,
@@ -201,7 +200,6 @@
TEIID30182,
TEIID30183,
TEIID30184,
- TEIID30186,
TEIID30187,
TEIID30188,
TEIID30190,
@@ -256,13 +254,11 @@
TEIID30243,
TEIID30244,
TEIID30245,
- TEIID30246,
TEIID30247,
TEIID30248,
TEIID30249,
TEIID30250,
TEIID30251,
- TEIID30252,
TEIID30253,
TEIID30254,
TEIID30257,
@@ -283,7 +279,6 @@
TEIID30275,
TEIID30278,
TEIID30281,
- TEIID30282,
TEIID30283,
TEIID30284,
TEIID30285,
@@ -308,27 +303,19 @@
TEIID30312,
TEIID30314,
TEIID30316,
- TEIID30319,
- TEIID30320,
TEIID30323,
TEIID30324,
TEIID30326,
- TEIID30327,
TEIID30328,
TEIID30329,
- TEIID30330,
TEIID30331,
TEIID30333,
TEIID30334,
TEIID30335,
TEIID30336,
- TEIID30337,
TEIID30338,
- TEIID30339,
TEIID30341,
TEIID30342,
- TEIID30343,
- TEIID30344,
TEIID30345,
TEIID30347,
TEIID30350,
@@ -346,12 +333,9 @@
TEIID30365,
TEIID30366,
TEIID30367,
- TEIID30369,
- TEIID30370,
TEIID30371,
TEIID30372,
TEIID30373,
- TEIID30374,
TEIID30375,
TEIID30376,
TEIID30377,
@@ -399,8 +383,6 @@
TEIID30431,
TEIID30432,
TEIID30434,
- TEIID30435,
- TEIID30436,
TEIID30437,
TEIID30438,
TEIID30439,
@@ -453,8 +435,6 @@
TEIID30498,
TEIID30499,
TEIID30500,
- TEIID30501,
- TEIID30502,
TEIID30503,
TEIID30504,
TEIID30505,
@@ -497,7 +477,6 @@
TEIID30557,
TEIID30558,
TEIID30559,
- TEIID30560,
TEIID30561,
TEIID30562,
TEIID30563,
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -404,7 +404,7 @@
try {
values = vis.getCachedSet(ref.getValueExpression());
} catch (TeiidProcessingException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30319, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
if (values != null) {
return values.contains(leftValue);
@@ -417,7 +417,7 @@
try {
valueIter = evaluateSubquery((SubquerySetCriteria)criteria, tuple);
} catch (TeiidProcessingException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30320, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
} else {
throw new AssertionError("unknown set criteria type"); //$NON-NLS-1$
@@ -495,7 +495,7 @@
try {
valueIter = evaluateSubquery(criteria, tuple);
} catch (TeiidProcessingException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30324, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
while(valueIter.hasNext()) {
Object value = valueIter.next();
@@ -565,7 +565,7 @@
try {
valueIter = evaluateSubquery(criteria, tuple);
} catch (TeiidProcessingException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30327, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
if(valueIter.hasNext()) {
return !criteria.isNegated();
@@ -670,7 +670,7 @@
}
}
} catch (TransformationException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30330, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
} catch (SQLException e) {
throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30331, e, e.getMessage());
}
@@ -820,7 +820,7 @@
}
}, function.getDelimiter(), function.getQuote());
} catch (TransformationException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30337, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
}
@@ -833,7 +833,7 @@
try {
return XMLSystemFunctions.xmlForest(context, namespaces(function.getNamespaces()), nameValuePairs);
} catch (TeiidProcessingException e) {
- throw new FunctionExecutionException(QueryPlugin.Event.TEIID30338, e, e.getMessage());
+ throw new FunctionExecutionException(e);
}
}
@@ -852,7 +852,7 @@
}
return XMLSystemFunctions.xmlElement(context, function.getName(), namespaces(function.getNamespaces()), attributes, values);
} catch (TeiidProcessingException e) {
- throw new FunctionExecutionException(QueryPlugin.Event.TEIID30339, e, e.getMessage());
+ throw new FunctionExecutionException(e);
}
}
@@ -979,7 +979,7 @@
try {
return dataMgr.lookupCodeValue(context, codeTableName, returnElementName, keyElementName, values[3]);
} catch (TeiidProcessingException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30343, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
}
@@ -995,7 +995,7 @@
try {
valueIter = evaluateSubquery(scalarSubquery, tuple);
} catch (TeiidProcessingException e) {
- throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30344, e, e.getMessage());
+ throw new ExpressionEvaluationException(e);
}
if(valueIter.hasNext()) {
result = valueIter.next();
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -248,7 +248,7 @@
} catch(IllegalAccessException e) {
throw new FunctionExecutionException(QueryPlugin.Event.TEIID30385, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30385, method.toString()));
} catch (TransformationException e) {
- throw new FunctionExecutionException(QueryPlugin.Event.TEIID30386, e, e.getMessage());
+ throw new FunctionExecutionException(e);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/source/SecuritySystemFunctions.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/source/SecuritySystemFunctions.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/SecuritySystemFunctions.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -41,8 +41,8 @@
try {
return eval.hasRole(SecurityFunctionEvaluator.DATA_ROLE, roleName);
- } catch (TeiidComponentException err) {
- throw new FunctionExecutionException(QueryPlugin.Event.TEIID30435, err, err.getMessage());
+ } catch (TeiidComponentException e) {
+ throw new FunctionExecutionException(e);
}
}
@@ -56,8 +56,8 @@
try {
return eval.hasRole(roleType, roleName);
- } catch (TeiidComponentException err) {
- throw new FunctionExecutionException(QueryPlugin.Event.TEIID30436, err, err.getMessage());
+ } catch (TeiidComponentException e) {
+ throw new FunctionExecutionException(e);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -22,6 +22,7 @@
package org.teiid.query.metadata;
import org.teiid.metadata.MetadataFactory;
+import org.teiid.query.QueryPlugin;
import org.teiid.query.parser.ParseException;
import org.teiid.query.parser.QueryParser;
import org.teiid.translator.ExecutionFactory;
@@ -35,7 +36,7 @@
try {
QueryParser.getQueryParser().parseDDL(factory, factory.getRawMetadata());
} catch (ParseException e) {
- throw new TranslatorException(e.getMessage());
+ throw new TranslatorException(QueryPlugin.Event.TEIID30386, e);
}
super.loadMetadata(factory, executionFactory, connectionFactory);
}
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -211,7 +211,7 @@
try {
command = QueryRewriter.rewrite(command, metadata, context);
} catch (TeiidProcessingException e) {
- throw new QueryPlannerException(QueryPlugin.Event.TEIID30246, e, e.getMessage());
+ throw new QueryPlannerException(e);
}
result = PROCEDURE_PLANNER.optimize(command, idGenerator, metadata, capFinder, analysisRecord, context);
return result;
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -179,7 +179,7 @@
try {
plan = generatePlan(command, true);
} catch (TeiidProcessingException e) {
- throw new QueryPlannerException(QueryPlugin.Event.TEIID30252, e, e.getMessage());
+ throw new QueryPlannerException(e);
}
if(debug) {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -106,7 +106,7 @@
try {
return QueryRewriter.rewrite(query, metadata, context);
} catch(TeiidProcessingException e) {
- throw new QueryPlannerException(QueryPlugin.Event.TEIID30282, e, e.getMessage());
+ throw new QueryPlannerException(e);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/TupleSourceValueIterator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/TupleSourceValueIterator.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/TupleSourceValueIterator.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -53,8 +53,8 @@
public boolean hasNext() throws TeiidComponentException{
try {
return tupleSourceIterator.hasNext();
- } catch (TeiidProcessingException err) {
- throw new TeiidComponentException(QueryPlugin.Event.TEIID30186, err, err.getMessage());
+ } catch (TeiidProcessingException e) {
+ throw new TeiidComponentException(e);
}
}
@@ -65,8 +65,8 @@
public Object next() throws TeiidComponentException{
try {
return tupleSourceIterator.nextTuple().get(columnIndex);
- } catch (TeiidProcessingException err) {
- throw new TeiidComponentException(QueryPlugin.Event.TEIID30187, err, err.getMessage());
+ } catch (TeiidProcessingException e) {
+ throw new TeiidComponentException(e);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -187,7 +187,7 @@
try {
return QueryResolver.resolveView(group, metadata.getVirtualPlan(group.getMetadataID()), SQLConstants.Reserved.SELECT, metadata).getUpdateInfo();
} catch (QueryValidatorException e) {
- throw new QueryResolverException(QueryPlugin.Event.TEIID30062, e, e.getMessage());
+ throw new QueryResolverException(e);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -276,7 +276,7 @@
// Resolve this command
resolver.resolveCommand(currentCommand, resolverMetadata, resolveNullLiterals);
} catch(QueryMetadataException e) {
- throw new QueryResolverException(QueryPlugin.Event.TEIID30064, e, e.getMessage());
+ throw new QueryResolverException(e);
}
// Flag that this command has been resolved.
Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -623,10 +623,10 @@
query.setInto(null);
insert.setQueryExpression(query);
return rewriteInsert(correctDatatypes(insert));
- } catch (QueryMetadataException err) {
- throw new QueryValidatorException(QueryPlugin.Event.TEIID30369, err, err.getMessage());
- } catch (TeiidComponentException err) {
- throw new QueryValidatorException(QueryPlugin.Event.TEIID30370, err, err.getMessage());
+ } catch (QueryMetadataException e) {
+ throw new QueryValidatorException(e);
+ } catch (TeiidComponentException e) {
+ throw new QueryValidatorException(e);
}
}
@@ -1915,7 +1915,7 @@
try {
return new Constant(FunctionMethods.convert(((Constant)value).getValue(), DataTypeManager.getDataTypeName(type)), es.getType());
} catch (FunctionExecutionException e) {
- throw new QueryValidatorException(QueryPlugin.Event.TEIID30374, e, e.getMessage());
+ throw new QueryValidatorException(e);
}
}
return new Reference(es);
Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -75,15 +75,12 @@
TEIID40053,
TEIID40054,
TEIID40055,
- TEIID40056,
- TEIID40057,
TEIID40059,
TEIID40062,
TEIID40063,
TEIID40064,
TEIID40065,
TEIID40067,
- TEIID40068,
TEIID40069,
TEIID40070,
TEIID40071,
Modified: trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -94,7 +94,7 @@
} catch (LogonException e) {
// Propagate the original message as it contains the message we want
// to give to the user
- throw new ConnectionException(RuntimePlugin.Event.TEIID40068, e, e.getMessage());
+ throw new ConnectionException(e);
} catch (TeiidComponentException e) {
if (e.getCause() instanceof CommunicationException) {
throw (CommunicationException)e.getCause();
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-06-12 17:03:58 UTC (rev 4176)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-06-13 13:57:08 UTC (rev 4177)
@@ -113,9 +113,9 @@
}
return result;
} catch (LoginException e) {
- throw new LogonException(RuntimePlugin.Event.TEIID40056, e.getMessage());
+ throw new LogonException(e);
} catch (SessionServiceException e) {
- throw new LogonException(RuntimePlugin.Event.TEIID40057, e, e.getMessage());
+ throw new LogonException(e);
}
}
12 years, 6 months
teiid SVN: r4176 - trunk/jboss-integration/src/main/java/org/teiid/jboss.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-06-12 13:03:58 -0400 (Tue, 12 Jun 2012)
New Revision: 4176
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
Log:
TEIID-2066: cached files or being written wrong. Each model metadata needs to be saved in its own cache file. The same schema is being written as multiple models, thus leading to duplicate schema exceptions.
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-06-12 14:05:05 UTC (rev 4175)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-06-12 17:03:58 UTC (rev 4176)
@@ -355,7 +355,7 @@
if (!cached) {
// cache the schema to disk
- cacheMetadataStore(vdb, factory);
+ cacheMetadataStore(model, factory);
}
// merge into VDB metadata
@@ -404,21 +404,18 @@
}
// if is not dynamic always cache; else check for the flag (this may need to be revisited with index vdb)
- private void cacheMetadataStore(final VDBMetaData vdb, MetadataFactory schema) {
+ private void cacheMetadataStore(final ModelMetaData model, MetadataFactory schema) {
boolean cache = !vdb.isDynamic();
if (vdb.isDynamic()) {
cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
}
if (cache) {
- for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
- final File cachedFile = getSerializer().buildModelFile(vdb, model.getName());
- try {
- // TODO: save the model not VDB here.
- getSerializer().saveAttachment(cachedFile, schema, false);
- } catch (IOException e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion(), model.getName()));
- }
+ final File cachedFile = getSerializer().buildModelFile(vdb, model.getName());
+ try {
+ getSerializer().saveAttachment(cachedFile, schema, false);
+ } catch (IOException e) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion(), model.getName()));
}
}
}
12 years, 6 months