Author: rareddy
Date: 2012-07-24 15:55:03 -0400 (Tue, 24 Jul 2012)
New Revision: 4265
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
Log:
TEIID-1923: admin supporting code to aid in console development
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-07-24
18:15:21 UTC (rev 4264)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-07-24
19:55:03 UTC (rev 4265)
@@ -204,16 +204,41 @@
}
@Override
protected void executeOperation(OperationContext context, DQPCore engine, ModelNode
operation) throws OperationFailedException{
+ String vdbName = null;
+ int version = -1;
+ boolean filter = false;
+
+ if (operation.hasDefined(OperationsConstants.VDB_VERSION) &&
operation.hasDefined(OperationsConstants.VDB_NAME)) {
+ vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
+ version = operation.get(OperationsConstants.VDB_VERSION).asInt();
+ filter = true;
+ }
+
ModelNode result = context.getResult();
for (TransportService t: this.transports) {
Collection<SessionMetadata> sessions = t.getActiveSessions();
for (SessionMetadata session:sessions) {
- VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
+ if (filter) {
+ if (session.getVDBName().equals(vdbName) && session.getVDBVersion() ==
version) {
+ VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
+ }
+ }
+ else {
+ VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
+ }
}
}
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME,
TYPE).set(ModelType.STRING);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME,
REQUIRED).set(false);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME,
DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
+
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION,
TYPE).set(ModelType.INT);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION,
REQUIRED).set(false);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION,
DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
+
ModelNode reply = operationNode.get(REPLY_PROPERTIES);
reply.get(TYPE).set(ModelType.LIST);
VDBMetadataMapper.SessionMetadataMapper.INSTANCE.describe(reply.get(VALUE_TYPE));
@@ -523,7 +548,7 @@
@Override
protected void executeOperation(OperationContext context, SessionAwareCache cache,
ModelNode operation) throws OperationFailedException {
- if (operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
+ if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
throw new OperationFailedException(new
ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-07-24
18:15:21 UTC (rev 4264)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-07-24
19:55:03 UTC (rev 4265)
@@ -310,6 +310,8 @@
list-requests.reply=list of requests
list-sessions.describe=List of all the current active sessions in the Teiid subsystem.
+list-sessions.vdb-name.describe=VDB Name
+list-sessions.vdb-version.describe=VDB Version
list-sessions.reply=list of sessions
list-transactions.describe=Active Transactions in the Query Engine