Author: rareddy
Date: 2010-06-04 15:58:22 -0400 (Fri, 04 Jun 2010)
New Revision: 2177
Modified:
trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1112: Adding a managed operation on dqp to get all requests for a perticular VDB.
Also fixed bug, where the sessionid was still being referred as the long instead of
string.
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-06-04
19:15:22 UTC (rev 2176)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-06-04
19:58:22 UTC (rev 2177)
@@ -28,7 +28,7 @@
public interface DQPManagement {
- List<RequestMetadata> getRequestsForSession(long sessionId) ;
+ List<RequestMetadata> getRequestsForSession(String sessionId) ;
List<RequestMetadata> getRequests();
WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
void terminateSession(String terminateeId);
@@ -41,4 +41,5 @@
void terminateTransaction(String xid) throws AdminException ;
void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int
targetVDBVersion) throws AdminException;
List<RequestMetadata> getLongRunningRequests();
+ List<RequestMetadata> getRequestsUsingVDB(String vdbName, int vdbVersion)
throws AdminException;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-06-04
19:15:22 UTC (rev 2176)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-06-04
19:58:22 UTC (rev 2177)
@@ -210,8 +210,8 @@
/**
* Return a list of {@link RequestMetadata} for the given session
*/
- public List<RequestMetadata> getRequestsForSession(long sessionId) {
- ClientState state = getClientState(String.valueOf(sessionId), false);
+ public List<RequestMetadata> getRequestsForSession(String sessionId) {
+ ClientState state = getClientState(sessionId, false);
if (state == null) {
return Collections.emptyList();
}
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java 2010-06-04
19:15:22 UTC (rev 2176)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java 2010-06-04
19:58:22 UTC (rev 2177)
@@ -31,7 +31,6 @@
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.client.RequestMessage;
import org.teiid.client.SourceWarning;
-import org.teiid.client.security.SessionToken;
import org.teiid.core.TeiidException;
import org.teiid.dqp.internal.datamgr.impl.FakeTransactionService;
import org.teiid.dqp.internal.process.DQPCore.ClientState;
@@ -44,7 +43,7 @@
*/
public class TestDQPCoreRequestHandling extends TestCase {
- private static final String SESSION_STRING = "2";
+ private static final String SESSION_STRING = "2"; //$NON-NLS-1$
public TestDQPCoreRequestHandling(String name) {
super(name);
@@ -65,7 +64,7 @@
public void testGetRequestsSessionToken1() {
DQPCore rm = new DQPCore();
Set reqs = new HashSet();
- Collection actualReqs = rm.getRequestsForSession(2);
+ Collection actualReqs = rm.getRequestsForSession(SESSION_STRING);
compareReqInfos(reqs, actualReqs);
}
@@ -79,7 +78,7 @@
RequestID id = addRequest(rm, SESSION_STRING, 1);
reqs.add(id);
- Collection<RequestMetadata> actualReqs = rm.getRequestsForSession(2);
+ Collection<RequestMetadata> actualReqs =
rm.getRequestsForSession(SESSION_STRING);
compareReqInfos(reqs, actualReqs);
}
@@ -102,7 +101,7 @@
reqs.add(addRequest(rm, SESSION_STRING, 1));
reqs.add(addRequest(rm, SESSION_STRING, 2));
- Collection actualReqs = rm.getRequestsForSession(2);
+ Collection actualReqs = rm.getRequestsForSession(SESSION_STRING);
compareReqInfos(reqs, actualReqs);
}
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-06-04
19:15:22 UTC (rev 2176)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-06-04
19:58:22 UTC (rev 2177)
@@ -25,6 +25,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -236,9 +237,27 @@
@Override
@ManagementOperation(description="Requests for perticular session",
impact=Impact.ReadOnly,params={@ManagementParameter(name="sessionId",description="The
session Identifier")})
- public List<RequestMetadata> getRequestsForSession(long sessionId) {
+ public List<RequestMetadata> getRequestsForSession(String sessionId) {
return this.dqpCore.getRequestsForSession(sessionId);
}
+
+ @Override
+ @ManagementOperation(description="Requests using a certain VDB",
impact=Impact.ReadOnly,params={@ManagementParameter(name="vdbName",description="VDB
Name"), @ManagementParameter(name="vdbVersion",description="VDB
Version")})
+ public List<RequestMetadata> getRequestsUsingVDB(String vdbName, int
vdbVersion) throws AdminException {
+ List<RequestMetadata> requests = new ArrayList<RequestMetadata>();
+ try {
+ Collection<SessionMetadata> sessions = this.sessionService.getActiveSessions();
+ for (SessionMetadata session:sessions) {
+ if (session.getVDBName().equals(vdbName) && session.getVDBVersion() ==
vdbVersion) {
+ requests.addAll(this.dqpCore.getRequestsForSession(session.getSessionId()));
+ }
+ }
+ } catch (SessionServiceException e) {
+ throw new AdminComponentException(e);
+ }
+ return requests;
+ }
+
@Override
@ManagementOperation(description="Active requests",
impact=Impact.ReadOnly)