teiid SVN: r2512 - in branches/7.1.x: engine/src/main/java/org/teiid/cache and 1 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-31 18:50:54 -0400 (Tue, 31 Aug 2010)
New Revision: 2512
Modified:
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
Log:
TEIID-1104: The tuple batches were also in the resultset cache node, and being counted as extra nodes against the total nodes. Moved batches into a child node under result set. The nodes get created when the batch is loaded from remote vm.
Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java 2010-08-31 19:10:36 UTC (rev 2511)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java 2010-08-31 22:50:54 UTC (rev 2512)
@@ -62,8 +62,9 @@
map.put(id, b);
return map;
}
+ return super.get(fqn);
}
- return super.get(fqn);
+ return null;
}
@Override
Modified: branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java 2010-08-31 19:10:36 UTC (rev 2511)
+++ branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java 2010-08-31 22:50:54 UTC (rev 2512)
@@ -29,6 +29,7 @@
public enum Type {SESSION("Session"), //$NON-NLS-1$
RESULTSET("ResultSet"), //$NON-NLS-1$
+ RESULTSET_BATCHES(RESULTSET, "batches"), //$NON-NLS-1$
PREPAREDPLAN("PreparaedPlan"); //$NON-NLS-1$
private String location;
@@ -37,6 +38,10 @@
this.location = location;
}
+ Type(Type base, String location){
+ this.location = base.location+"/"+location; //$NON-NLS-1$
+ }
+
public String location() {
return this.location;
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-31 19:10:36 UTC (rev 2511)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-31 22:50:54 UTC (rev 2512)
@@ -51,6 +51,7 @@
private Cache<CacheID, T> localCache;
private Cache<CacheID, T> distributedCache;
+ private Cache tupleBatchCache;
private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
@@ -79,6 +80,12 @@
}
else {
this.distributedCache = cacheFactory.get(type, config);
+ if (type == Cache.Type.RESULTSET) {
+ this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
+ }
+ else {
+ this.tupleBatchCache = this.distributedCache;
+ }
}
}
@@ -102,7 +109,7 @@
if (result != null && result instanceof Cachable) {
Cachable c = (Cachable)result;
- if (!c.restore(this.distributedCache, this.bufferManager)) {
+ if (!c.restore(this.tupleBatchCache, this.bufferManager)) {
result = null;
}
}
@@ -149,7 +156,7 @@
if (t instanceof Cachable) {
Cachable c = (Cachable)t;
- insert = c.prepare(this.distributedCache, this.bufferManager);
+ insert = c.prepare(this.tupleBatchCache, this.bufferManager);
}
if (insert) {
14 years, 3 months
teiid SVN: r2511 - in branches/7.1.x/console/src/main: java/org/teiid/rhq/plugin and 2 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-08-31 15:10:36 -0400 (Tue, 31 Aug 2010)
New Revision: 2511
Modified:
branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1196: Added 'Deploy VDB via URL" operation to the Data Services (RuntimeEngine) node
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-08-31 18:26:04 UTC (rev 2510)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-08-31 19:10:36 UTC (rev 2511)
@@ -22,6 +22,7 @@
package org.teiid.rhq.admin;
import java.lang.reflect.Method;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -54,6 +55,7 @@
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.RequestMetadataMapper;
import org.teiid.rhq.plugin.objects.ExecutedResult;
+import org.teiid.rhq.plugin.util.DeploymentUtils;
import org.teiid.rhq.plugin.util.PluginConstants;
import org.teiid.rhq.plugin.util.ProfileServiceUtil;
import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.Platform;
@@ -64,6 +66,8 @@
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 String VDB_EXT = ".vdb";
public DQPManagementView() {
}
@@ -225,6 +229,30 @@
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);
+ 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));
+ }
+ if (vdbVersion!=null){
+ deployName = deployName + "." + ((Integer)vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
+ }
+ //add vdb extension if there was no version
+ if (!deployName.endsWith(VDB_EXT)){
+ deployName = deployName + VDB_EXT;
+ }
+
+ try {
+ URL url = new URL(vdbUrl);
+ 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);
+ throw new RuntimeException(e);
+ }
}
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-08-31 18:26:04 UTC (rev 2510)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-08-31 19:10:36 UTC (rev 2511)
@@ -104,6 +104,10 @@
valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ } else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
+ valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
+ valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
+ valueMap.put(Operation.Value.VDB_VERSION, configuration.getSimple(Operation.Value.VDB_VERSION).getIntegerValue());
}
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java 2010-08-31 18:26:04 UTC (rev 2510)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java 2010-08-31 19:10:36 UTC (rev 2511)
@@ -42,8 +42,8 @@
private static final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
public static boolean hasCorrectExtension(String archiveFileName, ResourceType resourceType) {
- String expectedExtension = "vdb";
- int lastPeriod = archiveFileName.lastIndexOf(".");
+ String expectedExtension = "vdb"; //$NON-NLS-1$
+ int lastPeriod = archiveFileName.lastIndexOf("."); //$NON-NLS-1$
String extension = (lastPeriod != -1) ? archiveFileName.substring(lastPeriod + 1) : null;
// Use File.equals() to compare the extensions so case-sensitivity is correct for this platform.
return (extension != null && new File(extension).equals(new File(expectedExtension)));
@@ -63,16 +63,47 @@
public static void deployArchive(DeploymentManager deploymentManager, File archiveFile, boolean deployExploded)
throws Exception {
String archiveFileName = archiveFile.getName();
- LOG.debug("Deploying '" + archiveFileName + "' (deployExploded=" + deployExploded + ")...");
+ LOG.debug("Deploying '" + archiveFileName + "' (deployExploded=" + deployExploded + ")..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
URL contentURL;
try {
contentURL = archiveFile.toURI().toURL();
}
catch (MalformedURLException e) {
- throw new IllegalArgumentException("Failed to convert archive file path '" + archiveFile + "' to URL.", e);
+ throw new IllegalArgumentException("Failed to convert archive file path '" + archiveFile + "' to URL.", e); //$NON-NLS-1$ //$NON-NLS-2$
}
- DeploymentProgress progress = null;
+ deployAndStart(deploymentManager, contentURL, archiveFileName);
+ }
+
+ /**
+ * Deploys (i.e. distributes then starts) the specified archive file.
+ *
+ * @param fileName
+ * @param deploymentManager
+ * @param archiveUrl
+ * @param deployExploded
+ *
+ * @return
+ *
+ * @throws Exception if the deployment fails for any reason
+ */
+ public static void deployArchive(String fileName, DeploymentManager deploymentManager, URL contentURL, boolean deployExploded)
+ throws Exception {
+ String archiveFileName = fileName;
+ LOG.debug("Deploying '" + archiveFileName + "' (deployExploded=" + deployExploded + ")..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ deployAndStart(deploymentManager, contentURL, archiveFileName);
+ }
+
+ /**
+ * @param deploymentManager
+ * @param contentURL
+ * @param archiveFileName
+ * @throws Exception
+ */
+ private static void deployAndStart(DeploymentManager deploymentManager,
+ URL contentURL, String archiveFileName) throws Exception {
+ DeploymentProgress progress = null;
DeploymentStatus distributeStatus;
Exception distributeFailure = null;
try {
@@ -80,14 +111,14 @@
distributeStatus = run(progress);
if (distributeStatus.isFailed()) {
distributeFailure = (distributeStatus.getFailure() != null) ? distributeStatus.getFailure() :
- new Exception("Distribute failed for unknown reason.");
+ new Exception("Distribute failed for unknown reason."); //$NON-NLS-1$
}
}
catch (Exception e) {
distributeFailure = e;
}
if (distributeFailure != null) {
- throw new Exception("Failed to distribute '" + contentURL + "' to '" + archiveFileName + "' - cause: "
+ throw new Exception("Failed to distribute '" + contentURL + "' to '" + archiveFileName + "' - cause: " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ThrowableUtil.getAllMessages(distributeFailure));
}
@@ -100,15 +131,15 @@
startStatus = run(progress);
if (startStatus.isFailed()) {
startFailure = (startStatus.getFailure() != null) ? startStatus.getFailure() :
- new Exception("Start failed for unknown reason.");
+ new Exception("Start failed for unknown reason."); //$NON-NLS-1$
}
}
catch (Exception e) {
startFailure = e;
}
if (startFailure != null) {
- LOG.error("Failed to start deployment " + Arrays.asList(deploymentNames)
- + " during deployment of '" + archiveFileName + "'. Backing out the deployment...", startFailure);
+ LOG.error("Failed to start deployment " + Arrays.asList(deploymentNames) //$NON-NLS-1$
+ + " during deployment of '" + archiveFileName + "'. Backing out the deployment...", startFailure); //$NON-NLS-1$ //$NON-NLS-2$
// If start failed, the app is invalid, so back out the deployment.
DeploymentStatus removeStatus;
Exception removeFailure = null;
@@ -117,24 +148,24 @@
removeStatus = run(progress);
if (removeStatus.isFailed()) {
removeFailure = (removeStatus.getFailure() != null) ? removeStatus.getFailure() :
- new Exception("Remove failed for unknown reason.");
+ new Exception("Remove failed for unknown reason."); //$NON-NLS-1$
}
}
catch (Exception e) {
removeFailure = e;
}
if (removeFailure != null) {
- LOG.error("Failed to remove deployment " + Arrays.asList(deploymentNames)
- + " after start failure.", removeFailure);
+ LOG.error("Failed to remove deployment " + Arrays.asList(deploymentNames) //$NON-NLS-1$
+ + " after start failure.", removeFailure); //$NON-NLS-1$
}
- throw new Exception("Failed to start deployment " + Arrays.asList(deploymentNames)
- + " during deployment of '" + archiveFileName + "' - cause: " +
+ throw new Exception("Failed to start deployment " + Arrays.asList(deploymentNames) //$NON-NLS-1$
+ + " during deployment of '" + archiveFileName + "' - cause: " + //$NON-NLS-1$ //$NON-NLS-2$
ThrowableUtil.getAllMessages(startFailure));
}
// If we made it this far, the deployment (distribution+start) was successful.
return;
- }
-
+ }
+
public static DeploymentStatus run(DeploymentProgress progress) {
progress.run();
return progress.getDeploymentStatus();
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-08-31 18:26:04 UTC (rev 2510)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-08-31 19:10:36 UTC (rev 2511)
@@ -76,6 +76,7 @@
public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
public final static String GET_BUFFER_USAGE = "userBufferSpace"; //$NON-NLS-1$
public final static String GET_CACHE_STATS = "getCacheStatistics"; //$NON-NLS-1$
+ public final static String DEPLOY_VDB_BY_URL = "deployVdbByUrl"; //$NON-NLS-1$
}
public static interface Metrics {
@@ -225,7 +226,9 @@
public final static String TRANSACTION_ID = "transactionID"; //$NON-NLS-1$
public final static String REQUEST_ID = "requestID"; //$NON-NLS-1$
public final static String SESSION_ID = "sessionID"; //$NON-NLS-1$
-
+ public final static String VDB_URL = "vdbUrl"; //$NON-NLS-1$
+ public final static String VDB_DEPLOY_NAME = "vdbDeployName"; //$NON-NLS-1$
+ public final static String VDB_VERSION = "vdbVersion"; //$NON-NLS-1$
public final static String NAME = "Name"; //$NON-NLS-1$
public final static String VALUE = "Value"; //$NON-NLS-1$
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-31 18:26:04 UTC (rev 2510)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-31 19:10:36 UTC (rev 2511)
@@ -154,6 +154,19 @@
</c:list-property>
</results>
</operation>
+
+ <operation name="deployVdbByUrl" displayName="Deploy a VDB via URL"
+ description="Deploy a VDB using a URL">
+ <parameters>
+ <c:simple-property displayName="VDB URL" name="vdbUrl"
+ type="file" required="true" description="The URL of the VDB to deploy" />
+ <c:simple-property displayName="VDB Deploy File Name" name="vdbDeployName"
+ type="string" required="true" description="The deployment file name to use. Must match the VDB Name you are deploying." />
+ <c:simple-property displayName="VDB Version" name="vdbVersion"
+ type="integer" required="false" description="The version to use for the deployed VDB (leave blank for overwrite of version one)" />
+ </parameters>
+ </operation>
+
<operation name="terminateSession" displayName="Terminate Session"
description="Terminate a specified session">
@@ -266,7 +279,7 @@
<metric displayName="Prepared Plan Cache # of Requests" defaultOn="true"
displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.requestCount"
- description="Total number of requests made aginst cache" />
+ description="Total number of requests made against cache" />
<metric displayName="ResultSet Cache Hit Ratio %" defaultOn="true"
displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.hitRatio"
@@ -278,7 +291,7 @@
<metric displayName="ResultSet Cache # of Requests" defaultOn="true"
displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.requestCount"
- description="Total number of requests made aginst cache" />
+ description="Total number of requests made against cache" />
<resource-configuration>
<c:group name="teiidProperties" displayName="Runtime Engine Properties"
14 years, 3 months
teiid SVN: r2510 - in branches/7.1.x/client/src: test/java/org/teiid/adminapi/impl and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-31 14:26:04 -0400 (Tue, 31 Aug 2010)
New Revision: 2510
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
Log:
TEIID-1233 fix for version detection
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-08-31 18:24:00 UTC (rev 2509)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-08-31 18:26:04 UTC (rev 2510)
@@ -182,11 +182,11 @@
if (path.endsWith("/")) { //$NON-NLS-1$
path = path.substring(0, path.length() - 1);
}
- String fileName = FileUtils.getBaseFileNameWithoutExtension(path);
- String prefix = getName() + VERSION_DELIM;
- if (StringUtil.startsWithIgnoreCase(fileName, prefix)) {
+ String fileName = StringUtil.getLastToken(path, "/"); //$NON-NLS-1$
+ String[] parts = fileName.split("\\."); //$NON-NLS-1$
+ if (parts[0].equalsIgnoreCase(getName()) && parts.length >= 3) {
try {
- int fileVersion = Integer.parseInt(fileName.substring(prefix.length()));
+ int fileVersion = Integer.parseInt(parts[parts.length - 2]);
this.setVersion(fileVersion);
} catch (NumberFormatException e) {
Modified: branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-08-31 18:24:00 UTC (rev 2509)
+++ branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-08-31 18:26:04 UTC (rev 2510)
@@ -29,6 +29,8 @@
import java.io.StringReader;
import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -192,4 +194,11 @@
assertEquals("http://teiid.org/myvdb.vdb", vdb.getUrl());
}
+
+ @Test public void testSetUrlVersion() throws MalformedURLException {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("foo");
+ vdb.setUrl(new URL("file:///x/foo.2.vdb"));
+ assertEquals(2, vdb.getVersion());
+ }
}
14 years, 3 months
teiid SVN: r2509 - branches/7.1.x/client/src/main/java/org/teiid/net/socket.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-31 14:24:00 -0400 (Tue, 31 Aug 2010)
New Revision: 2509
Modified:
branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
Log:
TEIID-1211 the hostinfo needs resolved prior to connecting
Modified: branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2010-08-31 17:55:27 UTC (rev 2508)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2010-08-31 18:24:00 UTC (rev 2509)
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashSet;
@@ -117,6 +118,9 @@
Exception ex = null;
try {
+ if (!hostInfo.isResolved()) {
+ hostInfo = new HostInfo(hostInfo.getHostName(), new InetSocketAddress(hostInfo.getInetAddress(), hostInfo.getPortNumber()));
+ }
ILogon newLogon = connect(hostInfo);
if (this.logonResult == null) {
try {
14 years, 3 months
teiid SVN: r2508 - in branches/7.1.x/documentation: reference/src/main/docbook/en-US/content and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-31 13:55:27 -0400 (Tue, 31 Aug 2010)
New Revision: 2508
Modified:
branches/7.1.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
Log:
minor doc fixes
Modified: branches/7.1.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml
===================================================================
--- branches/7.1.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml 2010-08-30 21:48:07 UTC (rev 2507)
+++ branches/7.1.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml 2010-08-31 17:55:27 UTC (rev 2508)
@@ -6,6 +6,12 @@
Teiid's Admin Console is built using the <ulink url="http://www.jboss.org/embjopr">Embedded JOPR</ulink> library and adds a additional plugin into the Embeeded JOPR program already available in the
<ulink url="http://www.jboss.org/jbossas">JBoss AS</ulink>.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata scalefit="1" fileref="../images/admin_console.png"/>
+ </imageobject>
+ </mediaobject>
+
<section>
<title>What can be monitored and/or configured?</title>
<para>Here are the steps to follow to install Teiid</para>
@@ -31,12 +37,6 @@
<para>The creation/modification of the datasource is managed by the JBossAS plugin.</para>
</note>
- <mediaobject>
- <imageobject>
- <imagedata fileref="../images/admin_console.png"/>
- </imageobject>
- </mediaobject>
-
<section>
<title>Configuration</title>
<orderedlist>
Modified: branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2010-08-30 21:48:07 UTC (rev 2507)
+++ branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2010-08-31 17:55:27 UTC (rev 2508)
@@ -697,7 +697,7 @@
<para>LIMIT (limit result set to a certain range of results)</para>
</listitem>
</orderedlist>
- <para>These clause translate into the following types of planning
+ <para>These clauses translate into the following types of planning
nodes:</para>
<itemizedlist>
<listitem>
@@ -710,7 +710,7 @@
<para>GROUP BY: Group node</para>
</listitem>
<listitem>
- <para>GROUP BY: Group node</para>
+ <para>HAVING: Select node</para>
</listitem>
<listitem>
<para>SELECT: Project node and DupRemoval node (for SELECT DISTINCT)</para>
@@ -719,7 +719,7 @@
<para>INTO: Project node with a SOURCE Node</para>
</listitem>
<listitem>
- <para>INTO: Project node with a SOURCE Node</para>
+ <para>ORDER BY: Sort node</para>
</listitem>
<listitem>
<para>LIMIT: Limit node</para>
14 years, 3 months
teiid SVN: r2507 - in branches/7.1.x: engine/src/main/java/org/teiid/dqp/internal/process and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-30 17:48:07 -0400 (Mon, 30 Aug 2010)
New Revision: 2507
Modified:
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
Log:
TEIID-1209: fixing the descriptions in jopr
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-30 20:23:40 UTC (rev 2506)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-30 21:48:07 UTC (rev 2507)
@@ -258,27 +258,27 @@
<metric displayName="Prepared Plan Cache Hit Ratio %" defaultOn="true"
displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.hitRatio"
- description="Prepared plan cache hit ratio" />
+ description="Percentage of positive cache hits" />
<metric displayName="Prepared Plan Cache Size" defaultOn="true"
displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.totalEntries"
- description="Prepared plan cache size" />
+ description="Current number of entries in cache" />
<metric displayName="Prepared Plan Cache # of Requests" defaultOn="true"
displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.requestCount"
- description="Prepared plan cache # Requests made aginst cache" />
+ description="Total number of requests made aginst cache" />
<metric displayName="ResultSet Cache Hit Ratio %" defaultOn="true"
displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.hitRatio"
- description="ResultSet cache hit ratio" />
+ description="Percentage of positive cache hits" />
<metric displayName="ResultSet Cache Size" defaultOn="true"
displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.totalEntries"
- description="ResultSet cache Size" />
+ description="Current number of entries in cache" />
<metric displayName="ResultSet Cache # of Requests" defaultOn="true"
displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.requestCount"
- description="ResultSet cache # Requests made aginst cache" />
+ description="Total number of requests made aginst cache" />
<resource-configuration>
<c:group name="teiidProperties" displayName="Runtime Engine Properties"
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-30 20:23:40 UTC (rev 2506)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-30 21:48:07 UTC (rev 2507)
@@ -568,7 +568,7 @@
private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
stats.setName(name);
- stats.setHitRatio(cache.getRequestCount() == 0?0:(cache.getCacheHitCount()/cache.getRequestCount())*100);
+ stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
stats.setTotalEntries(cache.getTotalCacheEntries());
stats.setRequestCount(cache.getRequestCount());
return stats;
14 years, 3 months
teiid SVN: r2506 - branches/7.1.x/console/src/main/resources/META-INF.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-08-30 16:23:40 -0400 (Mon, 30 Aug 2010)
New Revision: 2506
Modified:
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1202: Added better description to Connection Type property
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-30 18:58:21 UTC (rev 2505)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-30 20:23:40 UTC (rev 2506)
@@ -485,8 +485,9 @@
<c:option value="INACTIVE" name="DOWN" default="true" />
</c:property-options>
</c:simple-property>
- <c:simple-property name="connectionType" type="string"
- description="Connections to allow to this Virtual Database"
+ <c:simple-property name="connectionType" type="string"
+ description="Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY'
+3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY "
required="false">
<c:property-options>
<c:option value="NONE" name="NONE" />
14 years, 3 months
teiid SVN: r2505 - in branches/7.1.x: build/kits/jboss-container/deploy/teiid and 17 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-08-30 14:58:21 -0400 (Mon, 30 Aug 2010)
New Revision: 2505
Added:
branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/CacheStatistics.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java
Removed:
branches/7.1.x/console/src/main/java/org/teiid/rhq/comm/
branches/7.1.x/console/src/main/java/org/teiid/rhq/embedded/
branches/7.1.x/console/src/main/java/org/teiid/rhq/enterprise/
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/log/
Modified:
branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1104, TEIID-1209: Adding distributed resultset caching based upon the buffer manager. The buffer manager acts like a cache loader and nodes look up tuple batches in remote nodes before issuing the source query.
Modified: branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -36,6 +36,7 @@
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminFactory;
+import org.teiid.adminapi.CacheStatistics;
import org.teiid.adminapi.ProcessObject;
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
@@ -229,7 +230,13 @@
throws AdminException {
return getAdmin().getWorkManagerStats(identifier);
}
-
+
+ @Doc(text = "Get cache statistics for given cache type")
+ public static CacheStatistics getCacheStats(@Doc(text = "cacheType") String identifier)
+ throws AdminException {
+ return getAdmin().getCacheStats(identifier);
+ }
+
@Doc(text = "Remove a role for the data policy")
public static void removeDataRoleMapping(
@Doc(text = "vdb name") String vdbName,
Added: branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml
===================================================================
--- branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml (rev 0)
+++ branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ If you are running JBoss AS in clustered mode, to enable the clustered cache in
+ the Teiid rename this file to "teiid-cache-manager-jboss-beans.xml"
+ -->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- Factory/registry for JBoss Cache and PojoCache instances used in the AS -->
+ <bean name="TeiidCacheManager" class="org.jboss.ha.cachemanager.CacheManager">
+ <property name="jndiName">java:TeiidCacheManager</property>
+ <property name="configurationRegistry">
+ <inject bean="TeiidCacheConfigurationRegistry" />
+ </property>
+ <property name="channelFactory">
+ <inject bean="JChannelFactory" />
+ </property>
+
+ <!-- Aliases for cache names. Allows caches to be shared across
+ services that may expect different cache config names. -->
+ <property name="configAliases">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <!-- Use the HAPartition cache for ClusteredSSO caching -->
+ <entry>
+ <key>teiid-resultset-cache</key>
+ <value>teiid-resultset-cache</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!--
+ | Registry of named JBoss Cache configurations. Users of the CacheManager
+ | request a cache with a particular configuration by providing the name
+ | of one of these configurations.
+ -->
+ <bean name="TeiidCacheConfigurationRegistry" class="org.jboss.ha.cachemanager.DependencyInjectedConfigurationRegistry">
+
+ <!-- The configurations. A Map<String name, Configuration config> -->
+ <property name="newConfigurations">
+ <map keyClass="java.lang.String" valueClass="org.jboss.cache.config.Configuration">
+
+ <!-- A config appropriate for a cache that's shared for
+ entity, collection, query and timestamp caching. Not an advised
+ configuration, since it requires cache mode REPL_SYNC, which is the
+ least efficient mode. Also requires a full state transfer at startup,
+ which can be expensive. Uses mvcc locking. -->
+ <entry>
+ <key>teiid-resultset-cache</key>
+ <value>
+ <bean class="org.jboss.cache.config.Configuration">
+
+ <!-- Node locking scheme -->
+ <property name="nodeLockingScheme">MVCC</property>
+ <!-- READ_COMMITTED is as strong as necessary for most
+ 2nd Level Cache use cases. -->
+ <property name="isolationLevel">READ_COMMITTED</property>
+ <property name="useLockStriping">false</property>
+
+ <!-- Must use REPL since used for timestamp caching.
+ Must use SYNC to maintain cache coherency for entities. -->
+ <property name="cacheMode">REPL_SYNC</property>
+
+ <!-- Name of cluster. Needs to be the same for all members -->
+ <property name="clusterName">${jboss.partition.name:DefaultPartition}-resultset-cache</property>
+ <!-- Use a UDP (multicast) based stack. Need JGroups flow control (FC)
+ because timestamp communication will not require a synchronous response. -->
+ <property name="multiplexerStack">${jboss.default.jgroups.stack:udp}</property>
+ <!-- Used for timestamps, so must fetch state. -->
+ <property name="fetchInMemoryState">true</property>
+
+ <!-- The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members at startup. Ignored if FetchInMemoryState=false. -->
+ <property name="stateRetrievalTimeout">60000</property>
+
+ <!-- Number of milliseconds to wait until all responses for a
+ synchronous call have been received. -->
+ <property name="syncReplTimeout">17500</property>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <property name="lockAcquisitionTimeout">15000</property>
+
+ <!-- Hibernate 2LC can replicate custom types, so we use marshalling -->
+ <property name="useRegionBasedMarshalling">true</property>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <property name="inactiveOnStartup">true</property>
+
+ <!-- Disable asynchronous RPC marshalling/sending -->
+ <property name="serializationExecutorPoolSize">0</property>
+ <!-- We have no asynchronous notification listeners -->
+ <property name="listenerAsyncPoolSize">0</property>
+
+ <property name="evictionConfig">
+ <bean class="org.jboss.cache.config.EvictionConfig">
+ <property name="wakeupInterval">5000</property>
+ <!-- Overall default -->
+ <property name="defaultEvictionRegionConfig">
+ <bean class="org.jboss.cache.config.EvictionRegionConfig">
+ <property name="regionName">/</property>
+ <property name="evictionAlgorithmConfig">
+ <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+ <!-- Evict LRU node once we have more than this number of nodes -->
+ <property name="maxNodes">10000</property>
+ <!-- And, evict any node that hasn't been accessed in this many seconds -->
+ <property name="timeToLiveSeconds">1000</property>
+ <!-- Don't evict a node that's been accessed within this many seconds.
+ Set this to a value greater than your max expected transaction length. -->
+ <property name="minTimeToLiveSeconds">120</property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ <property name="cacheLoaderConfig">
+ <bean class="org.jboss.cache.config.CacheLoaderConfig">
+ <!-- Do not change these -->
+ <property name="passivation">false</property>
+ <property name="shared">false</property>
+
+ <property name="individualCacheLoaderConfigs">
+ <list>
+ <bean class="org.teiid.cache.jboss.TupleBatchCacheLoaderConfig">
+ <property name="bufferService"><inject bean="BufferService" /></property>
+ <property name="ignoreModifications">true</property>
+ <property name="timeout">10000</property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Property changes on: branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-08-30 18:58:21 UTC (rev 2505)
@@ -46,7 +46,8 @@
<bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
<property name="enabled">true</property>
- <property name="clusteredCacheName">mvcc-shared</property>
+ <property name="cacheManager">java:TeiidCacheManager</property>
+ <property name="resultsetCacheName">teiid-resultset-cache</property>
</bean>
<!-- Configuration for result set caching.
Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -37,8 +37,9 @@
public class ClusterableCacheFactory implements CacheFactory, Serializable {
private static final long serialVersionUID = -1992994494154581234L;
private CacheFactory delegate;
- private String cacheName;
+ private String resultsetCacheName;
private boolean enabled = false;
+ private String cacheManagerName;
@Override
public <K, V> Cache<K, V> get(Type type, CacheConfiguration config) {
@@ -49,7 +50,7 @@
}
else {
try {
- this.delegate = new JBossCacheFactory(this.cacheName, cacheManager);
+ this.delegate = new JBossCacheFactory(this.resultsetCacheName, cacheManager);
} catch (Exception e) {
throw new TeiidRuntimeException("Failed to obtain the clusted cache"); //$NON-NLS-1$
}
@@ -58,8 +59,8 @@
return delegate.get(type, config);
}
- public void setClusteredCacheName(String name) {
- this.cacheName = name;
+ public void setResultsetCacheName(String name) {
+ this.resultsetCacheName = name;
}
@Override
@@ -70,10 +71,10 @@
}
private Object getClusteredCache() {
- if (this.enabled) {
+ if (this.enabled && this.cacheManagerName != null) {
try {
Context ctx = new InitialContext();
- return ctx.lookup("java:CacheManager"); //$NON-NLS-1$
+ return ctx.lookup(this.cacheManagerName);
} catch (NamingException e) {
return null;
}
@@ -84,4 +85,8 @@
public void setEnabled(boolean value) {
this.enabled = value;
}
+
+ public void setCacheManager(String mgrName) {
+ this.cacheManagerName = mgrName;
+ }
}
Added: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java (rev 0)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,305 @@
+/*
+ * 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.cache.jboss;
+
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Modification;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.ReplicationException;
+import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
+import org.jboss.cache.commands.read.GetDataMapCommand;
+import org.jboss.cache.commands.remote.ClusteredGetCommand;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.loader.AbstractCacheLoader;
+import org.jboss.cache.lock.StripedLock;
+import org.jgroups.Address;
+import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.RspFilter;
+
+class ClusteredTupleBatchCacheLoader extends AbstractCacheLoader {
+ private StripedLock lock = new StripedLock();
+ private TupleBatchCacheLoaderConfig config;
+ private CommandsFactory commandsFactory;
+
+ private boolean init = false;
+
+ @Override
+ public void start() {
+ init();
+ }
+
+ private void init() {
+ if (!this.init) {
+ setCommandsFactory(cache.getComponentRegistry().getComponent(CommandsFactory.class));
+ this.init = true;
+ }
+ }
+
+ /**
+ * A test to check whether the cache is in its started state. If not, calls
+ * should not be made as the channel may not have properly started, blocks
+ * due to state transfers may be in progress, etc.
+ *
+ * @return true if the cache is in its STARTED state.
+ */
+ protected boolean isCacheReady() {
+ return cache.getCacheStatus() == CacheStatus.STARTED;
+ }
+
+ @Inject
+ public void setCommandsFactory(CommandsFactory commandsFactory) {
+ this.commandsFactory = commandsFactory;
+ }
+
+ /**
+ * Sets the configuration. A property <code>timeout</code> is used as the
+ * timeout value.
+ */
+ public void setConfig(IndividualCacheLoaderConfig base) {
+ this.config = (TupleBatchCacheLoaderConfig) base;
+ }
+
+ public IndividualCacheLoaderConfig getConfig() {
+ return config;
+ }
+
+ public Set getChildrenNames(Fqn fqn) throws Exception {
+ return Collections.emptySet();
+ }
+
+ private List<Object> callRemote(DataCommand dataCommand) throws Exception {
+ ClusteredGetCommand clusteredGet = commandsFactory .buildClusteredGetCommand(false, dataCommand);
+ List resps;
+ // JBCACHE-1186
+ resps = cache.getRPCManager().callRemoteMethods(null, clusteredGet, GroupRequest.GET_ALL, config.getTimeout(), new ResponseValidityFilter(cache.getMembers(), cache.getLocalAddress(), dataCommand), false);
+
+ if (resps == null) {
+ throw new ReplicationException("No replies to call " + dataCommand + ". Perhaps we're alone in the cluster?"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return resps;
+ }
+
+ public Map get(Fqn name) throws Exception {
+ return get0(name);
+ }
+
+ protected Map get0(Fqn name) throws Exception {
+ // DON'T make a remote call if this is a remote call in the first place
+ // - leads to deadlocks - JBCACHE-1103
+ if (!isCacheReady() || !cache.getInvocationContext().isOriginLocal()) {
+ return null;
+ }
+ // return Collections.emptyMap();
+ lock.acquireLock(name, true);
+ try {
+ init();
+ GetDataMapCommand command = commandsFactory.buildGetDataMapCommand(name);
+ List resps = callRemote(command);
+
+ Map result = Collections.EMPTY_MAP;
+ for (Object o:resps) {
+ if (o != null && !(o instanceof Exception)) {
+ List clusteredGetResp = (List) o;
+ if ((Boolean)clusteredGetResp.get(0)) {
+ Map resp = (Map)clusteredGetResp.get(1);
+ if (!resp.isEmpty()) {
+ result = resp;
+ }
+ }
+ }
+ }
+ return result;
+ } finally {
+ lock.releaseLock(name);
+ }
+ }
+
+ public boolean exists(Fqn name) throws Exception {
+ // DON'T make a remote call if this is a remote call in the first place
+ // - leads to deadlocks - JBCACHE-1103
+ if (!isCacheReady() || !cache.getInvocationContext().isOriginLocal()) {
+ return false;
+ }
+
+ lock.acquireLock(name, false);
+ try {
+ init();
+ ExistsCommand command = commandsFactory.buildExistsNodeCommand(name);
+ List resps = callRemote(command);
+ boolean result = false;
+ for (Object o:resps) {
+ if (o != null && !(o instanceof Exception)) {
+ List<Boolean> clusteredGetResp = (List<Boolean>) o;
+ if (clusteredGetResp.get(0)) {
+ if (clusteredGetResp.get(1)) {
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+ return result;
+ } finally {
+ lock.releaseLock(name);
+ }
+ }
+
+ public Object put(Fqn name, Object key, Object value) throws Exception {
+ return null;
+ }
+
+ /**
+ * Does nothing; replication handles put.
+ */
+ public void put(Fqn name, Map attributes) throws Exception {
+ }
+
+ /**
+ * Does nothing; replication handles put.
+ */
+ @Override
+ public void put(List<Modification> modifications) throws Exception {
+ }
+
+ /**
+ * Fetches the remove value, does not remove. Replication handles removal.
+ */
+ public Object remove(Fqn name, Object key) throws Exception {
+ return null;
+ }
+
+ /**
+ * Does nothing; replication handles removal.
+ */
+ public void remove(Fqn name) throws Exception {
+ // do nothing
+ }
+
+ /**
+ * Does nothing; replication handles removal.
+ */
+ public void removeData(Fqn name) throws Exception {
+ }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public void prepare(Object tx, List modifications, boolean one_phase)
+ throws Exception {
+ }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public void commit(Object tx) throws Exception {
+ }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public void rollback(Object tx) {
+ }
+
+ @Override
+ public void loadEntireState(ObjectOutputStream os) throws Exception {
+ // intentional no-op
+ }
+
+ @Override
+ public void loadState(Fqn subtree, ObjectOutputStream os) throws Exception {
+ // intentional no-op
+ }
+
+ @Override
+ public void storeEntireState(ObjectInputStream is) throws Exception {
+ // intentional no-op
+ }
+
+ @Override
+ public void storeState(Fqn subtree, ObjectInputStream is) throws Exception {
+ // intentional no-op
+ }
+
+ @Override
+ public void setRegionManager(RegionManager manager) {
+ }
+
+ public static class ResponseValidityFilter implements RspFilter {
+ private int numValidResponses = 0;
+ private List<Address> pendingResponders;
+ private DataCommand command;
+
+ public ResponseValidityFilter(List<Address> expected,Address localAddress, DataCommand command) {
+ this.pendingResponders = new ArrayList<Address>(expected);
+ // We'll never get a response from ourself
+ this.pendingResponders.remove(localAddress);
+ this.command = command;
+ }
+
+ public boolean isAcceptable(Object object, Address address) {
+ pendingResponders.remove(address);
+
+ if (object instanceof List) {
+ List response = (List) object;
+ Boolean foundResult = (Boolean) response.get(0);
+ if (foundResult) {
+ if (command instanceof ExistsCommand) {
+ Boolean resp = (Boolean)response.get(1);
+ if (resp) {
+ numValidResponses++;
+ }
+ }
+ else if (command instanceof GetDataMapCommand) {
+ Map resp = (Map)response.get(1);
+ if (!resp.isEmpty()) {
+ numValidResponses++;
+ }
+ }
+ }
+ }
+ // always return true to make sure a response is logged by the
+ // JGroups RpcDispatcher.
+ return true;
+ }
+
+ public boolean needMoreResponses() {
+ return numValidResponses < 1 && pendingResponders.size() > 0;
+ }
+
+ }
+}
Property changes on: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -21,9 +21,6 @@
*/
package org.teiid.cache.jboss;
-import java.util.HashSet;
-import java.util.Set;
-
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
@@ -37,20 +34,6 @@
}
@Override
- public V get(K key) {
- Node<K, V> node = getRootNode();
- Node child = node.getChild(getFqn(key));
- if (child != null) {
- return (V)child.get(key);
- }
- return null;
- }
-
- private Fqn<String> getFqn(K key) {
- return Fqn.fromString(String.valueOf(key.getClass().getSimpleName()+key.hashCode()));
- }
-
- @Override
public V put(K key, V value) {
return this.put(key, value, null);
}
@@ -64,32 +47,4 @@
child.put(ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
return (V)child.put(key, value);
}
-
- @Override
- public V remove(K key) {
- Node<K, V> node = getRootNode();
- Node child = node.getChild(getFqn(key));
- if (child != null) {
- return (V)child.remove(key);
- }
- return null;
- }
-
- @Override
- public void clear() {
- Node<K, V> node = getRootNode();
- node.clearData();
- Set<Node<K,V>> nodes = new HashSet<Node<K, V>>(node.getChildren());
- for (Node<K, V> child : nodes) {
- child.clearData();
- node.removeChild(child.getFqn());
- }
- }
-
- @Override
- public int size() {
- Node<K, V> node = getRootNode();
- return node.getChildren().size();
- }
-
}
Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -22,10 +22,7 @@
package org.teiid.cache.jboss;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.HashSet;
import java.util.Set;
import org.jboss.cache.Fqn;
@@ -50,56 +47,61 @@
this.rootFqn = fqn;
}
+ @Override
public V get(K key) {
- return this.cacheStore.get(this.rootFqn, key);
+ Node<K, V> node = getRootNode();
+ Node child = node.getChild(getFqn(key));
+ if (child != null) {
+ return (V)child.get(key);
+ }
+ return null;
}
+ protected Fqn<String> getFqn(K key) {
+ if (key.getClass().isPrimitive() || key instanceof String) {
+ return Fqn.fromString(String.valueOf(key));
+ }
+ return Fqn.fromString(String.valueOf(key.getClass().getSimpleName()+key.hashCode()));
+ }
+
public V put(K key, V value) {
- return this.cacheStore.put(this.rootFqn, key, value);
+ Node<K, V> node = getRootNode();
+ Node<K, V> child = node.addChild(getFqn(key));
+ return child.put(key, value);
}
+ @Override
public V put(K key, V value, Long ttl) {
return this.put(key, value);
}
+ @Override
public V remove(K key) {
- return this.cacheStore.remove(this.rootFqn, key);
- }
-
- public Set<K> keySet() {
- Node<K, V> node = this.cacheStore.getRoot().getChild(this.rootFqn);
- if (node != null) {
- return node.getKeys();
+ Node<K, V> node = getRootNode();
+ Node child = node.getChild(getFqn(key));
+ if (child != null) {
+ return (V)child.remove(key);
}
- return Collections.emptySet();
+ return null;
}
+ @Override
public int size() {
- Node<K, V> node = this.cacheStore.getRoot().getChild(this.rootFqn);
- if (node != null) {
- return node.dataSize();
- }
- return 0;
+ Node<K, V> node = getRootNode();
+ return node.getChildren().size();
}
+ @Override
public void clear() {
- Node<K, V> node = this.cacheStore.getRoot().getChild(this.rootFqn);
- if (node != null) {
- node.clearData();
+ Node<K, V> node = getRootNode();
+ node.clearData();
+ Set<Node<K,V>> nodes = new HashSet<Node<K, V>>(node.getChildren());
+ for (Node<K, V> child : nodes) {
+ child.clearData();
+ node.removeChild(child.getFqn());
}
}
- public Collection<V> values() {
- Node<K, V> node = this.cacheStore.getRoot().getChild(this.rootFqn);
- if (node != null) {
- return node.getData().values();
- }
- return Collections.emptyList();
- }
-
- /**
- * {@inheritDoc}
- */
public synchronized void addListener(CacheListener listener) {
this.cacheListener = new JBossCacheListener(this.rootFqn, listener);
this.cacheStore.addCacheListener(this.cacheListener);
@@ -110,21 +112,6 @@
this.cacheListener = null;
}
- public Cache<K, V> addChild(String name) {
- Node<K, V> node = getRootNode();
- Node<K, V> childNode = node.addChild(Fqn.fromString(name));
- return new JBossCache<K, V>(this.cacheStore, childNode.getFqn());
- }
-
- public Cache<K, V> getChild(String name) {
- Node<K, V> node = getRootNode();
- Node<K, V> child = node.getChild(Fqn.fromString(name));
- if (child != null) {
- return new JBossCache<K, V>(this.cacheStore, child.getFqn());
- }
- return null;
- }
-
protected Node<K, V> getRootNode() {
Node<K, V> node = this.cacheStore.getNode(this.rootFqn);
if (node == null) {
@@ -132,25 +119,7 @@
}
return node;
}
-
- public List<Cache> getChildren() {
- Node<K, V> node = getRootNode();
- Set<Node<K,V>> nodes = node.getChildren();
- if (nodes.isEmpty()) {
- return Collections.emptyList();
- }
- List<Cache> children = new ArrayList<Cache>();
- for(Node<K, V> child: nodes) {
- children.add(new JBossCache<K, V>(this.cacheStore, child.getFqn()));
- }
- return children;
- }
- public boolean removeChild(String name) {
- Node<K, V> node = getRootNode();
- return node.removeChild(Fqn.fromString(name));
- }
-
@Override
public String getName() {
return this.rootFqn.toString();
Added: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java (rev 0)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,110 @@
+/*
+ * 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.cache.jboss;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.core.TeiidRuntimeException;
+
+public class TupleBatchCacheLoader extends ClusteredTupleBatchCacheLoader {
+
+ private BufferManager bufferMgr;
+ private IndividualCacheLoaderConfig config;
+
+ @Override
+ public boolean exists(Fqn fqn) throws Exception {
+ String id = fqn.getLastElementAsString();
+ int index = id.indexOf(',');
+ if (index != -1) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public Map<Object, Object> get(Fqn fqn) throws Exception {
+ String id = fqn.getLastElementAsString();
+ int index = id.indexOf(',');
+ if (index != -1) {
+ String uuid = id.substring(0, index);
+ int row = Integer.parseInt(id.substring(index+1));
+ TupleBuffer tb = this.bufferMgr.getTupleBuffer(uuid);
+ if (tb != null) {
+ Map map = new HashMap();
+ TupleBatch b = tb.getBatch(row);
+ b.preserveTypes();
+ map.put(id, b);
+ return map;
+ }
+ }
+ return super.get(fqn);
+ }
+
+ @Override
+ public Set<?> getChildrenNames(Fqn fqn) throws Exception {
+ return super.getChildrenNames(fqn);
+ }
+
+ @Override
+ public IndividualCacheLoaderConfig getConfig() {
+ return this.config;
+ }
+
+ @Override
+ public Object put(Fqn fqn, Object key, Object value) throws Exception {
+ return super.put(fqn, key, value);
+ }
+
+ @Override
+ public void remove(Fqn fqn) throws Exception {
+ super.remove(fqn);
+ }
+
+ @Override
+ public Object remove(Fqn fqn, Object key) throws Exception {
+ return super.remove(fqn, key);
+ }
+
+ @Override
+ public void removeData(Fqn fqn) throws Exception {
+ super.removeData(fqn);
+ }
+
+ @Override
+ public void setConfig(IndividualCacheLoaderConfig config) {
+ if (!(config instanceof TupleBatchCacheLoaderConfig)) {
+ throw new TeiidRuntimeException("Wrong Configuration"); //$NON-NLS-1$
+ }
+ this.config = config;
+ TupleBatchCacheLoaderConfig bmc = (TupleBatchCacheLoaderConfig)config;
+ this.bufferMgr = bmc.getBufferService().getBufferManager();
+ super.setConfig(config);
+ }
+
+}
Property changes on: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java (rev 0)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,57 @@
+/*
+ * 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.cache.jboss;
+
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.teiid.dqp.service.BufferService;
+
+public class TupleBatchCacheLoaderConfig extends IndividualCacheLoaderConfig {
+ private static final long serialVersionUID = -5926642610388245871L;
+ private BufferService service;
+ private long timeout;
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public TupleBatchCacheLoaderConfig() {
+ setClassName(TupleBatchCacheLoader.class.getName());
+ }
+
+ public TupleBatchCacheLoaderConfig(IndividualCacheLoaderConfig config) {
+ setClassName(TupleBatchCacheLoader.class.getName());
+ populateFromBaseConfig(config);
+ }
+
+
+ public void setBufferService(BufferService service) {
+ this.service = service;
+ }
+
+ public BufferService getBufferService() {
+ return this.service;
+ }
+}
Property changes on: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -189,7 +189,16 @@
*/
void clearCache(String cacheType) throws AdminException;
+
/**
+ * Get the Cache Statistics for the given type
+ * @param cacheType Cache Type
+ * @return {@link CacheStatistics}
+ * @throws AdminException
+ */
+ CacheStatistics getCacheStats(String cacheType) throws AdminException;
+
+ /**
* Terminate the Session
*
* @param identifier Session Identifier {@link org.teiid.adminapi.Session}.
Added: branches/7.1.x/client/src/main/java/org/teiid/adminapi/CacheStatistics.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/CacheStatistics.java (rev 0)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/CacheStatistics.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi;
+
+public interface CacheStatistics extends AdminObject {
+
+ double getHitRatio();
+
+ int getTotalEntries();
+
+ int getRequestCount();
+
+}
Property changes on: branches/7.1.x/client/src/main/java/org/teiid/adminapi/CacheStatistics.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java (rev 0)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.teiid.adminapi.CacheStatistics;
+
+(a)MetaMapping(CacheStatisticsMetadataMapper.class)
+public class CacheStatisticsMetadata extends AdminObjectImpl implements CacheStatistics{
+
+ private static final long serialVersionUID = -3514505497661004560L;
+
+ private double hitRatio;
+ private int totalEntries;
+ private int requestCount;
+
+ @Override
+ @ManagementProperty(description="Number of total requests made to the cache", readOnly=true)
+ public int getRequestCount() {
+ return requestCount;
+ }
+
+ public void setRequestCount(int count) {
+ this.requestCount = count;
+ }
+
+ @Override
+ @ManagementProperty(description="Cache hit ratio", readOnly=true)
+ public double getHitRatio() {
+ return this.hitRatio;
+ }
+
+ @Override
+ @ManagementProperty(description="Total number of cache entries", readOnly=true)
+ public int getTotalEntries() {
+ return this.totalEntries;
+ }
+
+ public void setHitRatio(double value) {
+ this.hitRatio = value;
+ }
+
+ public void setTotalEntries(int value) {
+ this.totalEntries = value;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("hitRatio=").append(hitRatio);//$NON-NLS-1$
+ sb.append("; totalEntries=").append(totalEntries); //$NON-NLS-1$
+ sb.append("; requestCount=").append(requestCount); //$NON-NLS-1$
+ return sb.toString();
+ }
+}
Property changes on: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java (rev 0)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class CacheStatisticsMetadataMapper extends MetaMapper<CacheStatisticsMetadata> {
+ private static final String HITRATIO = "hitRatio"; //$NON-NLS-1$
+ private static final String TOTAL_ENTRIES = "totalEntries"; //$NON-NLS-1$
+ private static final String REQUEST_COUNT = "requestCount"; //$NON-NLS-1$
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+ private static final MutableCompositeMetaType metaType;
+
+ static {
+ metaType = new MutableCompositeMetaType(CacheStatisticsMetadata.class.getName(), "The Cache statistics"); //$NON-NLS-1$
+ metaType.addItem(TOTAL_ENTRIES, TOTAL_ENTRIES, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem(HITRATIO, HITRATIO, SimpleMetaType.DOUBLE_PRIMITIVE);
+ metaType.addItem(REQUEST_COUNT, REQUEST_COUNT, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return CacheStatisticsMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, CacheStatisticsMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport cache = new CompositeValueSupport(composite);
+
+ cache.set(TOTAL_ENTRIES, SimpleValueSupport.wrap(object.getTotalEntries()));
+ cache.set(HITRATIO, SimpleValueSupport.wrap(object.getHitRatio()));
+ cache.set(REQUEST_COUNT, SimpleValueSupport.wrap(object.getRequestCount()));
+
+ return cache;
+ }
+ throw new IllegalArgumentException("Cannot convert cache statistics " + object); //$NON-NLS-1$
+ }
+
+ @Override
+ public CacheStatisticsMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
+ cache.setTotalEntries((Integer) metaValueFactory.unwrap(compositeValue.get(TOTAL_ENTRIES)));
+ cache.setHitRatio((Double) metaValueFactory.unwrap(compositeValue.get(HITRATIO)));
+ cache.setRequestCount((Integer) metaValueFactory.unwrap(compositeValue.get(REQUEST_COUNT)));
+ return cache;
+ }
+ throw new IllegalStateException("Unable to unwrap cache statistics " + metaValue); //$NON-NLS-1$
+ }
+
+}
Property changes on: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -42,4 +42,5 @@
void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException;
List<RequestMetadata> getLongRunningRequests();
List<RequestMetadata> getRequestsUsingVDB(String vdbName, int vdbVersion) throws AdminException;
+ CacheStatisticsMetadata getCacheStatistics(String cacheType);
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -24,7 +24,6 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -40,10 +39,14 @@
import org.jboss.managed.plugins.ManagedObjectImpl;
import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.CompositeValueSupport;
import org.jboss.metatype.api.values.GenericValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.teiid.adminapi.Admin;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
import org.teiid.adminapi.Transaction;
@@ -59,29 +62,22 @@
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();
public DQPManagementView() {
-
}
/*
* Metric methods
*/
- public Object getMetric(ProfileServiceConnection connection,
- String componentType, String identifier, String metric,
- Map<String, Object> valueMap) {
+ public Object getMetric(ProfileServiceConnection connection, String componentType, String identifier, String metric, Map<String, Object> valueMap) {
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;
@@ -92,36 +88,36 @@
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)) {
- resultObject = new Double(getSessionCount(connection).doubleValue());
- } else {
- if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection),
- longRunningQueries);
- resultObject = new Double(longRunningQueries.size());
- } else {
- if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
- try {
- 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 .equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+ resultObject = new Double(getSessionCount(connection).doubleValue());
+ } else if (metric .equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
+ Collection<Request> longRunningQueries = new ArrayList<Request>();
+ getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
+ resultObject = new Double(longRunningQueries.size());
+ } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
+ try {
+ 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$
+ return getCacheProperty(connection, metric);
}
-
return resultObject;
}
+
+ 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);
+ MetaValue v = mv.get(property);
+ return ((SimpleValue)v).getValue();
+ }
private Object getVdbMetric(ProfileServiceConnection connection,
String componentType, String identifier, String metric,
@@ -129,31 +125,21 @@
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;
}
@@ -161,19 +147,13 @@
* Operation methods
*/
- public void executeOperation(ProfileServiceConnection connection,
- ExecutedResult operationResult, final Map<String, Object> valueMap) {
+ 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);
}
-
}
private void executePlatformOperation(ProfileServiceConnection connection,
@@ -552,6 +532,16 @@
}
return count;
}
+
+ protected MetaValue getCacheStats(ProfileServiceConnection connection, String type) {
+ try {
+ 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$
+ }
+ return null;
+ }
protected MetaValue getLongRunningQueries(
ProfileServiceConnection connection) {
@@ -586,20 +576,16 @@
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 = (RequestMetadata) rmm
- .unwrapMetaValue(value);
+ 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$
}
}
}
@@ -609,15 +595,12 @@
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
- + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
}
}
}
@@ -627,15 +610,12 @@
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
- + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
}
}
}
@@ -645,17 +625,14 @@
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$
}
}
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -43,11 +43,8 @@
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.plugins.jbossas5.ApplicationServerComponent;
-import org.rhq.plugins.jbossas5.ProfileServiceComponent;
import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
import org.teiid.rhq.admin.DQPManagementView;
import org.teiid.rhq.plugin.util.PluginConstants;
@@ -59,22 +56,14 @@
*
*/
public class PlatformComponent extends Facet {
- private final Log LOG = LogFactory
- .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+ private final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
- String[] PLATFORM_SERVICES_NAMES = { "RuntimeEngineDeployer",
- "BufferService", "SessionService", "JdbcSocketConfiguration" };
+ String[] PLATFORM_SERVICES_NAMES = { "RuntimeEngineDeployer", //$NON-NLS-1$
+ "BufferService", "SessionService", "JdbcSocketConfiguration" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- /*
- * (non-Javadoc)
- *
- * @seeorg.teiid.rhq.plugin.Facet#start(org.rhq.core.pluginapi.inventory.
- * ResourceContext)
- */
@Override
public void start(ResourceContext context) {
- this.setComponentName(context.getPluginConfiguration().getSimpleValue(
- "name", null));
+ this.setComponentName(context.getPluginConfiguration().getSimpleValue( "name", null)); //$NON-NLS-1$
this.resourceConfiguration = context.getPluginConfiguration();
super.start(context);
}
@@ -93,22 +82,15 @@
RunState runState;
try {
- runState = ProfileServiceUtil.getRuntimeEngineDeployer(getConnection())
- .getRunState();
+ runState = ProfileServiceUtil.getRuntimeEngineDeployer(getConnection()).getRunState();
} catch (NamingException e) {
- LOG
- .error("Naming exception getting: "
- + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE);
+ LOG .debug("Naming exception getting: " + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE); //$NON-NLS-1$
return AvailabilityType.DOWN;
} catch (Exception e) {
- LOG
- .error("Exception getting: "
- + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE);
+ LOG .debug("Exception getting: " + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE); //$NON-NLS-1$
return AvailabilityType.DOWN;
}
- return (runState == RunState.RUNNING) ? AvailabilityType.UP
- : AvailabilityType.DOWN;
-
+ return (runState == RunState.RUNNING) ? AvailabilityType.UP: AvailabilityType.DOWN;
}
@Override
@@ -116,23 +98,17 @@
Configuration configuration, Map<String, Object> valueMap) {
// Parameter logic for System Operations
if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(
- Operation.Value.REQUEST_ID).getLongValue());
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
- Operation.Value.SESSION_ID).getLongValue());
+ valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
} else if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.TRANSACTION_ID, configuration
- .getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
+ valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
- Operation.Value.SESSION_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
}
-
}
@Override
- public void getValues(MeasurementReport report,
- Set<MeasurementScheduleRequest> requests) throws Exception {
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
DQPManagementView view = new DQPManagementView();
@@ -146,56 +122,27 @@
// Initialize any parameters to be used in the retrieval of
// metric values
- Object metricReturnObject = view.getMetric(getConnection(),
+ Object metric = view.getMetric(getConnection(),
getComponentType(), this.getComponentIdentifier(),
name, valueMap);
- try {
- if (request
- .getName()
- .equals(
- PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
- } else {
- if (request
- .getName()
- .equals(
- PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
- } else {
- if (request
- .getName()
- .equals(
- PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- report.addData(new MeasurementDataNumeric(
- request, (Double) metricReturnObject));
- } else {
- if (request
- .getName()
- .equals(
- PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
- report.addData(new MeasurementDataNumeric(
- request,
- (Double) metricReturnObject));
- }
- }
- }
- }
-
- } catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- throw (e);
+ if (metric instanceof Double) {
+ report.addData(new MeasurementDataNumeric(request, (Double) metric));
}
+ else if (metric instanceof Integer ){
+ report.addData(new MeasurementDataNumeric(request, new Double(((Integer)metric).doubleValue())));
+ }
+ else if (metric instanceof Long){
+ report.addData(new MeasurementDataNumeric(request, new Double(((Long)metric).longValue())));
+ }
+ else {
+ LOG.error("Metric value must be a numeric value"); //$NON-NLS-1$
+ }
}
} catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
+ LOG.error("Failed to obtain measurement [" + name + "]. Cause: " + e); //$NON-NLS-1$ //$NON-NLS-2$
throw (e);
}
-
}
@Override
@@ -204,13 +151,6 @@
super.stop();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.teiid.rhq.plugin.Facet#updateResourceConfiguration(org.rhq.core.pluginapi
- * .configuration.ConfigurationUpdateReport)
- */
@Override
public void updateResourceConfiguration(ConfigurationUpdateReport report) {
@@ -231,27 +171,23 @@
for (String serviceName : PLATFORM_SERVICES_NAMES) {
- managedComponent = managementView.getComponent(serviceName,
- componentType);
- Map<String, ManagedProperty> managedProperties = managedComponent
- .getProperties();
+ managedComponent = managementView.getComponent(serviceName, componentType);
+ Map<String, ManagedProperty> managedProperties = managedComponent.getProperties();
- ProfileServiceUtil.convertConfigurationToManagedProperties(
- managedProperties, resourceConfig, resourceContext
- .getResourceType());
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties, resourceConfig, resourceContext.getResourceType());
try {
managementView.updateComponent(managedComponent);
} catch (Exception e) {
- LOG.error("Unable to update component ["
- + managedComponent.getName() + "] of type "
- + componentType + ".", e);
+ LOG.error("Unable to update component [" //$NON-NLS-1$
+ + managedComponent.getName() + "] of type " //$NON-NLS-1$
+ + componentType + ".", e); //$NON-NLS-1$
report.setStatus(ConfigurationUpdateStatus.FAILURE);
report.setErrorMessageFromThrowable(e);
}
}
} catch (Exception e) {
- LOG.error("Unable to process update request", e);
+ LOG.error("Unable to process update request", e); //$NON-NLS-1$
report.setStatus(ConfigurationUpdateStatus.FAILURE);
report.setErrorMessageFromThrowable(e);
}
@@ -285,20 +221,14 @@
// Get all ManagedComponents of type Teiid and subtype dqp
Set<ManagedComponent> mcSet = null;
try {
- mcSet = ProfileServiceUtil
- .getManagedComponents(
- getConnection(),
- new org.jboss.managed.api.ComponentType(
+ mcSet = ProfileServiceUtil.getManagedComponents(getConnection(),
+ new org.jboss.managed.api.ComponentType(
PluginConstants.ComponentType.Platform.TEIID_TYPE,
PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE));
} catch (NamingException e) {
- LOG
- .error("NamingException getting components in Platform loadConfiguration(): "
- + e.getMessage());
+ LOG.error("NamingException getting components in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
} catch (Exception e) {
- LOG
- .error("Exception getting components in Platform loadConfiguration(): "
- + e.getMessage());
+ LOG.error("Exception getting components in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
}
for (ManagedComponent mc : mcSet) {
@@ -319,22 +249,18 @@
PropertySimple prop = new PropertySimple(mProp.getName(), value);
configuration.put(prop);
} catch (Exception e) {
- LOG
- .error("Exception setting properties in Platform loadConfiguration(): "
- + e.getMessage());
+ LOG.error("Exception setting properties in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
}
}
}
@Override
public ProfileServiceConnection getConnection() {
- return ((ApplicationServerComponent) this.resourceContext
- .getParentResourceComponent()).getConnection();
+ return ((ApplicationServerComponent) this.resourceContext.getParentResourceComponent()).getConnection();
}
@Override
public EmsConnection getEmsConnection() {
- // TODO Auto-generated method stub
return null;
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -96,7 +96,7 @@
// Add to return values
discoveredResources.add(detail);
- log.info("Discovered Teiid instance: " + mc.getName()); //$NON-NLS-1$
+ log.debug("Discovered Teiid instance: " + mc.getName()); //$NON-NLS-1$
return discoveredResources;
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -75,16 +75,14 @@
public final static String GET_TRANSACTIONS = "getTransactions"; //$NON-NLS-1$
public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
public final static String GET_BUFFER_USAGE = "userBufferSpace"; //$NON-NLS-1$
-
+ public final static String GET_CACHE_STATS = "getCacheStatistics"; //$NON-NLS-1$
}
public static interface Metrics {
-
public final static String QUERY_COUNT = "queryCount"; //$NON-NLS-1$
public final static String SESSION_COUNT = "sessionCount"; //$NON-NLS-1$
public final static String LONG_RUNNING_QUERIES = "longRunningQueries"; //$NON-NLS-1$
- public final static String BUFFER_USAGE = "userBufferSpace"; //$NON-NLS-1$
-
+ public final static String BUFFER_USAGE = "userBufferSpace"; //$NON-NLS-1$
}
}
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-08-30 18:58:21 UTC (rev 2505)
@@ -256,6 +256,30 @@
displayType="detail" category="throughput" property="userBufferSpace"
description="The currently used file buffer space in MB." />
+ <metric displayName="Prepared Plan Cache Hit Ratio %" defaultOn="true"
+ displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.hitRatio"
+ description="Prepared plan cache hit ratio" />
+
+ <metric displayName="Prepared Plan Cache Size" defaultOn="true"
+ displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.totalEntries"
+ description="Prepared plan cache size" />
+
+ <metric displayName="Prepared Plan Cache # of Requests" defaultOn="true"
+ displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.requestCount"
+ description="Prepared plan cache # Requests made aginst cache" />
+
+ <metric displayName="ResultSet Cache Hit Ratio %" defaultOn="true"
+ displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.hitRatio"
+ description="ResultSet cache hit ratio" />
+
+ <metric displayName="ResultSet Cache Size" defaultOn="true"
+ displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.totalEntries"
+ description="ResultSet cache Size" />
+
+ <metric displayName="ResultSet Cache # of Requests" defaultOn="true"
+ displayType="detail" category="performance" property="QUERY_SERVICE_RESULT_SET_CACHE.requestCount"
+ description="ResultSet cache # Requests made aginst cache" />
+
<resource-configuration>
<c:group name="teiidProperties" displayName="Runtime Engine Properties"
hiddenByDefault="false">
Modified: branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -116,4 +116,7 @@
STree createSTree(final List elements, String groupName, int keyLength);
+ void addTupleBuffer(TupleBuffer tb);
+
+ TupleBuffer getTupleBuffer(String id);
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -176,6 +176,7 @@
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ rowOffset = in.readInt();
terminationFlag = in.readBoolean();
preservedTypes = (String[])in.readObject();
if (types == null) {
@@ -187,6 +188,7 @@
}
}
public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(this.rowOffset);
out.writeBoolean(terminationFlag);
out.writeObject(this.preservedTypes);
BatchSerializer.writeBatch(out, types, getAllTuples());
Modified: branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -76,6 +76,7 @@
private LobManager lobManager;
private int[] lobIndexes;
+ private String uuid;
public TupleBuffer(BatchManager manager, String id, List<?> schema, int[] lobIndexes, int batchSize) {
this.manager = manager;
@@ -86,9 +87,16 @@
if (this.lobIndexes != null) {
this.lobManager = new LobManager();
}
- this.batchSize = batchSize;
+ this.batchSize = batchSize;
}
+ public String getId() {
+ if (this.uuid == null) {
+ this.uuid = java.util.UUID.randomUUID().toString();
+ }
+ return this.uuid;
+ }
+
public boolean isLobs() {
return lobIndexes != null;
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -29,6 +29,7 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -391,7 +392,10 @@
private volatile int activeBatchColumnCount = 0;
private Map<String, TupleBufferInfo> activeBatches = new LinkedHashMap<String, TupleBufferInfo>();
+ private Map<String, TupleReference> tupleBufferMap = new ConcurrentHashMap<String, TupleReference>();
+ private ReferenceQueue<TupleBuffer> tupleBufferQueue = new ReferenceQueue<TupleBuffer>();
+
private StorageManager diskMgr;
private AtomicLong tsId = new AtomicLong();
@@ -614,5 +618,38 @@
public void shutdown() {
}
-
+
+ @Override
+ public void addTupleBuffer(TupleBuffer tb) {
+ cleanDefunctTupleBuffers();
+ this.tupleBufferMap.put(tb.getId(), new TupleReference(tb, this.tupleBufferQueue));
+ }
+
+ @Override
+ public TupleBuffer getTupleBuffer(String id) {
+ cleanDefunctTupleBuffers();
+ Reference<TupleBuffer> r = this.tupleBufferMap.get(id);
+ if (r != null) {
+ return r.get();
+ }
+ return null;
+ }
+
+ private void cleanDefunctTupleBuffers() {
+ while (true) {
+ Reference r = this.tupleBufferQueue.poll();
+ if (r == null) {
+ break;
+ }
+ this.tupleBufferMap.remove(((TupleReference)r).id);
+ }
+ }
+
+ static class TupleReference extends WeakReference<TupleBuffer>{
+ String id;
+ public TupleReference(TupleBuffer referent, ReferenceQueue<? super TupleBuffer> q) {
+ super(referent, q);
+ id = referent.getId();
+ }
+ }
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -219,15 +219,15 @@
// Create the execution based on mode
final Execution exec = connector.createExecution(this.translatedCommand, this.securityContext, rmd, this.connection);
if (this.translatedCommand instanceof Call) {
- this.execution = Assertion.isInstanceOf(this.execution, ProcedureExecution.class, "Call Executions are expected to be ProcedureExecutions"); //$NON-NLS-1$
+ this.execution = Assertion.isInstanceOf(exec, ProcedureExecution.class, "Call Executions are expected to be ProcedureExecutions"); //$NON-NLS-1$
StoredProcedure proc = (StoredProcedure)command;
if (proc.returnParameters()) {
- this.procedureBatchHandler = new ProcedureBatchHandler((Call)this.translatedCommand, (ProcedureExecution)this.execution);
+ this.procedureBatchHandler = new ProcedureBatchHandler((Call)this.translatedCommand, (ProcedureExecution)exec);
}
} else if (this.translatedCommand instanceof QueryExpression){
- this.execution = Assertion.isInstanceOf(this.execution, ResultSetExecution.class, "QueryExpression Executions are expected to be ResultSetExecutions"); //$NON-NLS-1$
+ this.execution = Assertion.isInstanceOf(exec, ResultSetExecution.class, "QueryExpression Executions are expected to be ResultSetExecutions"); //$NON-NLS-1$
} else {
- Assertion.isInstanceOf(this.execution, UpdateExecution.class, "Update Executions are expected to be UpdateExecutions"); //$NON-NLS-1$
+ Assertion.isInstanceOf(exec, UpdateExecution.class, "Update Executions are expected to be UpdateExecutions"); //$NON-NLS-1$
this.execution = new ResultSetExecution() {
private int[] results;
private int index;
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -25,7 +25,6 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import java.util.UUID;
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
@@ -62,8 +61,12 @@
private String[] types;
private CacheHint hint;
private int batchSize;
+ private String uuid;
+ private int rowCount;
- protected ArrayList<UUID> cachedBatches = new ArrayList<UUID>();
+ public String getId() {
+ return this.uuid;
+ }
public AnalysisRecord getAnalysisRecord() {
return analysisRecord;
@@ -81,6 +84,8 @@
this.results = results;
this.batchSize = results.getBatchSize();
this.types = TupleBuffer.getTypeNames(results.getSchema());
+ this.rowCount = results.getRowCount();
+ this.uuid = results.getId();
}
public void setCommand(Command command) {
@@ -107,19 +112,8 @@
@Override
public boolean prepare(Cache cache, BufferManager bufferManager) {
Assertion.assertTrue(!this.results.isForwardOnly());
- try {
- for (int row = 1; row <= this.results.getRowCount(); row+=this.results.getBatchSize()) {
- TupleBatch batch = results.getBatch(row);
- UUID uuid = java.util.UUID.randomUUID();
- batch.preserveTypes();
- cache.put(uuid, batch, this.hint != null?this.hint.getTtl():null);
- this.cachedBatches.add(uuid);
- }
- return true;
- } catch (TeiidComponentException e) {
- LogManager.logDetail(LogConstants.CTX_DQP, DQPPlugin.Util.getString("failed_to_put_in_cache")); //$NON-NLS-1$
- }
- return false;
+ bufferManager.addTupleBuffer(this.results);
+ return true;
}
@Override
@@ -137,13 +131,15 @@
if (this.hint != null) {
buffer.setPrefersMemory(this.hint.getPrefersMemory());
}
- for (UUID uuid : this.cachedBatches) {
- TupleBatch batch = (TupleBatch)cache.get(uuid);
+
+ for (int row = 1; row <= this.rowCount; row+=this.batchSize) {
+ TupleBatch batch = (TupleBatch)cache.get(uuid+","+row); //$NON-NLS-1$
if (batch != null) {
buffer.addTupleBatch(batch, true);
- }
+ }
}
- this.results = buffer;
+ this.results = buffer;
+ bufferManager.addTupleBuffer(this.results);
}
return true;
} catch (TeiidComponentException e) {
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -41,6 +41,7 @@
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.Request.ProcessingState;
import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.cache.Cache;
@@ -554,7 +555,25 @@
}
}
+ public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
+ if (cacheType.equalsIgnoreCase(Admin.Cache.PREPARED_PLAN_CACHE.toString())) {
+ return buildCacheStats(Admin.Cache.PREPARED_PLAN_CACHE.toString(), this.prepPlanCache);
+ }
+ else if (cacheType.equalsIgnoreCase(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString())) {
+ return buildCacheStats(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), this.rsCache);
+ }
+ return null;
+ }
+ private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
+ CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
+ stats.setName(name);
+ stats.setHitRatio(cache.getRequestCount() == 0?0:(cache.getCacheHitCount()/cache.getRequestCount())*100);
+ stats.setTotalEntries(cache.getTotalCacheEntries());
+ stats.setRequestCount(cache.getRequestCount());
+ return stats;
+ }
+
public Collection<String> getCacheTypes(){
ArrayList<String> caches = new ArrayList<String>();
caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
@@ -639,6 +658,9 @@
this.exceptionOnMaxSourceRows = config.isExceptionOnMaxSourceRows();
this.chunkSize = config.getLobChunkSizeInKB() * 1024;
+
+ //get buffer manager
+ this.bufferManager = bufferService.getBufferManager();
//result set cache
CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
@@ -651,9 +673,7 @@
prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
prepPlanCache.setBufferManager(this.bufferManager);
- //get buffer manager
- this.bufferManager = bufferService.getBufferManager();
-
+
this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
@@ -809,6 +829,6 @@
public void setCacheFactory(CacheFactory factory) {
this.cacheFactory = factory;
- }
+ }
}
\ No newline at end of file
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -55,6 +55,7 @@
private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
private AtomicInteger cacheHit = new AtomicInteger();
+ private AtomicInteger totalRequests = new AtomicInteger();
private BufferManager bufferManager;
@@ -82,6 +83,8 @@
}
public T get(CacheID id){
+
+ this.totalRequests.getAndIncrement();
id.setSessionId(id.originalSessionId);
T result = localCache.get(id);
@@ -114,7 +117,18 @@
public int getCacheHitCount() {
return cacheHit.get();
}
+
+ public int getRequestCount() {
+ return this.totalRequests.get();
+ }
+ public int getTotalCacheEntries() {
+ if (this.localCache == this.distributedCache) {
+ return this.localCache.size();
+ }
+ return localCache.size() + distributedCache.size();
+ }
+
public void put(CacheID id, int determinismLevel, T t, Long ttl){
if (determinismLevel >= FunctionMethod.SESSION_DETERMINISTIC) {
id.setSessionId(id.originalSessionId);
@@ -249,16 +263,11 @@
}
- //for testing purpose
- int getSpaceUsed() {
- return localCache.size();
- }
int getSpaceAllowed() {
return maxSize;
}
public void setBufferManager(BufferManager bufferManager) {
this.bufferManager = bufferManager;
- }
-
+ }
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -105,15 +105,6 @@
private SessionAwareCache<CachedResults> cache;
private Executor executor;
- public TempTableDataManager(ProcessorDataManager processorDataManager, BufferManager bufferManager) {
- this(processorDataManager, bufferManager, new Executor() {
- @Override
- public void execute(Runnable command) {
- command.run();
- }
- }, new SessionAwareCache<CachedResults>());
- }
-
public TempTableDataManager(ProcessorDataManager processorDataManager, BufferManager bufferManager,
Executor executor, SessionAwareCache<CachedResults> cache){
this.processorDataManager = processorDataManager;
Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -21,7 +21,8 @@
*/
package org.teiid.dqp.internal.process;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -34,6 +35,7 @@
import org.teiid.cache.Cache;
import org.teiid.cache.DefaultCache;
import org.teiid.common.buffer.BatchManager;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
@@ -93,12 +95,20 @@
tb.close();
+ BufferManager bm = fbs.getBufferManager();
CachedResults results = new CachedResults();
results.setResults(tb);
results.setCommand(new Query());
Cache cache = new DefaultCache("dummy"); //$NON-NLS-1$
- results.prepare(cache, fbs.getBufferManager());
+ // simulate the jboss-cache remote transport, where the batches are remotely looked up
+ // in cache
+ for (int row=1; row<=tb.getRowCount();row+=4) {
+ cache.put(results.getId()+","+row, tb.getBatch(row), null); //$NON-NLS-1$
+ }
+
+ results.prepare(cache, bm);
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(results);
@@ -108,7 +118,7 @@
CachedResults cachedResults = (CachedResults)ois.readObject();
ois.close();
- cachedResults.restore(cache, fbs.getBufferManager());
+ cachedResults.restore(cache, bm);
// since restored, simulate a async cache flush
cache.clear();
Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -109,7 +109,7 @@
helpPutPreparedPlans(cache, token2, 0, 121);
helpPutPreparedPlans(cache, token, 0, 50);
- assertTrue(cache.getSpaceUsed() <= 100);
+ assertTrue(cache.getTotalCacheEntries() <= 100);
}
@Test public void testZeroSizeCache() {
@@ -120,12 +120,12 @@
// Add 1 plan and verify it is not in the cache
helpPutPreparedPlans(cache, token, 0, 1);
assertNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 0)));
- assertEquals(0, cache.getSpaceUsed());
+ assertEquals(0, cache.getTotalCacheEntries());
// Add another plan and verify it is not in the cache
helpPutPreparedPlans(cache, token, 1, 1);
assertNull(cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 1)));
- assertEquals(0, cache.getSpaceUsed());
+ assertEquals(0, cache.getTotalCacheEntries());
}
// set init size to negative number, which should default to 100 (default)
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -27,12 +27,16 @@
import java.util.Arrays;
import java.util.List;
+import java.util.concurrent.Executor;
import org.junit.Before;
import org.junit.Test;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.QueryProcessorFactoryImpl;
+import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
@@ -59,7 +63,17 @@
hdm.addData("SELECT matsrc.x FROM matsrc", new List[] {Arrays.asList((String)null), Arrays.asList("one"), Arrays.asList("two"), Arrays.asList("three")});
hdm.addData("SELECT mattable.info.e1, mattable.info.e2 FROM mattable.info", new List[] {Arrays.asList("a", 1), Arrays.asList("a", 2)});
hdm.addData("SELECT mattable.info.e2, mattable.info.e1 FROM mattable.info", new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
- dataManager = new TempTableDataManager(hdm, BufferManagerFactory.getStandaloneBufferManager());
+
+ BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
+ SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
+ cache.setBufferManager(bm);
+ Executor executor = new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+ };
+ dataManager = new TempTableDataManager(hdm, bm, executor, cache);
}
private void execute(String sql, List<?>... expectedResults) throws Exception {
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -39,6 +39,7 @@
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.concurrent.Executor;
import org.junit.Test;
import org.teiid.client.metadata.ParameterInfo;
@@ -54,6 +55,7 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.XMLType;
+import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.PreparedPlan;
import org.teiid.dqp.internal.process.QueryProcessorFactoryImpl;
import org.teiid.dqp.internal.process.SessionAwareCache;
@@ -244,7 +246,15 @@
context.setGlobalTableStore(new TempTableStore("SYSTEM"));
}
if (!(dataManager instanceof TempTableDataManager)) {
- dataManager = new TempTableDataManager(dataManager, bufferMgr);
+ SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
+ cache.setBufferManager(bufferMgr);
+ Executor executor = new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+ };
+ dataManager = new TempTableDataManager(dataManager, bufferMgr, executor, cache);
}
if (context.getQueryProcessorFactory() == null) {
context.setQueryProcessorFactory(new QueryProcessorFactoryImpl(bufferMgr, dataManager, new DefaultCapabilitiesFinder(), null, context.getMetadata()));
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -27,11 +27,15 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.Executor;
import org.junit.Before;
import org.junit.Test;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.dqp.internal.process.CachedResults;
+import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
@@ -60,9 +64,18 @@
metadata = new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), tempStore.getMetadataStore());
FakeDataManager fdm = new FakeDataManager();
TestProcessor.sampleData1(fdm);
- dataManager = new TempTableDataManager(fdm, BufferManagerFactory.getStandaloneBufferManager());
+ BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
+ SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
+ cache.setBufferManager(bm);
+ Executor executor = new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+ };
+ dataManager = new TempTableDataManager(fdm, bm, executor, cache);
}
-
+
@Test public void testInsertWithQueryExpression() throws Exception {
execute("create local temporary table x (e1 string, e2 integer)", new List[] {Arrays.asList(0)}); //$NON-NLS-1$
execute("insert into x (e2, e1) select e2, e1 from pm1.g1", new List[] {Arrays.asList(6)}); //$NON-NLS-1$
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -55,6 +55,7 @@
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminObject;
import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.CacheStatistics;
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
@@ -64,6 +65,7 @@
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.WorkerPoolStatistics;
import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.PropertyDefinitionMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.SessionMetadata;
@@ -699,4 +701,15 @@
}
return matched;
}
+
+ @Override
+ public CacheStatistics getCacheStats(String cacheType) throws AdminException {
+ try {
+ ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
+ MetaValue value = ManagedUtil.executeOperation(mc, "getCacheStatistics", SimpleValueSupport.wrap(cacheType));//$NON-NLS-1$
+ return (CacheStatistics)MetaValueFactory.getInstance().unwrap(value, CacheStatisticsMetadata.class);
+ } catch (Exception e) {
+ throw new AdminComponentException(e.getMessage(), e);
+ }
+ }
}
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-08-30 17:14:35 UTC (rev 2504)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-08-30 18:58:21 UTC (rev 2505)
@@ -49,6 +49,7 @@
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.DQPManagement;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.SessionMetadata;
@@ -149,14 +150,14 @@
if (this.jdbcSocketConfiguration.isEnabled()) {
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$
+ 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()) {
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$
+ 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$
}
@@ -164,7 +165,7 @@
if (this.odbcSocketConfiguration.isEnabled()) {
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$
+ 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$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_not_enabled")); //$NON-NLS-1$
}
@@ -382,6 +383,12 @@
}
@Override
+ @ManagementOperation(description="Get the cache statistics", impact=Impact.ReadOnly)
+ public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
+ return this.dqpCore.getCacheStatistics(cacheType);
+ }
+
+ @Override
@ManagementOperation(description="Active sessions", impact=Impact.ReadOnly)
public Collection<SessionMetadata> getActiveSessions() throws AdminException {
try {
14 years, 3 months
teiid SVN: r2504 - in branches/7.1.x: client/src/main/java/org/teiid/jdbc and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-08-30 13:14:35 -0400 (Mon, 30 Aug 2010)
New Revision: 2504
Modified:
branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.1.x/client/src/main/java/org/teiid/jdbc/SocketProfile.java
branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java
branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml
Log:
TEIID-1230 no longer allowing jdbc:metamatrix
Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-08-30 16:25:41 UTC (rev 2503)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-08-30 17:14:35 UTC (rev 2504)
@@ -39,6 +39,7 @@
</ul>
<h4>from 7.1</h4>
<ul>
+ <li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid instead.
<li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
</ul>
<h4>from 7.0</h4>
Modified: branches/7.1.x/client/src/main/java/org/teiid/jdbc/SocketProfile.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/jdbc/SocketProfile.java 2010-08-30 16:25:41 UTC (rev 2503)
+++ branches/7.1.x/client/src/main/java/org/teiid/jdbc/SocketProfile.java 2010-08-30 17:14:35 UTC (rev 2504)
@@ -61,7 +61,7 @@
// This host/port pattern allows just a . or a - to be in the host part.
static final String HOST_PORT_PATTERN = "[\\p{Alnum}\\.\\-\\_]+:\\d+"; //$NON-NLS-1$
- static final String URL_PATTERN = "jdbc:(metamatrix|teiid):([\\w-\\.]+)@mm[s]?://"+HOST_PORT_PATTERN+"(,"+HOST_PORT_PATTERN+")*(;.*)?"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ static final String URL_PATTERN = "jdbc:teiid:([\\w-\\.]+)@mm[s]?://"+HOST_PORT_PATTERN+"(,"+HOST_PORT_PATTERN+")*(;.*)?"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
static Pattern urlPattern = Pattern.compile(URL_PATTERN);
/**
Modified: branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java 2010-08-30 16:25:41 UTC (rev 2503)
+++ branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java 2010-08-30 17:14:35 UTC (rev 2504)
@@ -38,7 +38,7 @@
/** Valid format of urls*/
@Test public void testAcceptsURL1() throws Exception {
assertTrue(SocketProfile.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(SocketProfile.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
@@ -58,8 +58,8 @@
assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:metamatrix:jvdb@localhost:1234")); //$NON-NLS-1$
assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@localhost:1234")); //$NON-NLS-1$
+ assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@localhost:1234")); //$NON-NLS-1$
//DQP type
assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
Modified: branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2010-08-30 16:25:41 UTC (rev 2503)
+++ branches/7.1.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2010-08-30 17:14:35 UTC (rev 2504)
@@ -56,42 +56,42 @@
/** Valid format of urls*/
@Test public void testAcceptsURL1() throws Exception {
- assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mms://localhost:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mms://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
//DQP type
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:port")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:vdb@localhost:port;version=x")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
}
/** Invalid format of urls*/
@@ -104,7 +104,7 @@
@Test public void testParseURL() throws Exception{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
+ SocketProfile.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234")); //$NON-NLS-1$
assertEquals(3, p.size());
@@ -112,7 +112,7 @@
@Test public void testParseURL2() throws Exception {
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:metamatrix:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
+ SocketProfile.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234")); //$NON-NLS-1$
@@ -123,7 +123,7 @@
@Test public void testParseURL3() throws Exception{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+ SocketProfile.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$
@@ -135,7 +135,7 @@
}
@Test public void testGetPropertyInfo1() throws Exception {
- DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:metamatrix:vdb@mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
+ DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
assertEquals(19, info.length);
assertEquals(false, info[0].required);
Modified: branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2010-08-30 16:25:41 UTC (rev 2503)
+++ branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2010-08-30 17:14:35 UTC (rev 2504)
@@ -444,7 +444,7 @@
<programlisting><![CDATA[<datasources>
<local-tx-datasource>
<jndi-name>TEIID-DS</jndi-name>
- <connection-url>jdbc:metamatrix:myVDB@mm://localhost:31000</connection-url>
+ <connection-url>jdbc:teiid:myVDB@mm://localhost:31000</connection-url>
<driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
<user-name>admin</user-name>
<password>teiid</password>
@@ -515,7 +515,7 @@
<programlisting><![CDATA[<datasources>
<local-tx-datasource>
<jndi-name>TEIID-DS</jndi-name>
- <connection-url>jdbc:metamatrix:myVDB@mm://localhost:31000,mm://localhost:32000</connection-url>
+ <connection-url>jdbc:teiid:myVDB@mm://localhost:31000,mm://localhost:32000</connection-url>
<driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
<user-name>admin</user-name>
<password>teiid</password>
Modified: branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml
===================================================================
--- branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml 2010-08-30 16:25:41 UTC (rev 2503)
+++ branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml 2010-08-30 17:14:35 UTC (rev 2504)
@@ -43,7 +43,7 @@
(replacing terms in angle brackets with the appropriate values):
<programlisting><![CDATA[<property name="connection.url">
- jdbc:metamatrix:<vdb-name>@mm://<host>:<port>;user=<user-name>;password=<password>
+ jdbc:teiid:<vdb-name>@mm://<host>:<port>;user=<user-name>;password=<password>
</property>]]></programlisting></para>
</listitem>
<listitem>
14 years, 3 months
teiid SVN: r2503 - branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-08-30 12:25:41 -0400 (Mon, 30 Aug 2010)
New Revision: 2503
Modified:
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
Log:
TEIID-1202: Changed Active VDB status to display as UP, else DOWN
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-08-30 15:39:33 UTC (rev 2502)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-08-30 16:25:41 UTC (rev 2503)
@@ -200,8 +200,13 @@
.getName()
.equals(
PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
- report.addData(new MeasurementDataTrait(
- request, (String) metricReturnObject));
+ if (((String) metricReturnObject).equals("ACTIVE")) {
+ report.addData(new MeasurementDataTrait(
+ request, "UP"));
+ }else{
+ report.addData(new MeasurementDataTrait(
+ request, "DOWN"));
+ }
} else {
if (request
.getName()
14 years, 3 months