Author: shawkins
Date: 2010-11-04 22:57:19 -0400 (Thu, 04 Nov 2010)
New Revision: 2707
Added:
branches/7.2.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java
Modified:
branches/7.2.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
branches/7.2.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.2.x/cache-jbosscache/pom.xml
branches/7.2.x/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
branches/7.2.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/Facet.java
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
branches/7.2.x/console/src/main/resources/META-INF/rhq-plugin.xml
branches/7.2.x/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml
branches/7.2.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
branches/7.2.x/engine/src/main/java/org/teiid/query/parser/QueryParser.java
branches/7.2.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
branches/7.2.x/engine/src/main/java/org/teiid/query/sql/visitor/CriteriaTranslatorVisitor.java
branches/7.2.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.2.x/engine/src/main/resources/org/teiid/query/i18n.properties
branches/7.2.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
branches/7.2.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
branches/7.2.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
branches/7.2.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
branches/7.2.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
branches/7.2.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/7.2.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/7.2.x/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
Log:
forward merge of 7.1.1
Modified: branches/7.2.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
---
branches/7.2.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-11-05
02:57:19 UTC (rev 2707)
@@ -57,6 +57,7 @@
be replicated.
-->
<bean name="ResultsetCacheConfig"
class="org.teiid.cache.CacheConfiguration">
+ <property name="name">ResultSetCacheConfig</property>
<property name="enabled">true</property>
<!-- Max Entries allowed for ResultSet Cache (default 1024) -->
<property name="maxEntries">1024</property>
@@ -99,7 +100,7 @@
Note: this is a memory based cache. (default 512) -->
<property name="preparedPlanCacheMaxCount">512</property>
<!-- Turn on role checking of resources based on the roles defined in VDB
(default true) -->
- <property name="useDataRoles"
class="java.lang.Boolean">true</property>
+ <property name="useDataRoles">true</property>
<!-- Long running query threshold, after which a alert can be generated by
tooling if configured-->
<property name="queryThresholdInSecs">600</property>
<!-- Maximum rows allowed from a source query. -1 indicates no limit. (default
-1)-->
@@ -110,6 +111,7 @@
<!-- JDBC Socket connection properties (SSL see below) -->
<bean name="JdbcSocketConfiguration"
class="org.teiid.transport.SocketConfiguration">
+ <property name="name">JdbcSocketConfiguration</property>
<property name="enabled">true</property>
<property
name="bindAddress">${jboss.bind.address}</property>
<property name="portNumber">31000</property>
@@ -144,6 +146,7 @@
<!-- Admin Socket connection settings (SSL see below) -->
<bean name="AdminSocketConfiguration"
class="org.teiid.transport.SocketConfiguration">
+ <property name="name">AdminSocketConfiguration</property>
<property name="enabled">true</property>
<property
name="bindAddress">${jboss.bind.address}</property>
<property name="portNumber">31443</property>
@@ -178,6 +181,7 @@
<!-- JDBC Socket connection properties (SSL see below) -->
<bean name="OdbcSocketConfiguration"
class="org.teiid.transport.SocketConfiguration">
+ <property name="name">OdbcSocketConfiguration</property>
<property name="enabled">true</property>
<property
name="bindAddress">${jboss.bind.address}</property>
<property name="portNumber">35432</property>
Modified: branches/7.2.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.2.x/build/kits/jboss-container/teiid-releasenotes.html 2010-11-05 02:27:49
UTC (rev 2706)
+++ branches/7.2.x/build/kits/jboss-container/teiid-releasenotes.html 2010-11-05 02:57:19
UTC (rev 2707)
@@ -42,12 +42,13 @@
<LI><B>Improved clustering support</B> - see the Admin Guide
chapter on clustering.
<LI><B>IPv6 support</B> - Teiid can started using IPv6 bind address
and can be used with JDBC connection.
<LI><B>SESSION_ID</B> - A new system function
"SESSION_ID" is added to the system function library.
- <LI><B>Assignment Syntax Improvements<B> - Teiid's procedure
syntax for assignments was clarified so that the assignment value must be a proper
expression. INSERT/UPDATE/DELETE update counts must be obtained from VARIABLES.ROWCOUNT,
scalar values must be obtained via a scalar subquery. The parser will continue to accept
the old syntax and convert the query into the proper form.
+ <LI><B>Assignment Syntax Improvements</B> - Teiid's procedure
syntax for assignments was clarified so that the assignment value must be a proper
expression. INSERT/UPDATE/DELETE update counts must be obtained from VARIABLES.ROWCOUNT,
scalar values must be obtained via a scalar subquery. The parser will continue to accept
the old syntax and convert the query into the proper form.
<LI><B>TEXTAGG</B> - SQL support for Text aggregation. Using this
function expression values can be aggregated into a CSV BLOB with configurable delimiter,
header, and encoding. The result can be optionally saved to a text file.
</UL>
<h2><a name="Compatibility">Compatibility
Issues</a></h2>
<ul>
+ <li>TRANSLATE CRITERIA has been deprecated. An alternative approach to update
procedures will be introduced in a subsequent version.
<li>Support for named parameter syntax using param=value has been deprecated,
since it is ambiguous with a comparison predicate boolean value expression.
param<b>=></b>value should be used instead.
</ul>
<h4>from 7.1</h4>
Modified: branches/7.2.x/cache-jbosscache/pom.xml
===================================================================
--- branches/7.2.x/cache-jbosscache/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ branches/7.2.x/cache-jbosscache/pom.xml 2010-11-05 02:57:19 UTC (rev 2707)
@@ -25,5 +25,10 @@
<artifactId>jbosscache-core</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
branches/7.2.x/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
===================================================================
---
branches/7.2.x/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -41,6 +41,7 @@
import org.teiid.language.TableReference;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
import org.teiid.metadata.AbstractMetadataRecord;
import org.teiid.metadata.Column;
import org.teiid.metadata.RuntimeMetadata;
@@ -185,7 +186,7 @@
results = connection.queryMore(results.getQueryLocator(), context.getBatchSize());
}
resultBatch = new ArrayList<List<Object>>();
-
+ topResultIndex = 0;
for(SObject sObject : results.getRecords()) {
List<Object[]> result = getObjectData(sObject);
for(Iterator<Object[]> i = result.iterator(); i.hasNext(); ) {
@@ -291,6 +292,9 @@
}
private void logFields(String sObjectName, List<Object> fields) throws
TranslatorException {
+ if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL))
{
+ return;
+ }
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "SalesForce Object Name = "
+ sObjectName); //$NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "FieldCount = " +
fields.size()); //$NON-NLS-1$
for(int i = 0; i < fields.size(); i++) {
Copied:
branches/7.2.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java
(from rev 2706,
branches/7.1.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java)
===================================================================
---
branches/7.2.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java
(rev 0)
+++
branches/7.2.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -0,0 +1,69 @@
+/*
+ * 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.translator.salesforce.execution;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.language.Select;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
+import org.w3c.dom.Element;
+
+import com.sforce.soap.partner.QueryResult;
+import com.sforce.soap.partner.sobject.SObject;
+
+@SuppressWarnings("nls")
+public class TestQueryExecutionImpl {
+
+ private static TranslationUtility translationUtility = new
TranslationUtility(TestVisitors.exampleSalesforce());
+
+ @Test public void testBatching() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select Name from
Account"); //$NON-NLS-1$
+ SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
+ QueryResult qr = new QueryResult();
+ SObject so = new SObject();
+ so.setType("Account");
+ Element elem = Mockito.mock(Element.class);
+ Mockito.stub(elem.getLocalName()).toReturn("AccountName");
+ so.getAny().add(elem);
+ qr.getRecords().add(so);
+ qr.setDone(false);
+ QueryResult finalQr = new QueryResult();
+ so.getAny().add(elem);
+ finalQr.getRecords().add(so);
+ finalQr.setDone(true);
+ Mockito.stub(sfc.query("SELECT Account.AccountName FROM Account", 0,
false)).toReturn(qr);
+ Mockito.stub(sfc.queryMore(null, 0)).toReturn(finalQr);
+ QueryExecutionImpl qei = new QueryExecutionImpl(command, sfc,
Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
+ qei.execute();
+ assertNotNull(qei.next());
+ assertNotNull(qei.next());
+ assertNull(qei.next());
+ }
+
+}
Modified: branches/7.2.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
---
branches/7.2.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -64,10 +64,8 @@
public class DQPManagementView implements PluginConstants {
private static ManagedComponent mc = null;
- private static final Log LOG = LogFactory
- .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
- private static final MetaValueFactory metaValueFactory = MetaValueFactory
- .getInstance();
+ private static final Log LOG =
LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+ private static final MetaValueFactory metaValueFactory =
MetaValueFactory.getInstance();
private static final String VDB_EXT = ".vdb"; //$NON-NLS-1$
@@ -83,13 +81,10 @@
Object resultObject = new Object();
if (componentType.equals(PluginConstants.ComponentType.Platform.NAME)) {
- resultObject = getPlatformMetric(connection, componentType, metric,
- valueMap);
+ resultObject = getPlatformMetric(connection, componentType, metric, valueMap);
} else if (componentType.equals(PluginConstants.ComponentType.VDB.NAME)) {
- resultObject = getVdbMetric(connection, componentType, identifier,
- metric, valueMap);
+ resultObject = getVdbMetric(connection, componentType, identifier,metric, valueMap);
}
-
return resultObject;
}
@@ -98,44 +93,33 @@
Object resultObject = new Object();
- if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
+ if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
resultObject = new Double(getQueryCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+ } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT))
{
resultObject = new Double(getSessionCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
+ } else if
(metric.equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection),
- longRunningQueries);
+ getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
resultObject = new Double(longRunningQueries.size());
- } else if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
+ } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE))
{
try {
- resultObject = ProfileServiceUtil
- .doubleValue(getUsedBufferSpace(connection));
+ resultObject = ProfileServiceUtil.doubleValue(getUsedBufferSpace(connection));
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
LOG.error(msg, e);
}
- } else if (metric.startsWith(Admin.Cache.PREPARED_PLAN_CACHE.toString()
- + ".") //$NON-NLS-1$
- || metric.startsWith(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE
- .toString()
- + ".")) { //$NON-NLS-1$
+ } else if (metric.startsWith(Admin.Cache.PREPARED_PLAN_CACHE.toString() +
".") //$NON-NLS-1$
+ || metric.startsWith(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE .toString()+
".")) { //$NON-NLS-1$
return getCacheProperty(connection, metric);
}
return resultObject;
}
- private Object getCacheProperty(ProfileServiceConnection connection,
- String metric) {
+ private Object getCacheProperty(ProfileServiceConnection connection,String metric) {
int dotIndex = metric.indexOf('.');
String cacheType = metric.substring(0, dotIndex);
String property = metric.substring(dotIndex + 1);
- CompositeValueSupport mv = (CompositeValueSupport) getCacheStats(
- connection, cacheType);
+ CompositeValueSupport mv = (CompositeValueSupport) getCacheStats(connection,
cacheType);
MetaValue v = mv.get(property);
return ((SimpleValue) v).getValue();
}
@@ -146,27 +130,19 @@
Object resultObject = new Object();
- if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.ERROR_COUNT)) {
+ if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.ERROR_COUNT)) {
// TODO remove version parameter after AdminAPI is changed
- resultObject = getErrorCount(connection, (String) valueMap
- .get(VDB.NAME));
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+ resultObject = getErrorCount(connection, (String) valueMap.get(VDB.NAME));
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
// TODO remove version parameter after AdminAPI is changed
- resultObject = getVDBStatus(connection, (String) valueMap
- .get(VDB.NAME));
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+ resultObject = getVDBStatus(connection, (String) valueMap.get(VDB.NAME));
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
resultObject = new Double(getQueryCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
resultObject = new Double(getSessionCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+ } else if
(metric.equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection),
- longRunningQueries);
+ getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
resultObject = new Double(longRunningQueries.size());
}
return resultObject;
@@ -179,14 +155,10 @@
public void executeOperation(ProfileServiceConnection connection,
ExecutedResult operationResult, final Map<String, Object> valueMap) {
- if (operationResult.getComponentType().equals(
- PluginConstants.ComponentType.Platform.NAME)) {
- executePlatformOperation(connection, operationResult,
- operationResult.getOperationName(), valueMap);
- } else if (operationResult.getComponentType().equals(
- PluginConstants.ComponentType.VDB.NAME)) {
- executeVdbOperation(connection, operationResult, operationResult
- .getOperationName(), valueMap);
+ if
(operationResult.getComponentType().equals(PluginConstants.ComponentType.Platform.NAME))
{
+ executePlatformOperation(connection,
operationResult, operationResult.getOperationName(), valueMap);
+ } else if
(operationResult.getComponentType().equals( PluginConstants.ComponentType.VDB.NAME)) {
+ executeVdbOperation(connection, operationResult, operationResult .getOperationName(),
valueMap);
}
}
@@ -199,50 +171,37 @@
if (operationName.equals(Platform.Operations.GET_LONGRUNNINGQUERIES)) {
List<String> fieldNameList = operationResult.getFieldNameList();
- getRequestCollectionValue(getLongRunningQueries(connection),
- resultObject);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
+ getRequestCollectionValue(getLongRunningQueries(connection), resultObject);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(Platform.Operations.GET_SESSIONS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue sessionMetaValue = getSessions(connection);
- getSessionCollectionValue(sessionMetaValue,
- activeSessionsCollection);
- operationResult.setContent(createReportResultList(fieldNameList,
- activeSessionsCollection.iterator()));
+ getSessionCollectionValue(sessionMetaValue,activeSessionsCollection);
+ operationResult.setContent(createReportResultList(fieldNameList, activeSessionsCollection.iterator()));
} else if (operationName.equals(Platform.Operations.GET_REQUESTS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue requestMetaValue = getRequests(connection);
getRequestCollectionValue(requestMetaValue, resultObject);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(Platform.Operations.GET_TRANSACTIONS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue transactionMetaValue = getTransactions(connection);
- getTransactionCollectionValue(transactionMetaValue,
- transactionsCollection);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
+ getTransactionCollectionValue(transactionMetaValue,transactionsCollection);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
- Long sessionID = (Long) valueMap
- .get(Operation.Value.TRANSACTION_ID);
- MetaValue[] args = new MetaValue[] { metaValueFactory
- .create(sessionID) };
+ Long sessionID = (Long) valueMap.get(Operation.Value.TRANSACTION_ID);
+ MetaValue[] args = new MetaValue[] { metaValueFactory .create(sessionID) };
try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(
- connection, mc), Platform.Operations.KILL_TRANSACTION,
- args);
+ executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
Platform.Operations.KILL_TRANSACTION, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.KILL_TRANSACTION; //$NON-NLS-1$
LOG.error(msg, e);
}
} else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
- MetaValue[] args = new MetaValue[] { metaValueFactory
- .create(sessionID) };
+ MetaValue[] args = new MetaValue[] { metaValueFactory .create(sessionID) };
try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(
- connection, mc), Platform.Operations.KILL_SESSION, args);
+ executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
Platform.Operations.KILL_SESSION, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.KILL_SESSION; //$NON-NLS-1$
LOG.error(msg, e);
@@ -254,25 +213,21 @@
metaValueFactory.create(requestID),
metaValueFactory.create(sessionID) };
try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(
- connection, mc), Platform.Operations.KILL_REQUEST, args);
+ executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
Platform.Operations.KILL_REQUEST, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.KILL_REQUEST; //$NON-NLS-1$
LOG.error(msg, e);
}
} else if (operationName.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
String vdbUrl = (String) valueMap.get(Operation.Value.VDB_URL);
- String deployName = (String) valueMap
- .get(Operation.Value.VDB_DEPLOY_NAME);
+ String deployName = (String) valueMap.get(Operation.Value.VDB_DEPLOY_NAME);
Object vdbVersion = valueMap.get(Operation.Value.VDB_VERSION);
// strip off vdb extension if user added it
if (deployName.endsWith(VDB_EXT)) {
- deployName = deployName.substring(0, deployName
- .lastIndexOf(VDB_EXT));
+ deployName = deployName.substring(0, deployName.lastIndexOf(VDB_EXT));
}
if (vdbVersion != null) {
- deployName = deployName
- + "." + ((Integer) vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
+ deployName = deployName + "." + ((Integer) vdbVersion).toString() +
VDB_EXT; //$NON-NLS-1$
}
// add vdb extension if there was no version
if (!deployName.endsWith(VDB_EXT)) {
@@ -281,8 +236,7 @@
try {
URL url = new URL(vdbUrl);
- DeploymentUtils.deployArchive(deployName, connection
- .getDeploymentManager(), url, false);
+ DeploymentUtils.deployArchive(deployName, connection.getDeploymentManager(), url,
false);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.DEPLOY_VDB_BY_URL; //$NON-NLS-1$
LOG.error(msg, e);
@@ -297,41 +251,30 @@
Collection<ArrayList<String>> sqlResultsObject = new
ArrayList<ArrayList<String>>();
Collection<Request> resultObject = new ArrayList<Request>();
Collection<Session> activeSessionsCollection = new ArrayList<Session>();
- String vdbName = (String) valueMap
- .get(PluginConstants.ComponentType.VDB.NAME);
- String vdbVersion = (String) valueMap
- .get(PluginConstants.ComponentType.VDB.VERSION);
+ String vdbName = (String) valueMap.get(PluginConstants.ComponentType.VDB.NAME);
+ String vdbVersion = (String) valueMap.get(PluginConstants.ComponentType.VDB.VERSION);
if (operationName.equals(VDB.Operations.GET_PROPERTIES)) {
List<String> fieldNameList = operationResult.getFieldNameList();
getProperties(connection, PluginConstants.ComponentType.VDB.NAME);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(VDB.Operations.GET_SESSIONS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue sessionMetaValue = getSessions(connection);
- getSessionCollectionValueForVDB(sessionMetaValue,
- activeSessionsCollection, vdbName);
- operationResult.setContent(createReportResultList(fieldNameList,
- activeSessionsCollection.iterator()));
+ getSessionCollectionValueForVDB(sessionMetaValue, activeSessionsCollection, vdbName);
+ operationResult.setContent(createReportResultList(fieldNameList, activeSessionsCollection.iterator()));
} else if (operationName.equals(VDB.Operations.GET_REQUESTS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue requestMetaValue = getRequestsForVDB(connection, vdbName,
- Integer.parseInt(vdbVersion));
+ MetaValue requestMetaValue = getRequestsForVDB(connection,
vdbName, Integer.parseInt(vdbVersion));
getRequestCollectionValue(requestMetaValue, resultObject);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(VDB.Operations.GET_MATVIEWS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue resultsMetaValue = executeMaterializedViewQuery(
- connection, formatVdbName(vdbName), Integer
- .parseInt(vdbVersion));
+ MetaValue resultsMetaValue = executeMaterializedViewQuery( connection,
formatVdbName(vdbName), Integer.parseInt(vdbVersion));
getResultsCollectionValue(resultsMetaValue, sqlResultsObject);
- operationResult.setContent(createReportResultListForMatViewQuery(
- fieldNameList, sqlResultsObject.iterator()));
+ operationResult.setContent(createReportResultListForMatViewQuery(fieldNameList,
sqlResultsObject.iterator()));
} else if (operationName.equals(VDB.Operations.RELOAD_MATVIEW)) {
- MetaValue resultsMetaValue = reloadMaterializedView(connection,
- formatVdbName(vdbName), Integer.parseInt(vdbVersion),
+ MetaValue resultsMetaValue =
reloadMaterializedView(connection, formatVdbName(vdbName), Integer.parseInt(vdbVersion),
(String) valueMap.get(Operation.Value.MATVIEW_SCHEMA),
(String) valueMap.get(Operation.Value.MATVIEW_TABLE),
(Boolean) valueMap.get(Operation.Value.INVALIDATE_MATVIEW));
@@ -353,15 +296,13 @@
return vdbName.substring(0, vdbName.indexOf(".")); //$NON-NLS-1$
}
- public MetaValue getProperties(ProfileServiceConnection connection,
- final String component) {
+ public MetaValue getProperties(ProfileServiceConnection connection, final String
component) {
MetaValue propertyValue = null;
MetaValue args = null;
try {
- propertyValue = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
+ propertyValue =
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
PluginConstants.Operation.GET_PROPERTIES, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.GET_PROPERTIES; //$NON-NLS-1$
@@ -378,10 +319,7 @@
MetaValue args = null;
try {
- requestsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
-
- PluginConstants.Operation.GET_REQUESTS, args);
+ requestsCollection =
executeManagedOperation(connection, getRuntimeEngineDeployer(connection,
mc), PluginConstants.Operation.GET_REQUESTS, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
LOG.error(msg, e);
@@ -398,15 +336,11 @@
MetaValue[] args = new MetaValue[] {
MetaValueFactory.getInstance().create(vdbName),
MetaValueFactory.getInstance().create(vdbVersion),
- MetaValueFactory.getInstance().create(
- Operation.Value.MAT_VIEW_QUERY),
- MetaValueFactory.getInstance()
- .create(Long.parseLong("9999999")) }; //$NON-NLS-1$
+ MetaValueFactory.getInstance().create(Operation.Value.MAT_VIEW_QUERY),
+ MetaValueFactory.getInstance().create(Long.parseLong("9999999")) };
//$NON-NLS-1$
try {
- resultsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- VDB.Operations.EXECUTE_QUERIES, args);
+ resultsCollection =
executeManagedOperation(connection, getRuntimeEngineDeployer(connection,
mc), VDB.Operations.EXECUTE_QUERIES, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
VDB.Operations.EXECUTE_QUERIES; //$NON-NLS-1$
LOG.error(msg, e);
@@ -429,12 +363,10 @@
MetaValueFactory.getInstance().create(vdbName),
MetaValueFactory.getInstance().create(vdbVersion),
MetaValueFactory.getInstance().create(query),
- MetaValueFactory.getInstance()
- .create(Long.parseLong("9999999")) }; //$NON-NLS-1$
+ MetaValueFactory.getInstance().create(Long.parseLong("9999999")) };
//$NON-NLS-1$
try {
- result = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
+ result = executeManagedOperation(connection, getRuntimeEngineDeployer(connection,
mc),
VDB.Operations.EXECUTE_QUERIES, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " +
VDB.Operations.RELOAD_MATVIEW; //$NON-NLS-1$
@@ -508,12 +440,10 @@
ManagedComponent mcVdb = null;
try {
- mcVdb = ProfileServiceUtil
- .getManagedComponent(connection,
+ mcVdb = ProfileServiceUtil.getManagedComponent(connection,
new org.jboss.managed.api.ComponentType(
PluginConstants.ComponentType.VDB.TYPE,
- PluginConstants.ComponentType.VDB.SUBTYPE),
- vdbName);
+ PluginConstants.ComponentType.VDB.SUBTYPE), vdbName);
} catch (NamingException e) {
final String msg = "NamingException in getVDBStatus(): " +
e.getExplanation(); //$NON-NLS-1$
LOG.error(msg, e);
@@ -539,9 +469,8 @@
try {
if (args.length == 1 && args[0] == null) {
return mo.invoke();
- } else {
- return mo.invoke(args);
}
+ return mo.invoke(args);
} catch (Exception e) {
final String msg = "Exception getting the AdminApi in " + operation;
//$NON-NLS-1$
LOG.error(msg, e);
@@ -575,8 +504,7 @@
* @param mc
* @return
*/
- private static ManagedComponent getBufferService(
- ProfileServiceConnection connection, ManagedComponent mc) {
+ private static ManagedComponent getBufferService(ProfileServiceConnection connection,
ManagedComponent mc) {
try {
mc = ProfileServiceUtil.getBufferService(connection);
} catch (NamingException e) {
@@ -589,9 +517,7 @@
return mc;
}
- public static MetaValue getManagedProperty(
- ProfileServiceConnection connection, ManagedComponent mc,
- String property) throws Exception {
+ public static MetaValue getManagedProperty(ProfileServiceConnection connection,
ManagedComponent mc, String property) throws Exception {
ManagedProperty managedProperty = null;
try {
@@ -619,7 +545,7 @@
getRequestCollectionValue(requests, requestsCollection);
- if (requestsCollection != null && !requestsCollection.isEmpty()) {
+ if (!requestsCollection.isEmpty()) {
count = requestsCollection.size();
}
@@ -639,17 +565,14 @@
* @return count
* @throws Exception
*/
- private int getErrorCount(ProfileServiceConnection connection,
- String vdbName) {
+ private int getErrorCount(ProfileServiceConnection connection,String vdbName) {
ManagedComponent mcVdb = null;
try {
- mcVdb = ProfileServiceUtil
- .getManagedComponent(connection,
+ mcVdb = ProfileServiceUtil.getManagedComponent(connection,
new org.jboss.managed.api.ComponentType(
PluginConstants.ComponentType.VDB.TYPE,
- PluginConstants.ComponentType.VDB.SUBTYPE),
- vdbName);
+ PluginConstants.ComponentType.VDB.SUBTYPE),vdbName);
} catch (NamingException e) {
final String msg = "NamingException in getVDBStatus(): " +
e.getExplanation(); //$NON-NLS-1$
LOG.error(msg, e);
@@ -661,14 +584,12 @@
// Get models from VDB
int count = 0;
ManagedProperty property = mcVdb.getProperty("models"); //$NON-NLS-1$
- CollectionValueSupport valueSupport = (CollectionValueSupport) property
- .getValue();
+ CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
MetaValue[] metaValues = valueSupport.getElements();
for (MetaValue value : metaValues) {
GenericValueSupport genValueSupport = (GenericValueSupport) value;
- ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
- .getValue();
+ ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport.getValue();
// Get any model errors/warnings
MetaValue errors = managedObject.getProperty("errors").getValue();
//$NON-NLS-1$
@@ -684,14 +605,10 @@
protected MetaValue getCacheStats(ProfileServiceConnection connection,
String type) {
try {
- return executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.GET_CACHE_STATS, SimpleValueSupport
- .wrap(type));
+ return executeManagedOperation(connection,getRuntimeEngineDeployer(connection, mc),
+ Platform.Operations.GET_CACHE_STATS, SimpleValueSupport.wrap(type));
} catch (Exception e) {
- LOG
- .error(
- "Exception executing operation: " + Platform.Operations.GET_CACHE_STATS,
e); //$NON-NLS-1$
+ LOG.error("Exception executing operation: " +
Platform.Operations.GET_CACHE_STATS, e); //$NON-NLS-1$
}
return null;
}
@@ -729,61 +646,49 @@
return usedBufferSpace;
}
- private void getRequestCollectionValue(MetaValue pValue,
- Collection<Request> list) {
+ private void getRequestCollectionValue(MetaValue pValue, Collection<Request> list)
{
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
RequestMetadataMapper rmm = new RequestMetadataMapper();
RequestMetadata request = rmm.unwrapMetaValue(value);
list.add(request);
} else {
- throw new IllegalStateException(pValue
- + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue + " is not a Composite type");
//$NON-NLS-1$
}
}
}
}
- private void getResultsCollectionValue(MetaValue pValue,
- Collection<ArrayList<String>> list) {
+ private void getResultsCollectionValue(MetaValue pValue,
Collection<ArrayList<String>> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isCollection()) {
- ArrayList<String> row = (ArrayList<String>) MetaValueFactory
- .getInstance().unwrap(value);
+ ArrayList<String> row = (ArrayList<String>)
MetaValueFactory.getInstance().unwrap(value);
list.add(row);
}
}
}
}
- private void getResultsCollectionValueForMatViewRefresh(MetaValue pValue,
- Collection<ArrayList<String>> list) {
+ private void getResultsCollectionValueForMatViewRefresh(MetaValue pValue,
Collection<ArrayList<String>> list) {
MetaType metaType = pValue.getMetaType();
for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isCollection()) {
- ArrayList<String> row = (ArrayList<String>) MetaValueFactory
- .getInstance().unwrap(value);
+ ArrayList<String> row = (ArrayList<String>)
MetaValueFactory.getInstance().unwrap(value);
list.add(row);
}
}
-
}
- public static <T> void getTransactionCollectionValue(MetaValue pValue,
- Collection<Transaction> list) {
+ public static <T> void getTransactionCollectionValue(MetaValue pValue,
Collection<Transaction> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
- Transaction transaction = (Transaction) MetaValueFactory
- .getInstance().unwrap(value);
+ Transaction transaction = (Transaction)
MetaValueFactory.getInstance().unwrap(value);
list.add(transaction);
} else {
throw new IllegalStateException(pValue
@@ -793,15 +698,12 @@
}
}
- public static <T> void getSessionCollectionValue(MetaValue pValue,
- Collection<Session> list) {
+ public static <T> void getSessionCollectionValue(MetaValue
pValue,Collection<Session> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
- Session Session = (Session) MetaValueFactory.getInstance()
- .unwrap(value);
+ Session Session = (Session) MetaValueFactory.getInstance().unwrap(value);
list.add(Session);
} else {
throw new IllegalStateException(pValue
@@ -811,28 +713,23 @@
}
}
- public static <T> void getSessionCollectionValueForVDB(MetaValue pValue,
- Collection<Session> list, String vdbName) {
+ public static <T> void getSessionCollectionValueForVDB(MetaValue
pValue,Collection<Session> list, String vdbName) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
- Session session = (Session) MetaValueFactory.getInstance()
- .unwrap(value);
+ Session session = (Session) MetaValueFactory.getInstance().unwrap(value);
if (session.getVDBName().equals(vdbName)) {
list.add(session);
}
} else {
- throw new IllegalStateException(pValue
- + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue+ " is not a Composite type");
//$NON-NLS-1$
}
}
}
}
- private Collection createReportResultList(List fieldNameList,
- Iterator objectIter) {
+ private Collection createReportResultList(List fieldNameList, Iterator objectIter) {
Collection reportResultList = new ArrayList();
while (objectIter.hasNext()) {
@@ -858,16 +755,13 @@
return reportResultList;
}
- private Collection createReportResultListForMatViewQuery(
- List fieldNameList, Iterator objectIter) {
+ private Collection createReportResultListForMatViewQuery(List fieldNameList, Iterator
objectIter) {
Collection reportResultList = new ArrayList();
// Iterate through rows
while (objectIter.hasNext()) {
- ArrayList<Object> columnValues = (ArrayList<Object>) objectIter
- .next();
+ ArrayList<Object> columnValues = (ArrayList<Object>) objectIter.next();
- Class cls = null;
try {
Iterator fieldIter = fieldNameList.iterator();
Map reportValueMap = new HashMap<String, Object>();
Modified: branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-11-05
02:27:49 UTC (rev 2706)
+++ branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -351,9 +351,7 @@
Map<String, ManagedProperty> managedProperties = managedComponent
.getProperties();
- ProfileServiceUtil.convertConfigurationToManagedProperties(
- managedProperties, resourceConfig, resourceContext
- .getResourceType());
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties,
resourceConfig, resourceContext.getResourceType(), null);
try {
managementView.updateComponent(managedComponent);
@@ -398,23 +396,23 @@
DeploymentManager deploymentManager = getConnection()
.getDeploymentManager();
-
- log.debug("Stopping deployment [" + this.deploymentName + "]...");
//$NON-NLS-1$ //$NON-NLS-2$
+
+ log.debug("Stopping deployment [" + this.deploymentUrl + "]...");
//$NON-NLS-1$ //$NON-NLS-2$
DeploymentProgress progress = deploymentManager
- .stop(this.deploymentName);
+ .stop(this.deploymentUrl);
DeploymentStatus stopStatus = DeploymentUtils.run(progress);
if (stopStatus.isFailed()) {
- log.error("Failed to stop deployment '" + this.deploymentName
//$NON-NLS-1$
+ log.error("Failed to stop deployment '" + this.deploymentUrl
//$NON-NLS-1$
+ "'.", stopStatus.getFailure()); //$NON-NLS-1$
throw new Exception("Failed to stop deployment '" //$NON-NLS-1$
+ this.deploymentName + "' - cause: " //$NON-NLS-1$
+ stopStatus.getFailure());
}
- log.debug("Removing deployment [" + this.deploymentName + "]...");
//$NON-NLS-1$ //$NON-NLS-2$
- progress = deploymentManager.remove(this.deploymentName);
+ log.debug("Removing deployment [" + this.deploymentUrl + "]...");
//$NON-NLS-1$ //$NON-NLS-2$
+ progress = deploymentManager.remove(this.deploymentUrl);
DeploymentStatus removeStatus = DeploymentUtils.run(progress);
if (removeStatus.isFailed()) {
- log.error("Failed to remove deployment '" + this.deploymentName
//$NON-NLS-1$
+ log.error("Failed to remove deployment '" + this.deploymentUrl
//$NON-NLS-1$
+ "'.", removeStatus.getFailure()); //$NON-NLS-1$
throw new Exception("Failed to remove deployment '" //$NON-NLS-1$
+ this.deploymentName + "' - cause: " //$NON-NLS-1$
@@ -758,11 +756,9 @@
DeploymentTemplateInfo template;
try {
template = managementView.getTemplate(templateName);
- Map<String, ManagedProperty> managedProperties = template
- .getProperties();
+ Map<String, ManagedProperty> managedProperties = template.getProperties();
- ProfileServiceUtil.convertConfigurationToManagedProperties(
- managedProperties, resourceConfig, resourceType);
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties,
resourceConfig, resourceType, null);
LOG.debug("Applying template [" + templateName //$NON-NLS-1$
+ "] to create ManagedComponent of type [" + componentType //$NON-NLS-1$
Modified:
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
---
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -58,9 +58,6 @@
public class PlatformComponent extends Facet {
private final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
- String[] PLATFORM_SERVICES_NAMES = { "RuntimeEngineDeployer", //$NON-NLS-1$
- "BufferService", "SessionService",
"JdbcSocketConfiguration" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
@Override
public void start(ResourceContext context) {
this.setComponentName(context.getPluginConfiguration().getSimpleValue( "name",
null)); //$NON-NLS-1$
@@ -167,18 +164,18 @@
PluginConstants.ComponentType.Platform.TEIID_TYPE,
PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE);
- ManagedComponent managedComponent = null;
report.setStatus(ConfigurationUpdateStatus.SUCCESS);
try {
managementView = getConnection().getManagementView();
-
- for (String serviceName : PLATFORM_SERVICES_NAMES) {
-
- managedComponent = managementView.getComponent(serviceName, componentType);
+ Set<ManagedComponent> allComponents =
managementView.getComponentsForType(componentType);
+
+ for (ManagedComponent managedComponent : allComponents) {
+
Map<String, ManagedProperty> managedProperties =
managedComponent.getProperties();
- ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties,
resourceConfig, resourceContext.getResourceType());
+
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties,
resourceConfig, resourceContext.getResourceType(), managedComponent.getName());
try {
managementView.updateComponent(managedComponent);
@@ -234,10 +231,11 @@
} catch (Exception e) {
LOG.error("Exception getting components in Platform loadConfiguration(): " +
e.getMessage()); //$NON-NLS-1$
}
-
+
for (ManagedComponent mc : mcSet) {
Map<String, ManagedProperty> mcMap = mc.getProperties();
- setProperties(mcMap, configuration);
+ String name = mc.getName();
+ setProperties(name, mcMap, configuration);
}
}
@@ -245,12 +243,11 @@
* @param mcMap
* @param configuration
*/
- private void setProperties(Map<String, ManagedProperty> mcMap,
- Configuration configuration) {
+ private void setProperties(String compName, Map<String, ManagedProperty> mcMap,
Configuration configuration) {
for (ManagedProperty mProp : mcMap.values()) {
try {
String value = ProfileServiceUtil.stringValue(mProp.getValue());
- PropertySimple prop = new PropertySimple(mProp.getName(), value);
+ PropertySimple prop = new PropertySimple(compName+"."+mProp.getName(),
value); //$NON-NLS-1$
configuration.put(prop);
} catch (Exception e) {
LOG.error("Exception setting properties in Platform loadConfiguration():
" + e.getMessage()); //$NON-NLS-1$
Modified:
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
===================================================================
---
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -407,37 +407,33 @@
return config;
}
- public static void convertConfigurationToManagedProperties(
- Map<String, ManagedProperty> managedProperties,
- Configuration configuration, ResourceType resourceType) {
- ConfigurationDefinition configDefinition = resourceType
- .getResourceConfigurationDefinition();
+ public static void convertConfigurationToManagedProperties(Map<String,
ManagedProperty> managedProperties, Configuration configuration, ResourceType
resourceType, String prefix) {
+ ConfigurationDefinition configDefinition =
resourceType.getResourceConfigurationDefinition();
for (ManagedProperty managedProperty : managedProperties.values()) {
String propertyName = managedProperty.getName();
- PropertyDefinition propertyDefinition = configDefinition
- .get(propertyName);
+ if (prefix != null) {
+ propertyName = prefix + "." + propertyName; //$NON-NLS-1$
+ }
+ PropertyDefinition propertyDefinition = configDefinition.get(propertyName);
if (propertyDefinition == null) {
// The managed property is not defined in the configuration
continue;
}
- populateManagedPropertyFromProperty(managedProperty,
- propertyDefinition, configuration);
+ populateManagedPropertyFromProperty(managedProperty,propertyDefinition,
configuration);
}
return;
}
- public static void populateManagedPropertyFromProperty(
- ManagedProperty managedProperty,
- PropertyDefinition propertyDefinition, Configuration configuration) {
+ public static void populateManagedPropertyFromProperty(ManagedProperty managedProperty,
PropertyDefinition propertyDefinition, Configuration configuration) {
// If the ManagedProperty defines a default value, assume it's more
// definitive than any default value that may
// have been defined in the plugin descriptor, and update the
// PropertyDefinition to use that as its default
// value.
MetaValue defaultValue = managedProperty.getDefaultValue();
- if (defaultValue != null)
- updateDefaultValueOnPropertyDefinition(propertyDefinition,
- defaultValue);
+ if (defaultValue != null) {
+ updateDefaultValueOnPropertyDefinition(propertyDefinition,defaultValue);
+ }
MetaValue metaValue = managedProperty.getValue();
PropertyAdapter propertyAdapter = null;
if (metaValue != null) {
@@ -445,24 +441,15 @@
+ metaValue.getMetaType() + " from Teiid property " //$NON-NLS-1$
+ propertyDefinition.getName() + " with definition " //$NON-NLS-1$
+ propertyDefinition + "..."); //$NON-NLS-1$
- propertyAdapter = PropertyAdapterFactory
- .getPropertyAdapter(metaValue);
+ propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaValue);
- propertyAdapter.populateMetaValueFromProperty(configuration
- .getSimple(propertyDefinition.getName()), metaValue,
- propertyDefinition);
+ propertyAdapter.populateMetaValueFromProperty(configuration.getSimple(propertyDefinition.getName()),
metaValue, propertyDefinition);
managedProperty.setValue(metaValue);
} else {
MetaType metaType = managedProperty.getMetaType();
- if (propertyAdapter == null)
- propertyAdapter = PropertyAdapterFactory
- .getPropertyAdapter(metaType);
- LOG.trace("Converting property " + propertyDefinition.getName()
//$NON-NLS-1$
- + " with definition " + propertyDefinition //$NON-NLS-1$
- + " to MetaValue of type " + metaType + "..."); //$NON-NLS-1$
//$NON-NLS-2$
- metaValue = propertyAdapter.convertToMetaValue(configuration
- .getSimple(propertyDefinition.getName()),
- propertyDefinition, metaType);
+ propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaType);
+ LOG.trace("Converting property " + propertyDefinition.getName() + "
with definition " + propertyDefinition + " to MetaValue of type " +
metaType + "..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ metaValue =
propertyAdapter.convertToMetaValue(configuration.getSimple(propertyDefinition.getName()),propertyDefinition,
metaType);
managedProperty.setValue(metaValue);
}
@@ -472,10 +459,8 @@
PropertyDefinition propertyDefinition,
@NotNull MetaValue defaultValue) {
if (!(propertyDefinition instanceof PropertyDefinitionSimple)) {
- LOG
- .debug("Cannot update default value on non-simple property definition "
//$NON-NLS-1$
- + propertyDefinition
- + "(default value is " //$NON-NLS-1$
+ LOG.debug("Cannot update default value on non-simple property definition "
//$NON-NLS-1$
+ + propertyDefinition + "(default value is " //$NON-NLS-1$
+ defaultValue + ")."); //$NON-NLS-1$
return;
}
@@ -490,13 +475,11 @@
if (metaType.isSimple()) {
SimpleValue defaultSimpleValue = (SimpleValue) defaultValue;
Serializable value = defaultSimpleValue.getValue();
- propertyDefinitionSimple.setDefaultValue((value != null) ? value
- .toString() : null);
+ propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
} else { // defaultValueMetaType.isEnum()
EnumValue defaultEnumValue = (EnumValue) defaultValue;
Serializable value = defaultEnumValue.getValue();
- propertyDefinitionSimple.setDefaultValue((value != null) ? value
- .toString() : null);
+ propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
}
}
Modified: branches/7.2.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.2.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-11-05 02:27:49
UTC (rev 2706)
+++ branches/7.2.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-11-05 02:57:19
UTC (rev 2707)
@@ -296,104 +296,112 @@
property="QUERY_SERVICE_RESULT_SET_CACHE.requestCount"
description="Total number of requests made against cache" />
<resource-configuration>
- <c:group name="teiidProperties" displayName="Runtime Engine
Properties"
+ <c:group name="RuntimeEngineDeployer" displayName="Runtime Engine
Properties (restart required before modifications take effect)"
hiddenByDefault="false">
- <c:simple-property name="maxRowsFetchSize"
+ <c:simple-property name="RuntimeEngineDeployer.maxRowsFetchSize"
displayName="Max Rows Fetch Size"
description="The maximum number of result set cache entries. 0 indicates no
limit. (default 1024)"
required="false" readOnly="false" />
- <c:simple-property name="processName" displayName="Process
Name"
- description="Name that uniquely identifies this process"
required="false"
- readOnly="false" />
- <c:simple-property name="maxThreads" displayName="Max
Threads"
+ <c:simple-property name="RuntimeEngineDeployer.maxThreads"
displayName="Max Threads"
description="Process pool maximum thread count. (default 64)"
- required="false" readOnly="false" />
- <c:simple-property name="timeSliceInMilli"
+ required="false" readOnly="false" />
+ <c:simple-property
name="RuntimeEngineDeployer.maxActivePlans"
+ displayName="Maximum Concurrent Active plans"
+ description="Increase this value on highly concurrent systems -
but ensure that the underlying pools can handle the increased load without
timeouts.(default 20)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.timeSliceInMilli"
displayName="Time Slice In Milliseconds"
description="Query processor time slice, in milliseconds. (default 2000)"
required="false" readOnly="false" />
- <c:simple-property name="lobChunkSizeInKB"
+ <c:simple-property name="RuntimeEngineDeployer.lobChunkSizeInKB"
displayName="Lob Chunk Size In KB"
description="The max lob chunk size in KB transferred to the client for xml,
blobs, clobs (default 100KB)"
- required="false" readOnly="false" />
- <c:simple-property name="resultSetCacheEnabled"
- displayName="Result Set Cache Enabled"
- description="Denotes whether or not result set caching is enabled. (default
true)"
- required="false" readOnly="false" type="boolean"
/>
- <c:simple-property name="resultSetCacheMaxEntries"
- displayName="Result Set Cache Max Entries"
- description="The maximum number of result set cache entries. -1 indicates no
limit. (default 1024)"
- required="false" readOnly="false" />
- <c:simple-property name="resultSetCacheMaxEntryAge"
- displayName="Result Set Cache Max Entry Age"
- description="The maximum age of a result set cache entry in seconds. -1
indicates no max. (default 7200)"
- required="false" readOnly="false" />
- <c:simple-property name="preparedPlanCacheMaxCount"
+ required="false" readOnly="false" />
+ <c:simple-property
name="RuntimeEngineDeployer.preparedPlanCacheMaxCount"
displayName="Prepared Plan Cache Max Count"
description="The maximum number of query plans that are cached. Note: this is a
memory based cache. (default 250)"
required="false" readOnly="false" />
- <c:simple-property name="activeSessionsCount"
- displayName="Active Session Count" description="Count of active
sessions"
- required="false" readOnly="false" />
- <c:simple-property name="queryThresholdInSecs"
+ <c:simple-property name="RuntimeEngineDeployer.queryThresholdInSecs"
displayName="Long Running Query Threshold"
description="Length of time in seconds before a query is considered long
running"
required="false" readOnly="false" />
+ <c:simple-property
name="RuntimeEngineDeployer.useDataRoles"
+ displayName="Data Roles Enabled"
+ description="Turn on role checking of resources based on the
roles defined in VDB (default true)"
+ required="false" readOnly="false" />
</c:group>
- <c:group name="bufferServiceProperties" displayName="Buffer Service
Properties"
+
+ <c:group name="ResultSetCacheConfig" displayName="ResultSet
Cache Properties" hiddenByDefault="false">
+ <!-- the below property on RuntimeEngineDeployer -->
+ <c:simple-property
name="RuntimeEngineDeployer.resultSetCacheEnabled"
+ displayName="Enabled"
+ description="Denotes whether or not result set caching is
enabled. (default true)"
+ required="false" readOnly="false"
type="boolean" />
+ <c:simple-property name="ResultSetCacheConfig.maxEntries"
+ displayName="Max Entries"
+ description="The maximum number of result set cache entries. -1
indicates no limit. (default 1024)"
+ required="false" readOnly="false" />
+ <c:simple-property
name="ResultSetCacheConfig.maxAgeInSeconds"
+ displayName="Max Entry Age"
+ description="The maximum age of a result set cache entry in
seconds. -1 indicates no max. (default 7200)"
+ required="false" readOnly="false" />
+ </c:group>
+
+ <c:group name="BufferService" displayName="Buffer Service
Properties"
hiddenByDefault="false">
- <c:simple-property name="maxBufferSpace"
+ <c:simple-property name="BufferService.maxBufferSpace"
displayName="Max Buffer Space"
description="Max file storage space, in MB, to be used for buffer files
(default 50G)"
required="false" readOnly="false" />
- <c:simple-property name="processorBatchSize"
+ <c:simple-property name="BufferService.processorBatchSize"
displayName="Processor Batch Size"
description="The max row count of a batch sent internally within the query
processor. Should be <= the connectorBatchSize. (default 512)"
required="false" readOnly="false" />
- <c:simple-property name="connectorBatchSize"
+ <c:simple-property name="BufferService.connectorBatchSize"
displayName="Connector Batch Size"
description="The max row count of a batch from a connector. Should be even
multiple of processorBatchSize. (default 1024)"
required="false" readOnly="false" />
- <c:simple-property name="maxProcessingBatchesColumns"
+ <c:simple-property name="BufferService.maxProcessingBatchesColumns"
displayName="Max Processing Batches Columns"
description="The number of batch columns guarenteed to a processing operation.
Set this value lower if the workload typically processes larger numbers of concurrent
queries with large intermediate results from operations such as sorting, grouping, etc.
(default 128)"
required="false" readOnly="false" />
- <c:simple-property name="maxFileSize" displayName="Max File
Size"
+ <c:simple-property name="BufferService.maxFileSize"
displayName="Max File Size"
description="Max file size for buffer files (default 2GB)"
required="false" readOnly="false" />
- <c:simple-property name="maxReserveBatchColumns"
+ <c:simple-property name="BufferService.maxReserveBatchColumns"
displayName="Max Reserve Batch Columns"
description="The number of batch columns to allow in memory (default 16384).
This value should be set lower or higher depending on the available memory to Teiid in the
VM. 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1
gig heap."
required="false" readOnly="false" />
</c:group>
- <c:group name="jdbcSocketConfigurationProperties"
- displayName="Jdbc Socket Configuration Properties"
hiddenByDefault="false">
- <c:simple-property name="portNumber" displayName="Port
Number"
+ <c:group name="JdbcSocketConfiguration" displayName="Jdbc Socket
Configuration Properties" hiddenByDefault="false">
+ <c:simple-property name="JdbcSocketConfiguration.enabled"
displayName="Enable"
+ description="Enable Socket based JDBC access"
required="false" readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.hostName"
displayName="Host Name"
+ description="Host Name" required="false"
readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.portNumber"
displayName="Port Number"
description="Port Number" required="false"
readOnly="false" />
- <c:simple-property name="sslEnabled" displayName="SSL
Enabled"
- description="SSL enabled" required="false"
readOnly="false" type="boolean"
+ <c:simple-property name="JdbcSocketConfiguration.sslEnabled"
displayName="SSL Enabled"
+ description="SSL enabled" required="false"
readOnly="true" type="boolean"
default="true" />
- <c:simple-property name="hostName" displayName="Host Name"
- description="Host Name" required="false"
readOnly="false" />
- <c:simple-property name="maxSocketThreads"
+ <c:simple-property name="JdbcSocketConfiguration.maxSocketThreads"
displayName="Max Socket Threads" description="Max NIO threads"
required="false" readOnly="false" />
- <c:simple-property name="inputBufferSize"
+ <c:simple-property name="JdbcSocketConfiguration.inputBufferSize"
displayName="Input Buffer Size"
description="SO_RCVBUF size, 0 indicates that system default should be used
(default 0)"
required="false" readOnly="false" />
- <c:simple-property name="outputBufferSize"
+ <c:simple-property name="JdbcSocketConfiguration.outputBufferSize"
displayName="Output Buffer Size"
description="SO_SNDBUF size, 0 indicates that system default should be used
(default 0)"
required="false" readOnly="false" />
</c:group>
- <c:group name="sessionServiceProperties" displayName="Session
Service Properties"
+ <c:group name="SessionService" displayName="Session Service
Properties"
hiddenByDefault="false">
- <c:simple-property name="sessionExpirationTimeLimit"
+ <c:simple-property name="SessionService.sessionExpirationTimeLimit"
displayName="Session Expiration Time Limit"
description="Max allowed time before the session is terminated by the system, 0
indicates unlimited (default 0)"
required="false" readOnly="false" />
- <c:simple-property name="sessionMaxLimit"
+ <c:simple-property name="SessionService.sessionMaxLimit"
displayName="Session Max Limit"
description="Maximum number of sessions allowed by the system (default
5000)"
required="false" readOnly="false" />
Modified:
branches/7.2.x/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml
===================================================================
---
branches/7.2.x/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-11-05
02:57:19 UTC (rev 2707)
@@ -37,6 +37,17 @@
<para>The connectAsAdmin methods create a contextual connection to the
AdminAPI of the Teiid Server. The connect methods return an extension of the Groovy Sql
object to be used for Sql calls to the Teiid Server.</para>
</answer>
</qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>What does "getAdmin()" call do? Why do I need
it?</para>
+ </question>
+ <answer>
+ <para>"getAdmin()" returns this contextual connection object
created when you executed "connectAsAdmin()" method.
+ This object implements the interface "org.teiid.adminapi.Admin" and
AdminShell commands provided are
+ wrappers around this API. Advanced users can use this API directly if the
provided wrapper commands do not meet their needs.</para>
+ </answer>
+ </qandaentry>
<qandaentry>
<question>
Modified: branches/7.2.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2010-11-05
02:27:49 UTC (rev 2706)
+++ branches/7.2.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -22,6 +22,13 @@
package org.teiid.cache;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"),
properties=ManagementProperties.EXPLICIT)
public class CacheConfiguration {
public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60,
100); // 1 hours with 100 nodes.
@@ -35,6 +42,7 @@
private int maxage;
private int maxEntries;
private boolean enabled = true;
+ private String name;
public CacheConfiguration() {
}
@@ -48,7 +56,8 @@
public Policy getPolicy() {
return this.policy;
}
-
+
+ @ManagementProperty(description="The maximum age of a result set cache entry in
seconds. -1 indicates no max. (default 7200)")
public int getMaxAgeInSeconds(){
return maxage;
}
@@ -57,6 +66,7 @@
this.maxage = maxage;
}
+ @ManagementProperty(description="The maximum number of result set cache entries. -1
indicates no limit. (default 1024)")
public int getMaxEntries() {
return this.maxEntries;
}
@@ -69,6 +79,16 @@
this.policy = Policy.valueOf(type);
}
+ @ManagementProperty(description="Name of the configuration", readOnly=true)
+ @ManagementObjectID(type="cache")
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -104,11 +104,6 @@
public void setPreparedPlanCacheMaxCount(int preparedPlanCacheMaxCount) {
this.preparedPlanCacheMaxCount = preparedPlanCacheMaxCount;
}
-
- @ManagementProperty(description="The maximum number of result set cache entries. -1
indicates no limit. (default 1024)")
- public int getResultSetCacheMaxEntries() {
- return this.resultsetCacheConfig.getMaxEntries();
- }
public CacheConfiguration getResultsetCacheConfig() {
return this.resultsetCacheConfig;
@@ -120,29 +115,20 @@
@ManagementProperty(description="Denotes whether or not result set caching is
enabled. (default true)")
public boolean isResultSetCacheEnabled() {
- return this.resultsetCacheConfig.isEnabled();
+ return this.resultsetCacheConfig != null &&
this.resultsetCacheConfig.isEnabled();
}
- @ManagementProperty(description="The maximum age of a result set cache entry in
seconds. -1 indicates no max. (default 7200)")
- public int getResultSetCacheMaxEntryAge() {
- return this.resultsetCacheConfig.getMaxAgeInSeconds();
- }
-
- public void setResultSetCacheMaxEntryAge(int maxAge) {
- this.resultsetCacheConfig.setMaxAgeInSeconds(maxAge);
- }
-
/**
* Determine whether role checking is enabled on the server.
* @return <code>true</code> if server-side role checking is enabled.
*/
@ManagementProperty(description="Turn on role checking on resources based on the
roles defined in VDB")
- public boolean useDataRoles() {
+ public boolean getUseDataRoles() {
return useDataRoles;
}
- public void setUseDataRoles(Boolean useEntitlements) {
- this.useDataRoles = useEntitlements.booleanValue();
+ public void setUseDataRoles(boolean useEntitlements) {
+ this.useDataRoles = useEntitlements;
}
@ManagementProperty(description="Long running query threshold, after which a alert
can be generated by tooling if configured")
Modified: branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -681,7 +681,7 @@
public void start(DQPConfiguration config) {
this.processorTimeslice = config.getTimeSliceInMilli();
this.maxFetchSize = config.getMaxRowsFetchSize();
- this.useEntitlements = config.useDataRoles();
+ this.useEntitlements = config.getUseDataRoles();
this.queryThreshold = config.getQueryThresholdInSecs();
this.maxSourceRows = config.getMaxSourceRows();
this.exceptionOnMaxSourceRows = config.isExceptionOnMaxSourceRows();
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -29,7 +29,6 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -199,9 +198,6 @@
if (this.policies == null) {
this.policies = new HashMap<String, DataPolicy>();
Set<String> userRoles = getUserRoles();
- if (userRoles.isEmpty()) {
- return this.policies;
- }
// get data roles from the VDB
for (DataPolicy policy : getVDB().getDataPolicies()) {
@@ -217,13 +213,7 @@
if (policy.isAnyAuthenticated()) {
return true;
}
- List<String> roles = policy.getMappedRoleNames();
- for (String role:roles) {
- if (userRoles.contains(role)) {
- return true;
- }
- }
- return false;
+ return !Collections.disjoint(policy.getMappedRoleNames(), userRoles);
}
private Set<String> getUserRoles() {
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -60,6 +60,7 @@
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.query.parser.ParseInfo;
+import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.BatchCollector;
import org.teiid.query.processor.QueryProcessor;
import org.teiid.query.sql.lang.Command;
@@ -333,19 +334,33 @@
protected void processNew() throws TeiidProcessingException, TeiidComponentException {
SessionAwareCache<CachedResults> rsCache = dqpCore.getRsCache();
- ParseInfo pi = Request.createParseInfo(requestMsg);
- CacheID cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString());
- boolean cachable = cacheId.setParameters(requestMsg.getParameterValues());
- if (rsCache != null && cachable) {
- CachedResults cr = rsCache.get(cacheId);
- if (cr != null && (requestMsg.useResultSetCache() || cr.getHint() != null)) {
- this.resultsBuffer = cr.getResults();
- this.analysisRecord = cr.getAnalysisRecord();
- request.initMetadata();
- this.originalCommand = cr.getCommand(requestMsg.getCommandString(), request.metadata,
pi);
- request.validateAccess(this.originalCommand);
- this.doneProducingBatches();
- return;
+
+ boolean cachable = false;
+ CacheID cacheId = null;
+ boolean canUseCached = (requestMsg.useResultSetCache() ||
+ QueryParser.getQueryParser().parseCacheHint(requestMsg.getCommandString()) != null);
+
+ if (rsCache != null) {
+ if (!canUseCached) {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "No cache
directive"); //$NON-NLS-1$
+ } else {
+ ParseInfo pi = Request.createParseInfo(requestMsg);
+ cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString());
+ cachable = cacheId.setParameters(requestMsg.getParameterValues());
+ if (cachable) {
+ CachedResults cr = rsCache.get(cacheId);
+ if (cr != null) {
+ this.resultsBuffer = cr.getResults();
+ this.analysisRecord = cr.getAnalysisRecord();
+ request.initMetadata();
+ this.originalCommand = cr.getCommand(requestMsg.getCommandString(),
request.metadata, pi);
+ request.validateAccess(this.originalCommand);
+ this.doneProducingBatches();
+ return;
+ }
+ } else {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Parameters are not
serializable - cache cannot be used for", cacheId); //$NON-NLS-1$
+ }
}
}
request.processRequest();
@@ -356,6 +371,7 @@
processor = request.processor;
resultsBuffer = processor.createTupleBuffer();
if (this.cid != null && originalCommand.getCacheHint() != null) {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Using cache hint",
originalCommand.getCacheHint()); //$NON-NLS-1$
resultsBuffer.setPrefersMemory(originalCommand.getCacheHint().getPrefersMemory());
}
collector = new BatchCollector(processor, resultsBuffer) {
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -39,6 +39,8 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
import org.teiid.query.function.metadata.FunctionMethod;
import org.teiid.query.parser.ParseInfo;
import org.teiid.vdb.runtime.VDBKey;
@@ -117,7 +119,10 @@
}
if (result != null) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Cache hit for", id);
//$NON-NLS-1$
cacheHit.getAndIncrement();
+ } else {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Cache miss for", id);
//$NON-NLS-1$
}
return result;
}
@@ -140,6 +145,7 @@
public void put(CacheID id, int determinismLevel, T t, Long ttl){
if (determinismLevel >= FunctionMethod.SESSION_DETERMINISTIC) {
id.setSessionId(id.originalSessionId);
+ LogManager.logTrace(LogConstants.CTX_DQP, "Adding to session/local cache",
id); //$NON-NLS-1$
this.localCache.put(id, t, ttl);
}
else {
@@ -161,6 +167,7 @@
}
if (insert) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Adding to global/distributed
cache", id); //$NON-NLS-1$
this.distributedCache.put(id, t, ttl);
}
}
@@ -173,6 +180,8 @@
public void clearAll(){
this.localCache.clear();
this.distributedCache.clear();
+ this.totalRequests.set(0);
+ this.cacheHit.set(0);
}
public void clearForVDB(String vdbName, int version) {
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -233,7 +233,7 @@
return;
}
if (! CapabilitiesUtil.supportsScalarFunction(modelID, obj, metadata,
capFinder)) {
- markInvalid(obj, (obj.isImplicit()?"(implicit)
convert":"") + " Function not supported by source");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ markInvalid(obj, (obj.isImplicit()?"(implicit) ":"")
+ obj.getName() + " function not supported by source"); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
}
} catch(QueryMetadataException e) {
handleException(new TeiidComponentException(e));
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -184,13 +184,11 @@
if (combined.size() < 2) {
root = combined.values().iterator().next();
- root.removeProperty(NodeConstants.Info.EST_CARDINALITY);
} else {
root = RulePlanJoins.createJoinNode();
for (Map.Entry<PlanNode, PlanNode> entry : combined.entrySet()) {
PlanNode joinSourceRoot = entry.getValue();
- joinSourceRoot.removeProperty(NodeConstants.Info.EST_CARDINALITY);
if (root.getChildCount() == 2) {
PlanNode parentJoin = RulePlanJoins.createJoinNode();
parentJoin.addFirstChild(root);
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -827,7 +827,7 @@
*/
private static float getNDV(Collection<ElementSymbol> elements, PlanNode
current, float cardinality, QueryMetadataInterface metadata)
throws QueryMetadataException, TeiidComponentException {
- float result = 1;
+ float result = UNKNOWN_VALUE;
for (ElementSymbol elementSymbol : elements) {
Object elemID = elementSymbol.getMetadataID();
@@ -844,9 +844,6 @@
}
}
}
- if (ndv == UNKNOWN_VALUE) {
- return UNKNOWN_VALUE;
- }
} else if (cardinality != UNKNOWN_VALUE) {
int groupCardinality =
metadata.getCardinality(elementSymbol.getGroupSymbol().getMetadataID());
if (groupCardinality != UNKNOWN_VALUE && groupCardinality >
cardinality) {
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -489,6 +489,7 @@
}
static PlanNode performRaise(PlanNode rootNode, PlanNode accessNode, PlanNode
parentNode) {
+ accessNode.removeProperty(NodeConstants.Info.EST_CARDINALITY);
NodeEditor.removeChildNode(parentNode, accessNode);
parentNode.addAsParent(accessNode);
PlanNode grandparentNode = accessNode.getParent();
Modified: branches/7.2.x/engine/src/main/java/org/teiid/query/parser/QueryParser.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/query/parser/QueryParser.java 2010-11-05
02:27:49 UTC (rev 2706)
+++ branches/7.2.x/engine/src/main/java/org/teiid/query/parser/QueryParser.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -26,6 +26,7 @@
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.query.QueryPlugin;
+import org.teiid.query.sql.lang.CacheHint;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.symbol.Expression;
@@ -123,6 +124,13 @@
}
return result;
}
+
+ public CacheHint parseCacheHint(String sql) throws QueryParserException {
+ if(sql == null || sql.length() == 0) {
+ throw new
QueryParserException(QueryPlugin.Util.getString("QueryParser.emptysql"));
//$NON-NLS-1$
+ }
+ return SQLParserUtil.getQueryCacheOption(sql);
+ }
/**
* Takes a SQL string representing an SQL criteria (i.e. just the WHERE
Modified: branches/7.2.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -115,7 +115,6 @@
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.PredicateCriteria.Negatable;
import org.teiid.query.sql.navigator.PostOrderNavigator;
-import org.teiid.query.sql.navigator.PreOrderNavigator;
import org.teiid.query.sql.proc.Block;
import org.teiid.query.sql.proc.CommandStatement;
import org.teiid.query.sql.proc.CreateUpdateProcedureCommand;
@@ -543,31 +542,18 @@
if (!(userCmd instanceof TranslatableProcedureContainer)) {
return FALSE_CRITERIA;
}
-
+
Criteria userCriteria = ((TranslatableProcedureContainer)userCmd).getCriteria();
-
- if(userCriteria == null) {
- return FALSE_CRITERIA;
+
+ if (userCriteria == null) {
+ return TRUE_CRITERIA;
}
// get the symbolmap between virtual elements and theie counterpart expressions
// from the virtual group's query transform
CriteriaTranslatorVisitor translateVisitor = new
CriteriaTranslatorVisitor(procCommand.getSymbolMap());
- // check if there is a CriteriaSelector specified to restrict
- // parts of user's criteria to be translated
- // get the CriteriaSelector, elements on the selector and the selector type
- CriteriaSelector selector = transCrit.getSelector();
- HasCriteria hasCrit = new HasCriteria(selector);
-
- // base on the selector evaluate Has criteria, if false
- // return a false criteria
- Criteria result = rewriteCriteria(hasCrit);
-
- if(result.equals(FALSE_CRITERIA)) {
- return FALSE_CRITERIA;
- }
- translateVisitor.setCriteriaSelector(selector);
+ translateVisitor.setCriteriaSelector(transCrit.getSelector());
if(transCrit.hasTranslations()) {
translateVisitor.setTranslations(transCrit.getTranslations());
}
@@ -575,14 +561,12 @@
// create a clone of user's criteria that is then translated
Criteria userClone = (Criteria) userCriteria.clone();
- // CriteriaTranslatorVisitor visits the user's criteria
- PreOrderNavigator.doVisit(userClone, translateVisitor);
+ translateVisitor.translate(userClone);
// translated criteria
- translatedCriteria = translateVisitor.getTranslatedCriteria();
((TranslatableProcedureContainer)userCmd).addImplicitParameters(translateVisitor.getImplicitParams());
- translatedCriteria = rewriteCriteria(translatedCriteria);
+ translatedCriteria = rewriteCriteria(userClone);
// apply any implicit conversions
try {
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/query/sql/visitor/CriteriaTranslatorVisitor.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/sql/visitor/CriteriaTranslatorVisitor.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/sql/visitor/CriteriaTranslatorVisitor.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -22,22 +22,23 @@
package org.teiid.query.sql.visitor;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.Assertion;
+import org.teiid.query.QueryPlugin;
import org.teiid.query.sql.lang.BetweenCriteria;
import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.DependentSetCriteria;
import org.teiid.query.sql.lang.IsNullCriteria;
import org.teiid.query.sql.lang.MatchCriteria;
import org.teiid.query.sql.lang.SetCriteria;
+import org.teiid.query.sql.navigator.PreOrderNavigator;
import org.teiid.query.sql.proc.CriteriaSelector;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
@@ -52,16 +53,108 @@
* of the elements those translations override any symbol mappings.</p>
*/
public class CriteriaTranslatorVisitor extends ExpressionMappingVisitor {
+
+ class CriteriaTranslatorNavigator extends PreOrderNavigator {
+ public CriteriaTranslatorNavigator() {
+ super(CriteriaTranslatorVisitor.this);
+ }
+
+ /**
+ * <p> This method updates the <code>BetweenCriteria</code> object
it receives as an
+ * argument by replacing the virtual elements present in the expressions in the
+ * function with translated expressions.</p>
+ * @param obj The BetweenCriteria object to be updated with translated expressions
+ */
+ public void visit(BetweenCriteria obj) {
+ if (!selectorContainsCriteriaElements(obj, CriteriaSelector.BETWEEN)) {
+ throw new TeiidRuntimeException(new
QueryValidatorException(QueryPlugin.Util.getString("Translate.error", obj,
selector))); //$NON-NLS-1$
+ }
+ super.visit(obj);
+ }
+
+ /**
+ * <p> This method updates the <code>CompareCriteria</code> object
it receives as an
+ * argument by replacing the virtual elements present in the expressions in the
+ * function with translated expressions.</p>
+ * @param obj The CompareCriteria object to be updated with translated expressions
+ */
+ public void visit(CompareCriteria obj) {
+
+ if (!selectorContainsCriteriaElements(obj, obj.getOperator())) {
+ throw new TeiidRuntimeException(new
QueryValidatorException(QueryPlugin.Util.getString("Translate.error", obj,
selector))); //$NON-NLS-1$
+ }
+
+ super.visit(obj);
+ }
+
+ /**
+ * <p> This method updates the <code>IsNullCriteria</code> object
it receives as an
+ * argument by replacing the virtual elements present in the expressions in the
+ * function with translated expressions.</p>
+ * @param obj The IsNullCriteria object to be updated with translated expressions
+ */
+ public void visit(IsNullCriteria obj) {
+
+ if (!selectorContainsCriteriaElements(obj, CriteriaSelector.IS_NULL)) {
+ throw new TeiidRuntimeException(new
QueryValidatorException(QueryPlugin.Util.getString("Translate.error", obj,
selector))); //$NON-NLS-1$
+ }
+ super.visit(obj);
+ }
+
+ /**
+ * <p> This method updates the <code>MatchCriteria</code> object
it receives as an
+ * argument by replacing the virtual elements present in the expressions in the
+ * function with translated expressions</p>
+ * @param obj The SetCriteria object to be updated with translated expressions
+ */
+ public void visit(MatchCriteria obj) {
+
+ if (!selectorContainsCriteriaElements(obj, CriteriaSelector.LIKE)) {
+ throw new TeiidRuntimeException(new
QueryValidatorException(QueryPlugin.Util.getString("Translate.error", obj,
selector))); //$NON-NLS-1$
+ }
+
+ super.visit(obj);
+ }
+
+ /**
+ * <p> This method updates the <code>SetCriteria</code> object it
receives as an
+ * argument by replacing the virtual elements present in the expressions in the
+ * function with translated expressions</p>
+ * @param obj The SetCriteria object to be updated with translated expressions
+ */
+ public void visit(SetCriteria obj) {
+
+ if (!selectorContainsCriteriaElements(obj, CriteriaSelector.IN)) {
+ throw new TeiidRuntimeException(new
QueryValidatorException(QueryPlugin.Util.getString("Translate.error", obj,
selector))); //$NON-NLS-1$
+ }
+
+ super.visit(obj);
+ }
+
+ /**
+ * <p> This method updates the <code>SetCriteria</code> object it
receives as an
+ * argument by replacing the virtual elements present in the expressions in the
+ * function with translated expressions</p>
+ * @param obj The SetCriteria object to be updated with translated expressions
+ */
+ public void visit(DependentSetCriteria obj) {
+
+ if (!selectorContainsCriteriaElements(obj, CriteriaSelector.IN)) {
+ throw new TeiidRuntimeException(new
QueryValidatorException(QueryPlugin.Util.getString("Translate.error", obj,
selector))); //$NON-NLS-1$
+ }
+
+ super.visit(obj);
+ }
+
+ }
+
// criteria selector specified on the TranslateCriteria obj
private CriteriaSelector selector;
// translation in for of CompareCriteria objs on the TranslateCriteria obj
private Collection translations;
- // list of translated criteria
- private List<Criteria> translatedCriteria = new ArrayList<Criteria>();
-
private Map<ElementSymbol, Reference> implicitParams = new
HashMap<ElementSymbol, Reference>();
/**
@@ -101,101 +194,6 @@
this.translations = translations;
}
- // ############### Visitor methods for language objects ##################
-
- /**
- * <p> This method updates the <code>BetweenCriteria</code> object
it receives as an
- * argument by replacing the virtual elements present in the expressions in the
- * function with translated expressions.</p>
- * @param obj The BetweenCriteria object to be updated with translated expressions
- */
- public void visit(BetweenCriteria obj) {
- if (!selectorContainsCriteriaElements(obj, CriteriaSelector.BETWEEN)) {
- return;
- }
- super.visit(obj);
- translatedCriteria.add(obj);
- }
-
- /**
- * <p> This method updates the <code>CompareCriteria</code> object
it receives as an
- * argument by replacing the virtual elements present in the expressions in the
- * function with translated expressions.</p>
- * @param obj The CompareCriteria object to be updated with translated expressions
- */
- public void visit(CompareCriteria obj) {
-
- if (!selectorContainsCriteriaElements(obj, obj.getOperator())) {
- return;
- }
-
- super.visit(obj);
- translatedCriteria.add(obj);
- }
-
- /**
- * <p> This method updates the <code>IsNullCriteria</code> object
it receives as an
- * argument by replacing the virtual elements present in the expressions in the
- * function with translated expressions.</p>
- * @param obj The IsNullCriteria object to be updated with translated expressions
- */
- public void visit(IsNullCriteria obj) {
-
- if (!selectorContainsCriteriaElements(obj, CriteriaSelector.IS_NULL)) {
- return;
- }
- super.visit(obj);
- translatedCriteria.add(obj);
- }
-
- /**
- * <p> This method updates the <code>MatchCriteria</code> object it
receives as an
- * argument by replacing the virtual elements present in the expressions in the
- * function with translated expressions</p>
- * @param obj The SetCriteria object to be updated with translated expressions
- */
- public void visit(MatchCriteria obj) {
-
- if (!selectorContainsCriteriaElements(obj, CriteriaSelector.LIKE)) {
- return;
- }
-
- super.visit(obj);
- translatedCriteria.add(obj);
- }
-
- /**
- * <p> This method updates the <code>SetCriteria</code> object it
receives as an
- * argument by replacing the virtual elements present in the expressions in the
- * function with translated expressions</p>
- * @param obj The SetCriteria object to be updated with translated expressions
- */
- public void visit(SetCriteria obj) {
-
- if (!selectorContainsCriteriaElements(obj, CriteriaSelector.IN)) {
- return;
- }
-
- super.visit(obj);
- translatedCriteria.add(obj);
- }
-
- /**
- * <p> This method updates the <code>SetCriteria</code> object it
receives as an
- * argument by replacing the virtual elements present in the expressions in the
- * function with translated expressions</p>
- * @param obj The SetCriteria object to be updated with translated expressions
- */
- public void visit(DependentSetCriteria obj) {
-
- if (!selectorContainsCriteriaElements(obj, CriteriaSelector.IN)) {
- return;
- }
-
- super.visit(obj);
- translatedCriteria.add(obj);
- }
-
/* ############### Helper Methods ################## */
private boolean selectorContainsCriteriaElements(Criteria criteria, int criteriaType)
{
@@ -249,26 +247,17 @@
return super.replaceExpression(obj);
}
- /**
- * <p>Gets the criteria translated by this visitor, differrent parts of the
user's
- * criteria are translated and they are combined as a
<code>CompoundCriteria</code>
- * using an AND operator. Returns a null if no part of the user's criteria could
- * be translated.</p>
- * @return The criteria after vistor completes translation of the criteria on the
- * virtual group
- */
- public Criteria getTranslatedCriteria() {
- if(translatedCriteria.size() > 0) {
- if(translatedCriteria.size() == 1) {
- return translatedCriteria.get(0);
- }
- return new CompoundCriteria(CompoundCriteria.AND, translatedCriteria);
- }
- return null;
- }
-
public Map<ElementSymbol, Reference> getImplicitParams() {
return implicitParams;
}
+ public void translate(Criteria crit) throws QueryValidatorException {
+ CriteriaTranslatorNavigator nav = new CriteriaTranslatorNavigator();
+ try {
+ crit.acceptVisitor(nav);
+ } catch (TeiidRuntimeException e) {
+ throw (QueryValidatorException)e.getCause();
+ }
+ }
+
}
Modified:
branches/7.2.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
---
branches/7.2.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -489,7 +489,10 @@
}
}
+ List<ElementSymbol> variables = table.getColumns();
+
if (ts == null) {
+ variables = allColumns;
//TODO: coordinate a distributed load
//TODO: order by primary key nulls first - then have an insert ordered optimization
String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
@@ -510,7 +513,7 @@
}
//TODO: if this insert fails, it's unnecessary to do the undo processing
- table.insert(ts, table.getColumns());
+ table.insert(ts, variables);
rowCount = table.getRowCount();
//TODO: could pre-process indexes to remove overlap
for (Object index : metadata.getIndexesInGroup(group.getMetadataID())) {
Modified: branches/7.2.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.2.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-11-05
02:27:49 UTC (rev 2706)
+++ branches/7.2.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-11-05
02:57:19 UTC (rev 2707)
@@ -881,4 +881,6 @@
failed_to_unwrap_connection=Failed to unwrap the source connection.
connection_factory_not_found=Failed to the Connection Factory with JNDI name {0}. Please
check the name for spelling or deploy the Connection Factory with specified name.
-RelationalPlanner.nonpushdown_command=Source command "{0}" contains
non-pushdown constructs.
\ No newline at end of file
+RelationalPlanner.nonpushdown_command=Source command "{0}" contains
non-pushdown constructs.
+
+Translate.error=Cannot translate criteria "{0}", it is not matched by selector
"{1}"
\ No newline at end of file
Modified:
branches/7.2.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
===================================================================
---
branches/7.2.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -26,7 +26,9 @@
import org.mockito.Mockito;
import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.util.UnitTestUtil;
import junit.framework.TestCase;
@@ -67,12 +69,27 @@
public void testClearPolicies() {
DQPWorkContext message = new DQPWorkContext();
message.setSession(Mockito.mock(SessionMetadata.class));
+ Mockito.stub(message.getSession().getVdb()).toReturn(new VDBMetaData());
Map<String, DataPolicy> map = message.getAllowedDataPolicies();
map.put("role", Mockito.mock(DataPolicy.class)); //$NON-NLS-1$
assertFalse(map.isEmpty());
message.setSession(Mockito.mock(SessionMetadata.class));
+ Mockito.stub(message.getSession().getVdb()).toReturn(new VDBMetaData());
map = message.getAllowedDataPolicies();
assertTrue(map.isEmpty());
}
+
+ public void testAnyAuthenticated() {
+ DQPWorkContext message = new DQPWorkContext();
+ message.setSession(Mockito.mock(SessionMetadata.class));
+ VDBMetaData vdb = new VDBMetaData();
+ DataPolicyMetadata dpm = new DataPolicyMetadata();
+ dpm.setAnyAuthenticated(true);
+ vdb.addDataPolicy(dpm);
+ Mockito.stub(message.getSession().getVdb()).toReturn(vdb);
+
+ Map<String, DataPolicy> map = message.getAllowedDataPolicies();
+ assertEquals(1, map.size());
+ }
}
Modified:
branches/7.2.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
===================================================================
---
branches/7.2.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -22,13 +22,15 @@
package org.teiid.query.optimizer;
+import static org.junit.Assert.*;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import junit.framework.TestCase;
-
+import org.junit.Test;
+import org.teiid.metadata.Column;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
@@ -48,9 +50,8 @@
import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.FakeMetadataObject;
-
-
-public class TestDependentJoins extends TestCase {
+@SuppressWarnings("nls")
+public class TestDependentJoins {
static void checkDependentGroups(ProcessorPlan plan, String[] groups) {
if(! (plan instanceof RelationalPlan)) {
@@ -130,7 +131,7 @@
}
}
- public void testOptionMakeDep1() throws Exception {
+ @Test public void testOptionMakeDep1() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
@@ -161,7 +162,7 @@
});
}
- public void testOptionMakeDep2() throws Exception {
+ @Test public void testOptionMakeDep2() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, false);
@@ -191,7 +192,7 @@
});
}
- public void testDepJoinHintForceLeft() throws Exception {
+ @Test public void testDepJoinHintForceLeft() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select * FROM vm1.g4 option
makedep pm1.g1", TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g2 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING
); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -213,7 +214,7 @@
checkDependentGroups(plan, new String[] {"pm1.g1"});
//$NON-NLS-1$
}
- public void testDepJoinHintForceRight() throws Exception {
+ @Test public void testDepJoinHintForceRight() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select * FROM vm1.g4 option
makedep pm1.g2", TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g2 AS g_0 WHERE g_0.e1 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING
); //$NON-NLS-1$ //$NON-NLS-2$
@@ -236,7 +237,7 @@
checkDependentGroups(plan, new String[] {"pm1.g2"});
//$NON-NLS-1$
}
- public void testDepJoinMultiGroupBaseline() throws Exception {
+ @Test public void testDepJoinMultiGroupBaseline() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select vm1.g4.*, pm1.g3.e1 FROM
vm1.g4, pm1.g3 where pm1.g3.e1=vm1.g4.e1", TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", //$NON-NLS-1$
"SELECT pm1.g2.e1 FROM pm1.g2", //$NON-NLS-1$
@@ -260,7 +261,7 @@
checkDependentGroups(plan, new String[0]);
}
- public void testDepJoinMultiGroupForceOther() throws Exception {
+ @Test public void testDepJoinMultiGroupForceOther() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select vm1.g4.*, pm1.g3.e1 FROM
vm1.g4, pm1.g3 where pm1.g3.e1=vm1.g4.e1 option makedep pm1.g2",
TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g3 AS g_0", "SELECT
g_0.e1 FROM pm1.g2 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT
g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false),
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -282,7 +283,7 @@
checkDependentGroups(plan, new String[] {"pm1.g2"});
//$NON-NLS-1$
}
- public void testDepJoinHintForceLeft_NotDep() throws Exception {
+ @Test public void testDepJoinHintForceLeft_NotDep() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select * FROM vm1.g4 option
makedep pm1.g1 makenotdep pm1.g2", TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g2 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING
); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -305,7 +306,7 @@
checkNotDependentGroups(plan, new String[] {"pm1.g2"});
//$NON-NLS-1$
}
- public void testDepJoinHintForceRight_NotDep() throws Exception {
+ @Test public void testDepJoinHintForceRight_NotDep() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select * FROM vm1.g4 option
makedep pm1.g2 makenotdep pm1.g1", TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g2 AS g_0 WHERE g_0.e1 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING
); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -328,7 +329,7 @@
checkNotDependentGroups(plan, new String[] {"pm1.g1"});
//$NON-NLS-1$
}
- public void testDepJoinMultiGroupForceOther_NotDep() throws Exception {
+ @Test public void testDepJoinMultiGroupForceOther_NotDep() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select vm1.g4.*, pm1.g3.e1 FROM
vm1.g4, pm1.g3 where pm1.g3.e1=vm1.g4.e1 option makedep pm1.g2 makenotdep pm1.g1,
pm1.g3", TestOptimizer.example1(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g3 AS g_0", "SELECT
g_0.e1 FROM pm1.g2 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT
g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false),
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -354,7 +355,7 @@
/**
* Test that access node with unsatisfied access pattern is made dependent
*/
- public void testMakeDependentAccessPattern1() throws Exception {
+ @Test public void testMakeDependentAccessPattern1() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1,
pm4.g1 where pm1.g1.e1 = pm4.g1.e1", FakeMetadataFactory.example1Cached(),
//$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
//$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
@@ -364,7 +365,7 @@
* Test that access node with unsatisfied access pattern is made dependent
* (Same query written slightly different way)
*/
- public void testMakeDependentAccessPattern1a() throws Exception {
+ @Test public void testMakeDependentAccessPattern1a() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm4.g1,
pm1.g1 where pm4.g1.e1 = pm1.g1.e1", FakeMetadataFactory.example1Cached(),
//$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
//$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
@@ -373,7 +374,7 @@
/**
* Test that access node with unsatisfied access pattern is made dependent
*/
- public void testMakeDependentAccessPattern2() throws Exception {
+ @Test public void testMakeDependentAccessPattern2() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1,
pm4.g1 where pm4.g1.e2 = 1 and pm1.g1.e1 = pm4.g1.e1",
FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE (g_0.e2 = 1) AND
(g_0.e1 IN (<dependent values>))", "SELECT g_0.e1 FROM pm1.g1 AS g_0"
}, TestOptimizer.getGenericFinder(false),
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
@@ -383,7 +384,7 @@
* Test that second access pattern of access node is chosen to make
* dependent with
*/
- public void testMakeDependentAccessPattern3() throws Exception {
+ @Test public void testMakeDependentAccessPattern3() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1,
pm4.g2 where pm1.g1.e1 = pm4.g2.e5", FakeMetadataFactory.example1Cached(),
//$NON-NLS-1$
new String[] { "SELECT g_0.e5 FROM pm4.g2 AS g_0 WHERE g_0.e5 IN
(<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" },
TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
//$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g2"}); //$NON-NLS-1$
@@ -394,7 +395,7 @@
* be made dependent, but merge join is used since no access pattern
* needs to be fulfilled and there is no cost info available for either source
*/
- public void testPushSelectAndMakeDependentAccessPattern1() throws Exception {
+ @Test public void testPushSelectAndMakeDependentAccessPattern1() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1,
pm4.g1 where pm4.g1.e1 = 'abc' and pm1.g1.e1 = 'abc' and pm1.g1.e2 =
pm4.g1.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1
= 'abc'", "SELECT pm4.g1.e2 FROM pm4.g1 WHERE pm4.g1.e1 =
'abc'" }, TestOptimizer.getGenericFinder(false),
ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[0]);
@@ -423,7 +424,7 @@
* needs to be fulfilled and there is no cost info available for either source
* (Same query written slightly different)
*/
- public void testPushSelectAndMakeDependentAccessPattern1a() throws Exception {
+ @Test public void testPushSelectAndMakeDependentAccessPattern1a() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm4.g1,
pm1.g1 where pm4.g1.e2 = pm1.g1.e2 and pm4.g1.e1 = 'abc' and pm1.g1.e1 =
'abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1
= 'abc'", "SELECT pm4.g1.e2 FROM pm4.g1 WHERE pm4.g1.e1 =
'abc'" }, TestOptimizer.getGenericFinder(false),
ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[0]);
@@ -450,7 +451,7 @@
* Tests that it is enforced if an access node can't be made dependent
* because of it's (already-satisfied) access pattern - merge join is used
*/
- public void testPushSelectAndMakeDependentAccessPattern2() throws Exception {
+ @Test public void testPushSelectAndMakeDependentAccessPattern2() throws Exception {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1,
pm4.g1 where pm4.g1.e1 = 'abc' and pm1.g1.e2 = pm4.g1.e2",
FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1",
"SELECT pm4.g1.e2 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" },
TestOptimizer.getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING);
//$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[0] );
@@ -474,7 +475,7 @@
}
/** Should use dependent join since one access node is "strong" */
- public void testUseMergeJoin1() throws Exception {
+ @Test public void testUseMergeJoin1() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 =
pm1.g2.e1";//$NON-NLS-1$
@@ -513,7 +514,7 @@
}
/** Should not use a dependent join since neither access node is "strong"
*/
- public void testUseMergeJoin2() throws Exception {
+ @Test public void testUseMergeJoin2() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 =
pm1.g2.e1";//$NON-NLS-1$
@@ -549,7 +550,7 @@
}
/** should have one dependent joins */
- public void testMultiMergeJoin3() throws Exception {
+ @Test public void testMultiMergeJoin3() throws Exception {
// Create query
String sql = "SELECT pm1.g2.e1 FROM pm1.g3, pm1.g2, pm1.g1 WHERE pm1.g2.e1 =
pm1.g3.e1 AND pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
@@ -591,7 +592,7 @@
});
}
- public void testMultiMergeJoin2() throws Exception {
+ @Test public void testMultiMergeJoin2() throws Exception {
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3 WHERE pm1.g1.e1 =
pm1.g2.e1 AND pm1.g2.e1 = pm1.g3.e1";//$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -637,7 +638,7 @@
* should be one merge join and one dependent join
* Unlike the above tests, here the model pm1 supports ORDER BY.
*/
- public void testMultiMergeJoin5_defect13448() throws Exception {
+ @Test public void testMultiMergeJoin5_defect13448() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3 WHERE pm1.g1.e1 =
pm1.g2.e1 AND pm1.g1.e1 = pm1.g3.e1";//$NON-NLS-1$
@@ -681,7 +682,7 @@
});
}
- public void testMergeJoinVirtualGroups() throws Exception {
+ @Test public void testMergeJoinVirtualGroups() throws Exception {
String sql = "SELECT vm1.g1.e1 FROM vm1.g1, vm1.g2a WHERE vm1.g1.e1 =
vm1.g2a.e1";//$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -722,7 +723,7 @@
});
}
- public void testRLMCase2077() throws Exception {
+ @Test public void testRLMCase2077() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -766,7 +767,7 @@
}
- public void testRLMCase2077_2() throws Exception {
+ @Test public void testRLMCase2077_2() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -809,5 +810,47 @@
});
}
+
+ @Test public void testCostingCleanup() throws Exception {
+
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
+ caps.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
+ capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
+ TransformationMetadata metadata = FakeMetadataFactory.exampleBQT();
+ FakeMetadataFactory.setCardinality("bqt1.smalla", 3000, metadata);
//$NON-NLS-1$
+ FakeMetadataFactory.setCardinality("bqt2.smalla", 10000, metadata);
//$NON-NLS-1$
+ Column fmo = (Column)metadata.getElementID("bqt1.smalla.intnum");
+ fmo.setDistinctValues(1000);
+ ProcessorPlan plan = TestOptimizer.helpPlan(
+ "SELECT max(a.stringkey) from bqt1.smalla a, bqt2.smalla a2, bqt1.smalla
a1 where a.intnum = a2.intnum and a1.stringnum = a2.stringnum and a.floatnum =
a1.floatnum", //$NON-NLS-1$
+ metadata,
+ null, capFinder,
+ new String[] {"SELECT g_1.stringnum AS c_0, g_0.intnum AS c_1,
MAX(g_0.stringkey) AS c_2 FROM bqt1.smalla AS g_0, bqt1.smalla AS g_1 WHERE g_0.floatnum =
g_1.floatnum GROUP BY g_1.stringnum, g_0.intnum ORDER BY c_0, c_1", "SELECT
DISTINCT g_0.stringnum AS c_0, g_0.intnum AS c_1 FROM bqt2.smalla AS g_0 WHERE
(g_0.stringnum IN (<dependent values>)) AND (g_0.intnum IN (<dependent
values>)) ORDER BY c_0, c_1"},
+ TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
+
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 1, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 1, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+
+ }
+
}
Modified:
branches/7.2.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
---
branches/7.2.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -145,5 +145,9 @@
execute("SELECT * from vgroup6 where y in ('zne', 'zwo') order by
y desc", Arrays.asList("two", "zwo"),
Arrays.asList("one", "zne"));
execute("SELECT * from vgroup6 where y is null", Arrays.asList((String)null,
(String)null));
}
+
+ @Test public void testPrimaryKeyOnOtherColumn() throws Exception {
+ execute("SELECT * from vgroup7 where y is null", Arrays.asList("1",
null, 1));
+ }
}
Modified:
branches/7.2.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
---
branches/7.2.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -1185,30 +1185,69 @@
assertEquals("Rewritten command was not expected", rewritProc,
procReturned); //$NON-NLS-1$
}
- // virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
+ // virtual group elements used in procedure (TRANSLATE CRITERIA)
@Test public void testRewriteProcedure16() throws Exception {
- String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
- procedure = procedure + "Select pm1.g1.e2 from pm1.g1 where TRANSLATE
CRITERIA;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
+ String procedure = exampleTranslateUpdate();
String userQuery = "UPDATE vm1.g3 SET x='x' where e4= 1";
//$NON-NLS-1$
String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
rewritProc = rewritProc + "DECLARE integer var1;\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE e4 = 0.02;\n";
//$NON-NLS-1$
+ rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = 'x' WHERE e4 =
0.02;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
FakeMetadataObject.Props.UPDATE_PROCEDURE);
assertEquals("Rewritten command was not expected", rewritProc,
procReturned); //$NON-NLS-1$
+ }
+
+ @Test public void testRewriteNoUserCriteria() throws Exception {
+ String procedure = exampleTranslateUpdate();
+
+ String userQuery = "UPDATE vm1.g3 SET x='x'"; //$NON-NLS-1$
+
+ String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = 'x' WHERE 1 =
1;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "END"; //$NON-NLS-1$
+
+ String procReturned = this.getRewritenProcedure(procedure, userQuery,
+ FakeMetadataObject.Props.UPDATE_PROCEDURE);
+
+ assertEquals("Rewritten command was not expected", rewritProc,
procReturned); //$NON-NLS-1$
+ }
+
+ @Test public void testRewriteOrUserCriteria() throws Exception {
+ String procedure = exampleTranslateUpdate();
+
+ String userQuery = "UPDATE vm1.g3 SET x='x' where x = '1' or
x = '2'"; //$NON-NLS-1$
+
+ String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = 'x' WHERE (CONCAT(e1,
'm') = '1') OR (CONCAT(e1, 'm') = '2');\n";
//$NON-NLS-1$
+ rewritProc = rewritProc + "END"; //$NON-NLS-1$
+
+ String procReturned = this.getRewritenProcedure(procedure, userQuery,
+ FakeMetadataObject.Props.UPDATE_PROCEDURE);
+
+ assertEquals("Rewritten command was not expected", rewritProc,
procReturned); //$NON-NLS-1$
+ }
+
+ private String exampleTranslateUpdate() {
+ String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
+ procedure = procedure + "update pm1.g1 set pm1.g1.e1 = inputs.x where
TRANSLATE CRITERIA;\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+ return procedure;
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- @Test public void testRewriteProcedure17() throws Exception {
+ @Test(expected=QueryValidatorException.class) public void testRewriteProcedure17()
throws Exception {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1217,16 +1256,8 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e4= 1";
//$NON-NLS-1$
- String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "DECLARE integer var1;\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE
"+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
- rewritProc = rewritProc + "END"; //$NON-NLS-1$
-
- String procReturned = this.getRewritenProcedure(procedure, userQuery,
+ this.getRewritenProcedure(procedure, userQuery,
FakeMetadataObject.Props.UPDATE_PROCEDURE);
-
- assertEquals("Rewritten command was not expected", rewritProc,
procReturned); //$NON-NLS-1$
}
// Bug 8212 elements in INPUT and CHANGING special groups are cese sensitive
@@ -1367,7 +1398,7 @@
}
// elements being set in updates are dropped if INPUT var is not available
- @Test public void testRewriteProcedure24() throws Exception {
+ @Test(expected=QueryValidatorException.class) public void testRewriteProcedure24()
throws Exception {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "UPDATE pm1.g1 SET e2=Input.e2 WHERE TRANSLATE LIKE
CRITERIA ON (e1) WITH (e1=concat(pm1.g1.e1, '%'));\n"; //$NON-NLS-1$
@@ -1375,17 +1406,10 @@
String userQuery = "UPDATE vm1.g1 set E2=1 where e2 = 1 and e1 LIKE
'mnopxyz_'"; //$NON-NLS-1$
- String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "UPDATE pm1.g1 SET e2 = 1 WHERE concat(pm1.g1.e1,
'%') LIKE 'mnopxyz_';\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "END"; //$NON-NLS-1$
+ this.getRewritenProcedure(procedure, userQuery,
+ FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ }
- String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
-
- assertEquals("Rewritten command was not expected", rewritProc,
procReturned); //$NON-NLS-1$
- }
-
// INPUT vars in insert statements replaced by default variable when user's inser
ignores values
@Test public void testRewriteProcedure25() throws Exception {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
@@ -1429,7 +1453,7 @@
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
- @Test public void testRewriteProcedure27() throws Exception {
+ @Test(expected=QueryValidatorException.class) public void testRewriteProcedure27()
throws Exception {
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
procedure = procedure + "DECLARE integer var1;\n"; //$NON-NLS-1$
@@ -1438,16 +1462,8 @@
String userQuery = "UPDATE vm1.g1 SET e1='x' where e2 LIKE
'xyz'"; //$NON-NLS-1$
- String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "DECLARE integer var1;\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1, pm1.g2 WHERE
"+FALSE_STR+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
- rewritProc = rewritProc + "END"; //$NON-NLS-1$
-
- String procReturned = this.getRewritenProcedure(procedure, userQuery,
+ this.getRewritenProcedure(procedure, userQuery,
FakeMetadataObject.Props.UPDATE_PROCEDURE);
-
- assertEquals("Rewritten command was not expected", rewritProc, procReturned);
//$NON-NLS-1$
}
/**
Modified:
branches/7.2.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
---
branches/7.2.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -391,6 +391,16 @@
createKey(KeyRecord.Type.Index, "idx", vGroup6, vElements6.subList(1,
2));
+ //non-covering index
+ QueryNode vTrans7 = new QueryNode("VGroup7", "SELECT '1',
'z' || substring(x, 2) as y, 1 as z FROM matsrc"); //$NON-NLS-1$
//$NON-NLS-2$
+ Table vGroup7 = createVirtualGroup("VGroup7", virtModel, vTrans7);
//$NON-NLS-1$
+ vGroup7.setMaterialized(true);
+ List<Column> vElements7 = createElements(vGroup7,
+ new String[] { "x", "y",
"z" }, //$NON-NLS-1$
+ new String[] {
DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING,
DataTypeManager.DefaultDataTypes.INTEGER});
+
+ createKey(KeyRecord.Type.Primary, "pk", vGroup7, vElements7.subList(1,
2));
+
Schema sp = createVirtualModel("sp", metadataStore); //$NON-NLS-1$
ColumnSet<Procedure> rs = createResultSet("sp1.vsprs1", new
String[] { "StringKey" }, new String[] { DataTypeManager.DefaultDataTypes.STRING
}); //$NON-NLS-1$ //$NON-NLS-2$
ProcedureParameter param = createParameter("param1", ParameterInfo.IN,
DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
Modified:
branches/7.2.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
branches/7.2.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -170,21 +170,21 @@
this.csr.registerClientService(DQP.class, proxyService(DQP.class, this.dqpCore,
LogConstants.CTX_DQP), LogConstants.CTX_DQP);
this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin,
LogConstants.CTX_ADMIN_API), LogConstants.CTX_ADMIN_API);
- if (this.jdbcSocketConfiguration.isEnabled()) {
+ if (this.jdbcSocketConfiguration.getEnabled()) {
this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, csr,
this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC =
",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.jdbcSocketConfiguration.getHostAddress().getHostName()+":"+(this.jdbcSocketConfiguration.getPortNumber()+offset)));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_not_enabled", "jdbc
connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
- if (this.adminSocketConfiguration.isEnabled()) {
+ if (this.adminSocketConfiguration.getEnabled()) {
this.adminSocket = new SocketListener(this.adminSocketConfiguration, csr,
this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_enabled","Teiid Admin",
(this.adminSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.adminSocketConfiguration.getHostAddress().getHostName()+":"+(this.adminSocketConfiguration.getPortNumber()+offset)));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_not_enabled", "admin
connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
- if (this.odbcSocketConfiguration.isEnabled()) {
+ if (this.odbcSocketConfiguration.getEnabled()) {
this.vdbRepository.odbcEnabled();
this.odbcSocket = new ODBCSocketListener(this.odbcSocketConfiguration, csr,
this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_enabled","Teiid ODBC - SSL=",
(this.odbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"ON":"OFF")+"
Host = "+this.odbcSocketConfiguration.getHostAddress().getHostName()+" Port =
"+(this.odbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
@@ -192,7 +192,7 @@
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_not_enabled")); //$NON-NLS-1$
}
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_started", new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_started", getRuntimeVersion(), new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
if (jndiName != null) {
final InitialContext ic ;
try {
Modified:
branches/7.2.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
---
branches/7.2.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-11-05
02:57:19 UTC (rev 2707)
@@ -20,7 +20,7 @@
# 02110-1301 USA.
#
-engine_started=Teiid Engine Started = {0}
+engine_started=Teiid Engine {0} Started = {1}
socket_enabled={0} {1}
odbc_not_enabled=ODBC transport is not enabled in Teiid.
odbc_enabled={0} {1}
Modified:
branches/7.2.x/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
===================================================================
---
branches/7.2.x/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java 2010-11-05
02:27:49 UTC (rev 2706)
+++
branches/7.2.x/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java 2010-11-05
02:57:19 UTC (rev 2707)
@@ -26,6 +26,7 @@
import org.jboss.managed.api.annotation.ManagementComponent;
import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.core.TeiidRuntimeException;
@@ -42,8 +43,18 @@
private SSLConfiguration sslConfiguration;
private boolean enabled;
private String hostName;
+ private String name;
+ @ManagementProperty(description="Name of the configuration", readOnly=true)
+ @ManagementObjectID(type="socket")
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
public void setBindAddress(String addr) {
this.hostName = addr;
}
@@ -79,8 +90,8 @@
}
}
- @ManagementProperty(description="SSL enabled", readOnly=true)
- public boolean isEnabled() {
+ @ManagementProperty(description="enabled")
+ public boolean getEnabled() {
return enabled;
}
@@ -88,22 +99,22 @@
this.enabled = enabled;
}
- @ManagementProperty(description="SO_SNDBUF size, 0 indicates that system default
should be used (default 0)",readOnly=true)
+ @ManagementProperty(description="SO_SNDBUF size, 0 indicates that system default
should be used (default 0)")
public int getOutputBufferSize() {
return outputBufferSize;
}
- @ManagementProperty(description="SO_RCVBUF size, 0 indicates that system default
should be used (default 0)",readOnly=true)
+ @ManagementProperty(description="SO_RCVBUF size, 0 indicates that system default
should be used (default 0)")
public int getInputBufferSize() {
return inputBufferSize;
}
- @ManagementProperty(description="Max NIO threads",readOnly=true)
+ @ManagementProperty(description="Max NIO threads")
public int getMaxSocketThreads() {
return maxSocketThreads;
}
- @ManagementProperty(description="Port Number",readOnly=true)
+ @ManagementProperty(description="Port Number")
public int getPortNumber() {
return portNumber;
}
@@ -126,7 +137,7 @@
}
}
- @ManagementProperty(description="Host Name",readOnly=true)
+ @ManagementProperty(description="Host Name")
public String getHostName() {
resolveHostName();
return this.hostName;
@@ -134,5 +145,10 @@
public SSLConfiguration getSSLConfiguration() {
return sslConfiguration;
- }
+ }
+
+ @ManagementProperty(description="SSL enabled")
+ public boolean getSslEnabled() {
+ return this.sslConfiguration != null && this.sslConfiguration.isSslEnabled();
+ }
}