teiid SVN: r2080 - in trunk/test-integration/db: src/main/resources/ctc_tests and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-04-26 15:55:38 -0400 (Mon, 26 Apr 2010)
New Revision: 2080
Modified:
trunk/test-integration/db/runclienttest.sh
trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml
Log:
Teiid-773 - changes to adjust work within hudson
Modified: trunk/test-integration/db/runclienttest.sh
===================================================================
--- trunk/test-integration/db/runclienttest.sh 2010-04-26 19:32:24 UTC (rev 2079)
+++ trunk/test-integration/db/runclienttest.sh 2010-04-26 19:55:38 UTC (rev 2080)
@@ -5,14 +5,12 @@
#============================
# REQUIRED PROPERTIES
#
-# - USEDATASOURCES - indicates the datasource(s) (common separated) to use, this is the directory located inside directory datasourceloc
-$
#============================
# OPTIONAL PROPERTIES
#
# (if not set, will default to files within the db project)
-# - QUERYSETDIR - directory location where the test querties can be found]
+# - QUERYSETDIR - directory location where the test querties can be found
# - SCENARIODIR - directory location where the scenario files found and determine which query sets and vdbs to use,
# - DATASOURCEDIR - root directory location to find the various datasources to use
# - CONFIGFILE - specify the configuration file to use (override ctc-test.properties)
@@ -25,26 +23,6 @@
# JBEDSP_DEBUG=true
#
-
-# the property that defines which datasources to use. these names must exist as directories within the datasource loc.
-if [ -z "$USEDATASOURCES" ]
- then
-
- echo ""
- echo "Property <USEDATASOURCES> must be specified"
- echo "Exit"
- exit
-fi
-
-
-
-#if [ -z "${vdb.artifacts.dir}" ]
-# then
-#
-# vdb.artifacts.dir='./src/main/resources/transactions'
-#
-#fi
-
if [ -z "${QUERYSETDIR}" ]
then
@@ -66,7 +44,7 @@
DATASOURCEDIR='./src/main/resources/datasources'
fi
-echo "Use Datasources: ${USEDATASOURCES} loc: ${DATASOURCEDIR}"
+echo "Use Datasource directory: ${DATASOURCEDIR}"
#--------------------
@@ -106,8 +84,19 @@
#ANT_ARGS="${ANT_ARGS} -Dvdb.artifacts.dir=${vdb.artifacts.dir}"
ANT_ARGS="${ANT_ARGS} -Dproj.dir=${PRGDIR}"
+# default to the ip address used to start the server
+SVRNAME="0.0.0.0"
+if [ ! -z "${SERVERNAME}" ]
+ then
+
+ SVRNAME=${SERVERNAME}
+fi
+
+ANT_ARGS="${ANT_ARGS} -Dserver.host.name=${SVRNAME}"
+
+
if [ ! -z "${XMLCLZZ}" ]
then
Modified: trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml
===================================================================
--- trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml 2010-04-26 19:32:24 UTC (rev 2079)
+++ trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml 2010-04-26 19:55:38 UTC (rev 2080)
@@ -159,11 +159,9 @@
<jvmarg value="-Dquery.scenario.classname=${query.scenario.classname}" />
<jvmarg value="-Dusedatasources=${usedatasources}" />
<jvmarg value="-Ddatasourceloc=${datasourceloc}" />
+ <jvmarg value="-Dserver.host.name=${server.host.name}" />
<jvmarg value="-Dproj.dir=${proj_dir}" />
- <!--
- <jvmarg value="-Dvdb.artifacts.dir=${vdb_artifacts_dir}" />
- -->
</java>
@@ -193,11 +191,8 @@
<jvmarg value="-Dquery.scenario.classname=${query.scenario.classname}" />
<jvmarg value="-Dusedatasources=${usedatasources}" />
<jvmarg value="-Ddatasourceloc=${datasourceloc}" />
+ <jvmarg value="-Dserver.host.name=${server.host.name}" />
<jvmarg value="-Dproj.dir=${proj_dir}" />
-
- <!--
- <jvmarg value="-Dvdb.artifacts.dir=${vdb_artifacts_dir}" />
- -->
</java>
14 years, 8 months
teiid SVN: r2079 - in trunk/test-integration/db: src/assembly and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-04-26 15:32:24 -0400 (Mon, 26 Apr 2010)
New Revision: 2079
Modified:
trunk/test-integration/db/runclienttest.sh
trunk/test-integration/db/src/assembly/binaries.xml
Log:
Teiid-773 - changes to adjust for how hudson is working and make the script file executable
Modified: trunk/test-integration/db/runclienttest.sh
===================================================================
--- trunk/test-integration/db/runclienttest.sh 2010-04-26 01:01:27 UTC (rev 2078)
+++ trunk/test-integration/db/runclienttest.sh 2010-04-26 19:32:24 UTC (rev 2079)
@@ -101,9 +101,7 @@
fi
-ANT_ARGS=" -Dusedatasources=${USEDATASOURCES} "
-ANT_ARGS="${ANT_ARGS} -Ddatasourceloc=${DATASOURCEDIR}"
-ANT_ARGS="${ANT_ARGS} -Dscenario.dir=${SCENARIODIR}"
+ANT_ARGS=" -Dscenario.dir=${SCENARIODIR}"
ANT_ARGS="${ANT_ARGS} -Dqueryset.artifacts.dir=${QUERYSETDIR}"
#ANT_ARGS="${ANT_ARGS} -Dvdb.artifacts.dir=${vdb.artifacts.dir}"
ANT_ARGS="${ANT_ARGS} -Dproj.dir=${PRGDIR}"
Modified: trunk/test-integration/db/src/assembly/binaries.xml
===================================================================
--- trunk/test-integration/db/src/assembly/binaries.xml 2010-04-26 01:01:27 UTC (rev 2078)
+++ trunk/test-integration/db/src/assembly/binaries.xml 2010-04-26 19:32:24 UTC (rev 2079)
@@ -59,11 +59,32 @@
</dependencySets>
<fileSets>
+
<fileSet>
+ <directory>install_scripts</directory>
+ <outputDirectory>.</outputDirectory>
+ <includes>
+ <include>**/*.sh</include>
+ </includes>
+ <fileMode>755</fileMode>
+ </fileSet>
+
+ <fileSet>
+ <directory>install_scripts</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ <exclude>**/*.sh</exclude>
+ </excludes>
+ </fileSet>
+
+
+ <fileSet>
+
<includes>
- <include>runclienttest.*</include>
+ <include>runclienttest.sh</include>
</includes>
+ <fileMode>755</fileMode>
</fileSet>
<fileSet>
14 years, 8 months
teiid SVN: r2078 - in trunk: client/src/main/java/org/teiid/adminapi/impl and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-25 21:01:27 -0400 (Sun, 25 Apr 2010)
New Revision: 2078
Modified:
trunk/client/src/main/java/org/teiid/adminapi/Request.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
Log:
TEIID-1033 changing state to processingstate and added threadstate
Modified: trunk/client/src/main/java/org/teiid/adminapi/Request.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Request.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/client/src/main/java/org/teiid/adminapi/Request.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -36,11 +36,17 @@
*/
public interface Request extends AdminObject {
- public enum State {
+ public enum ProcessingState {
PROCESSING,
DONE,
CANCELED
}
+
+ public enum ThreadState {
+ RUNNING,
+ QUEUED,
+ IDLE
+ }
/**
* Get the ExecutionId for a Request
@@ -86,8 +92,13 @@
public Integer getNodeId();
/**
- * @return In the case that this is a source request this represents the node id. Otherwise blank
+ * @return The request state
*/
- State getState();
+ ProcessingState getState();
+
+ /**
+ * @return The thread state
+ */
+ ThreadState getThreadState();
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -43,7 +43,8 @@
private boolean sourceRequest;
private Integer nodeID;
private String transactionId;
- private State state;
+ private ProcessingState processingState = ProcessingState.PROCESSING;
+ private ThreadState threadState = ThreadState.RUNNING;
@Override
@ManagementProperty(description="Unique Identifier for Request", readOnly=true)
@@ -57,14 +58,23 @@
@Override
@ManagementProperty(description="State of the Request", readOnly=true)
- public State getState() {
- return state;
+ public ProcessingState getState() {
+ return processingState;
}
- public void setState(State state) {
- this.state = state;
+ public void setState(ProcessingState state) {
+ this.processingState = state;
}
+ @Override
+ public ThreadState getThreadState() {
+ return threadState;
+ }
+
+ public void setThreadState(ThreadState threadState) {
+ this.threadState = threadState;
+ }
+
@Override
@ManagementProperty(description="Session ID", readOnly=true)
public String getSessionId() {
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -36,7 +36,7 @@
import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
import org.jboss.metatype.spi.values.MetaMapper;
import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Request.State;
+import org.teiid.adminapi.Request.ProcessingState;
public class RequestMetadataMapper extends MetaMapper<RequestMetadata> {
private static final String TRANSACTION_ID = "transactionId"; //$NON-NLS-1$
@@ -46,7 +46,8 @@
private static final String START_TIME = "startTime"; //$NON-NLS-1$
private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
private static final String EXECUTION_ID = "executionId"; //$NON-NLS-1$
- private static final String STATE = "state"; //$NON-NLS-1$
+ private static final String STATE = "processingState"; //$NON-NLS-1$
+ private static final String THREAD_STATE = "threadState"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
@@ -59,8 +60,8 @@
metaType.addItem(SOURCE_REQUEST, SOURCE_REQUEST, SimpleMetaType.BOOLEAN_PRIMITIVE);
metaType.addItem(NODE_ID, NODE_ID, SimpleMetaType.INTEGER);
metaType.addItem(TRANSACTION_ID, TRANSACTION_ID, SimpleMetaType.STRING);
- EnumMetaType emt = new EnumMetaType(Request.State.values());
- metaType.addItem(STATE, STATE, emt);
+ metaType.addItem(STATE, STATE, new EnumMetaType(Request.ProcessingState.values()));
+ metaType.addItem(THREAD_STATE, THREAD_STATE, new EnumMetaType(Request.ThreadState.values()));
metaType.freeze();
}
@@ -91,6 +92,7 @@
request.set(TRANSACTION_ID,SimpleValueSupport.wrap(object.getTransactionId()));
EnumMetaType emt = (EnumMetaType)composite.getType(STATE);
request.set(STATE, new EnumValueSupport(emt, object.getState()));
+ request.set(THREAD_STATE, new EnumValueSupport((EnumMetaType)composite.getType(THREAD_STATE), object.getThreadState()));
return request;
}
throw new IllegalArgumentException("Cannot convert RequestMetadata " + object); //$NON-NLS-1$
@@ -112,7 +114,7 @@
request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get(SOURCE_REQUEST)));
request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get(NODE_ID)));
request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get(TRANSACTION_ID)));
- request.setState((State) metaValueFactory.unwrap(compositeValue.get(STATE)));
+ request.setState((ProcessingState) metaValueFactory.unwrap(compositeValue.get(STATE)));
return request;
}
throw new IllegalStateException("Unable to unwrap RequestMetadata " + metaValue); //$NON-NLS-1$
Modified: trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -26,13 +26,13 @@
import org.jboss.metatype.api.values.MetaValue;
import org.junit.Test;
-import org.teiid.adminapi.Request.State;
+import org.teiid.adminapi.Request.ProcessingState;
public class TestRequestMetadata {
@Test public void testMapping() {
RequestMetadata request = new RequestMetadata();
- request.setState(State.PROCESSING);
+ request.setState(ProcessingState.PROCESSING);
RequestMetadataMapper rmm = new RequestMetadataMapper();
MetaValue mv = rmm.createMetaValue(rmm.getMetaType(), request);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -39,5 +39,7 @@
void close();
AtomicResultsMessage execute() throws ConnectorException, BlockedException;
-
+
+ boolean isQueued();
+
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -142,6 +142,11 @@
public AbstractWorkItem getParent() {
return awi;
}
+
+ @Override
+ public boolean isQueued() {
+ return this.permitMode == PermitMode.BLOCKED;
+ }
public void cancel() {
try {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -40,7 +40,7 @@
}
private ThreadState threadState = ThreadState.MORE_WORK;
- private volatile boolean release;
+ private volatile boolean isProcessing;
public void run() {
startProcessing();
@@ -55,7 +55,12 @@
return this.threadState;
}
+ public boolean isProcessing() {
+ return isProcessing;
+ }
+
private synchronized void startProcessing() {
+ isProcessing = true;
logTrace("start processing"); //$NON-NLS-1$
if (this.threadState != ThreadState.MORE_WORK) {
throw new IllegalStateException("Must be in MORE_WORK"); //$NON-NLS-1$
@@ -64,6 +69,7 @@
}
private synchronized void endProcessing() {
+ isProcessing = false;
logTrace("end processing"); //$NON-NLS-1$
switch (this.threadState) {
case WORKING:
@@ -131,16 +137,12 @@
public abstract String toString();
+ @Override
+ public void release() {
+
+ }
+
@Override
- public void release() {
- this.release = true;
- }
-
- public boolean shouldAbortProcessing() {
- return this.release;
- }
-
- @Override
public void workAccepted(WorkEvent arg0) {
}
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-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -42,7 +42,8 @@
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.Request.State;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.client.DQP;
@@ -247,7 +248,19 @@
req.setSessionId(holder.requestID.getConnectionID());
req.setCommand(holder.requestMsg.getCommandString());
req.setStartTime(holder.getProcessingTimestamp());
- req.setState(holder.isCanceled()?State.CANCELED:holder.isDoneProcessing()?State.DONE:State.PROCESSING);
+ req.setState(holder.isCanceled()?ProcessingState.CANCELED:holder.isDoneProcessing()?ProcessingState.DONE:ProcessingState.PROCESSING);
+ switch (holder.getThreadState()) {
+ case DONE:
+ case IDLE:
+ req.setThreadState(ThreadState.IDLE);
+ break;
+ default:
+ if (holder.isProcessing()) {
+ req.setThreadState(ThreadState.RUNNING);
+ } else {
+ req.setThreadState(ThreadState.QUEUED);
+ }
+ }
if (holder.getTransactionContext() != null && holder.getTransactionContext().getTransactionType() != Scope.NONE) {
req.setTransactionId(holder.getTransactionContext().getTransactionId());
}
@@ -262,14 +275,20 @@
// add all the subrequest messages
AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
RequestMetadata info = new RequestMetadata();
-
+ if (conInfo.isQueued()) {
+ info.setThreadState(ThreadState.QUEUED);
+ } else if (conInfo.isRunning()) {
+ info.setThreadState(ThreadState.RUNNING);
+ } else {
+ info.setThreadState(ThreadState.IDLE);
+ }
info.setExecutionId(arm.getRequestID().getExecutionID());
info.setSessionId(holder.requestID.getConnectionID());
info.setCommand(arm.getCommand().toString());
info.setStartTime(arm.getProcessingTimestamp());
info.setSourceRequest(true);
info.setNodeId(arm.getAtomicRequestID().getNodeID());
- info.setState(conInfo.isCanceled()?State.CANCELED:conInfo.isDone()?State.DONE:State.PROCESSING);
+ info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
results.add(info);
}
results.add(req);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -57,6 +57,8 @@
private boolean closed;
private volatile boolean canceled;
+ private volatile boolean running;
+
/**
* Constructor for DataTierTupleSource.
*/
@@ -87,12 +89,19 @@
return null;
}
try {
+ running = true;
receiveResults(this.cwi.more());
} catch (ConnectorException e) {
exceptionOccurred(e, true);
+ } finally {
+ running = false;
}
}
}
+
+ public boolean isQueued() {
+ return this.cwi != null && this.cwi.isQueued();
+ }
public boolean isDone() {
return this.arm != null && this.arm.getFinalRow() > 0;
@@ -105,12 +114,19 @@
Assertion.isNull(workItem.getConnectorRequest(aqr.getAtomicRequestID()));
workItem.addConnectorRequest(aqr.getAtomicRequestID(), this);
}
+ running = true;
receiveResults(this.cwi.execute());
} catch (ConnectorException e) {
exceptionOccurred(e, true);
+ } finally {
+ running = false;
}
}
+ public boolean isRunning() {
+ return running;
+ }
+
public void fullyCloseSource() {
if (!closed) {
if (cwi != null) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -568,7 +568,6 @@
try {
transactionService.cancelTransactions(requestID.getConnectionID(), true);
} catch (XATransactionException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + requestID.getConnectionID()); //$NON-NLS-1$
throw new MetaMatrixComponentException(err);
}
}
@@ -682,4 +681,13 @@
return processingTimestamp;
}
+ @Override
+ public void release() {
+ try {
+ requestCancel();
+ } catch (MetaMatrixComponentException e) {
+ LogManager.logWarning(LogConstants.CTX_DQP, e, "Failed to cancel " + requestID); //$NON-NLS-1$
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2010-04-23 21:31:03 UTC (rev 2077)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2010-04-26 01:01:27 UTC (rev 2078)
@@ -104,6 +104,11 @@
public void cancel() {
}
+
+ @Override
+ public boolean isQueued() {
+ return false;
+ }
};
}
14 years, 8 months
teiid SVN: r2077 - in trunk: test-integration and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-23 17:31:03 -0400 (Fri, 23 Apr 2010)
New Revision: 2077
Modified:
trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
trunk/test-integration/pom.xml
Log:
fix for windows build error
Modified: trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2010-04-22 22:13:45 UTC (rev 2076)
+++ trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2010-04-23 21:31:03 UTC (rev 2077)
@@ -856,12 +856,14 @@
}
File f = new File(tableRecord.getResourcePath());
String path = f.getParent();
-
+ if (File.separatorChar != '/') {
+ path = path.replace(File.separatorChar, '/');
+ }
for (String string : schemaPaths) {
SQLXMLImpl schema = getVDBResourceAsSQLXML(string);
if (schema == null) {
- schema = getVDBResourceAsSQLXML(path + File.separator + string);
+ schema = getVDBResourceAsSQLXML(path + '/' + string);
}
if (schema == null) {
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2010-04-22 22:13:45 UTC (rev 2076)
+++ trunk/test-integration/pom.xml 2010-04-23 21:31:03 UTC (rev 2077)
@@ -37,11 +37,6 @@
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-connector-api</artifactId>
</dependency>
<dependency>
14 years, 8 months
teiid SVN: r2076 - trunk/console/src/main/resources/META-INF.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-04-22 18:13:45 -0400 (Thu, 22 Apr 2010)
New Revision: 2076
Modified:
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
Moved transaction operations from VDB to Runtime
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2010-04-22 22:03:05 UTC (rev 2075)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2010-04-22 22:13:45 UTC (rev 2076)
@@ -101,6 +101,15 @@
</results>
</operation>
+ <operation name="terminateSession" displayName="Terminate Session"
+ description="Terminate a specified session">
+ <parameters>
+ <c:simple-property displayName="SessionID" name="sessionID"
+ type="long" required="true" description="The ID of the session to terminate" />
+ </parameters>
+ </operation>
+
+
<operation name="getRequests" displayName="View current requests"
description="Get current requests executing against this Teiid instance">
<results>
@@ -145,11 +154,35 @@
</parameters>
</operation>
- <operation name="terminateSession" displayName="Terminate Session"
- description="Terminate a specified session">
+ <operation name="getTransactions" displayName="View current transactions"
+ description="Get current transactions executing against this VDB">
+ <results>
+ <c:list-property name="list" displayName="Current Transactions"
+ description="Transactions currently executing against the Teiid system"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Transaction ID"
+ name="getId" type="string"
+ description="The Xid string for GLOBAL transactions or the Transaction id string LOCAL/REQUEST." />
+ <c:simple-property displayName="Session ID"
+ name="getAssociatedSession" type="string"
+ description="Get the session associated with the this transaction. May be null for an unassociated Global transaction." />
+ <c:simple-property displayName="Scope" name="getScope"
+ type="string"
+ description="Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="The local creation time." />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="terminateTransaction" displayName="Terminate Transaction"
+ description="Terminate a specified transaction">
<parameters>
- <c:simple-property displayName="SessionID" name="sessionID"
- type="long" required="true" description="The ID of the session to terminate" />
+ <c:simple-property displayName="Transaction ID"
+ name="transactionID" type="long" required="true"
+ description="The ID of the transaction to terminate" />
</parameters>
</operation>
@@ -375,37 +408,6 @@
</results>
</operation>
- <operation name="getTransactions" displayName="View current transactions"
- description="Get current transactions executing against this VDB">
- <results>
- <c:list-property name="list" displayName="Current Transactions"
- description="Transactions currently executing against the Teiid system"
- required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Transaction ID"
- name="getId" type="string"
- description="The Xid string for GLOBAL transactions or the Transaction id string LOCAL/REQUEST." />
- <c:simple-property displayName="Session ID"
- name="getAssociatedSession" type="string"
- description="Get the session associated with the this transaction. May be null for an unassociated Global transaction." />
- <c:simple-property displayName="Scope" name="getScope"
- type="string"
- description="Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST" />
- <c:simple-property displayName="Created Time"
- name="getCreatedTime" type="string" description="The local creation time." />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="terminateTransaction" displayName="Terminate Transaction"
- description="Terminate a specified transaction">
- <parameters>
- <c:simple-property displayName="Transaction ID" name="transactionID"
- type="long" required="true" description="The ID of the transaction to terminate" />
- </parameters>
- </operation>
-
<metric displayName="Status" defaultOn="true" dataType="trait"
displayType="summary" category="availability" property="status"
description="The status of this VDB" />
14 years, 8 months
teiid SVN: r2075 - in trunk: engine/src/main/java/org/teiid/dqp/internal/process and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-22 18:03:05 -0400 (Thu, 22 Apr 2010)
New Revision: 2075
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManager.java
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
Log:
TEIID-1015 adding back queuing logic for non-transactional requests
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -26,6 +26,7 @@
*/
package org.teiid.dqp.internal.datamgr.impl;
+import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
@@ -46,10 +47,12 @@
import org.teiid.connector.metadata.runtime.MetadataFactory;
import org.teiid.connector.metadata.runtime.MetadataStore;
import org.teiid.dqp.internal.cache.DQPContextCache;
+import org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.PermitMode;
+import org.teiid.dqp.internal.process.AbstractWorkItem;
import org.teiid.logging.api.CommandLogMessage;
import org.teiid.logging.api.CommandLogMessage.Event;
-import org.teiid.security.SecurityHelper;
+import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.log.MessageLevel;
@@ -70,17 +73,9 @@
@ManagementObject(isRuntime=true, componentType=@ManagementComponent(type="teiid",subtype="connectormanager"), properties=ManagementProperties.EXPLICIT)
public class ConnectorManager {
- public enum ConnectorStatus {
- NOT_INITIALIZED, INIT_FAILED, OPEN, DATA_SOURCE_UNAVAILABLE, CLOSED, UNABLE_TO_CHECK;
- }
-
public static final int DEFAULT_MAX_THREADS = 20;
private String connectorName;
- private SecurityHelper securityHelper;
-
- private volatile ConnectorStatus state = ConnectorStatus.NOT_INITIALIZED;
-
//services acquired in start
private BufferService bufferService;
@@ -88,25 +83,42 @@
private ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem> requestStates = new ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem>();
private SourceCapabilities cachedCapabilities;
+
+ private int currentConnections;
+ private int maxConnections;
+ private LinkedList<ConnectorWorkItem> queuedRequests = new LinkedList<ConnectorWorkItem>();
+
+ private volatile boolean stopped;
public ConnectorManager(String name) {
- this(name, DEFAULT_MAX_THREADS, null);
+ this(name, DEFAULT_MAX_THREADS);
}
- public ConnectorManager(String name, int maxThreads, SecurityHelper securityHelper) {
+ public ConnectorManager(String name, int maxThreads) {
if (name == null) {
throw new IllegalArgumentException("Connector name can not be null"); //$NON-NLS-1$
}
if (maxThreads <= 0) {
maxThreads = DEFAULT_MAX_THREADS;
}
+ this.maxConnections = maxThreads;
this.connectorName = name;
- this.securityHelper = securityHelper;
}
- SecurityHelper getSecurityHelper() {
- return securityHelper;
- }
+ public synchronized void acquireConnectionLock(ConnectorWorkItem item) throws BlockedException {
+ switch (item.getPermitMode()) {
+ case NOT_ACQUIRED:
+ if (currentConnections < maxConnections) {
+ currentConnections++;
+ item.setPermitMode(PermitMode.ACQUIRED);
+ return;
+ }
+ queuedRequests.add(item);
+ item.setPermitMode(PermitMode.BLOCKED);
+ case BLOCKED:
+ throw BlockedException.INSTANCE;
+ }
+ }
public String getName() {
return this.connectorName;
@@ -129,7 +141,6 @@
return factory.getMetadataStore();
}
-
public SourceCapabilities getCapabilities() throws ConnectorException {
if (cachedCapabilities != null) {
return cachedCapabilities;
@@ -161,13 +172,13 @@
}
}
- public ConnectorWork executeRequest(AtomicRequestMessage message) throws ConnectorException {
+ public ConnectorWork executeRequest(AtomicRequestMessage message, AbstractWorkItem awi) throws ConnectorException {
// Set the connector ID to be used; if not already set.
checkStatus();
AtomicRequestID atomicRequestId = message.getAtomicRequestID();
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {atomicRequestId, "Create State"}); //$NON-NLS-1$
- ConnectorWorkItem item = new ConnectorWorkItem(message, this);
+ ConnectorWorkItem item = new ConnectorWorkItem(message, awi, this);
Assertion.isNull(requestStates.put(atomicRequestId, item), "State already existed"); //$NON-NLS-1$
return item;
}
@@ -182,7 +193,18 @@
*/
void removeState(AtomicRequestID id) {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {id, "Remove State"}); //$NON-NLS-1$
- requestStates.remove(id);
+ ConnectorWorkItem cwi = requestStates.remove(id);
+ if (cwi != null && cwi.getPermitMode() == PermitMode.ACQUIRED) {
+ synchronized (this) {
+ ConnectorWorkItem next = queuedRequests.pollFirst();
+ if (next == null) {
+ currentConnections--;
+ return;
+ }
+ next.setPermitMode(PermitMode.ACQUIRED);
+ next.getParent().moreWork();
+ }
+ }
}
int size() {
@@ -196,28 +218,15 @@
/**
* initialize this <code>ConnectorManager</code>.
*/
- public synchronized void start() {
- if (this.state != ConnectorStatus.NOT_INITIALIZED) {
- return;
- }
- this.state = ConnectorStatus.INIT_FAILED;
-
+ public void start() {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorManagerImpl.Initializing_connector", connectorName)); //$NON-NLS-1$
-
- this.state = ConnectorStatus.OPEN;
}
/**
* Stop this connector.
*/
- public void stop() {
- synchronized (this) {
- if (this.state == ConnectorStatus.CLOSED) {
- return;
- }
- this.state= ConnectorStatus.CLOSED;
- }
-
+ public void stop() {
+ stopped = true;
//ensure that all requests receive a response
for (ConnectorWork workItem : this.requestStates.values()) {
workItem.cancel();
@@ -289,12 +298,8 @@
return null;
}
- public ConnectorStatus getStatus() {
- return this.state;
- }
-
private void checkStatus() throws ConnectorException {
- if (this.state != ConnectorStatus.OPEN) {
+ if (stopped) {
throw new ConnectorException(DQPPlugin.Util.getString("ConnectorManager.not_in_valid_state", this.connectorName)); //$NON-NLS-1$
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWork.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -24,6 +24,7 @@
import org.teiid.connector.api.ConnectorException;
+import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.dqp.message.AtomicResultsMessage;
/**
@@ -37,6 +38,6 @@
void close();
- AtomicResultsMessage execute() throws ConnectorException;
+ AtomicResultsMessage execute() throws ConnectorException, BlockedException;
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -42,9 +42,11 @@
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.dqp.internal.datamgr.language.LanguageBridgeFactory;
import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;
+import org.teiid.dqp.internal.process.AbstractWorkItem;
import org.teiid.logging.api.CommandLogMessage.Event;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.TupleBuffer;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
@@ -64,12 +66,18 @@
public class ConnectorWorkItem implements ConnectorWork {
+ enum PermitMode {
+ BLOCKED, ACQUIRED, NOT_ACQUIRED
+ }
+
/* Permanent state members */
private AtomicRequestID id;
private ConnectorManager manager;
private AtomicRequestMessage requestMsg;
private Connector connector;
private QueryMetadataInterface queryMetadata;
+ private PermitMode permitMode = PermitMode.NOT_ACQUIRED;
+ private AbstractWorkItem awi;
/* Created on new request */
private Connection connection;
@@ -89,7 +97,7 @@
private AtomicBoolean isCancelled = new AtomicBoolean();
- ConnectorWorkItem(AtomicRequestMessage message, ConnectorManager manager) throws ConnectorException {
+ ConnectorWorkItem(AtomicRequestMessage message, AbstractWorkItem awi, ConnectorManager manager) throws ConnectorException {
this.id = message.getAtomicRequestID();
this.requestMsg = message;
this.manager = manager;
@@ -116,11 +124,24 @@
if (requestMsg.isTransactional() && this.connectorEnv.isXaCapable()) {
this.securityContext.setTransactional(true);
}
+ this.awi = awi;
}
public AtomicRequestID getId() {
return id;
}
+
+ public PermitMode getPermitMode() {
+ return permitMode;
+ }
+
+ public void setPermitMode(PermitMode permitMode) {
+ this.permitMode = permitMode;
+ }
+
+ public AbstractWorkItem getParent() {
+ return awi;
+ }
public void cancel() {
try {
@@ -196,10 +217,14 @@
return new ConnectorException(t);
}
- public AtomicResultsMessage execute() throws ConnectorException {
+ public AtomicResultsMessage execute() throws ConnectorException, BlockedException {
if(isCancelled()) {
throw new ConnectorException("Request canceled"); //$NON-NLS-1$
}
+
+ if (!this.securityContext.isTransactional()) {
+ this.manager.acquireConnectionLock(this);
+ }
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.requestMsg.getAtomicRequestID(), "Processing NEW request:", this.requestMsg.getCommand()}); //$NON-NLS-1$
try {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -92,7 +92,7 @@
return this.threadState == ThreadState.IDLE;
}
- protected void moreWork() {
+ public void moreWork() {
moreWork(true);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -346,8 +346,8 @@
return aqr;
}
- ConnectorWork executeRequest(AtomicRequestMessage aqr, String connectorName) throws ConnectorException {
- return getCM(connectorName).executeRequest(aqr);
+ ConnectorWork executeRequest(AtomicRequestMessage aqr, AbstractWorkItem awi, String connectorName) throws ConnectorException {
+ return getCM(connectorName).executeRequest(aqr, awi);
}
/**
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -101,7 +101,7 @@
void open() throws MetaMatrixComponentException, MetaMatrixProcessingException {
try {
if (this.cwi == null) {
- this.cwi = this.dataMgr.executeRequest(aqr, this.connectorName);
+ this.cwi = this.dataMgr.executeRequest(aqr, this.workItem, this.connectorName);
Assertion.isNull(workItem.getConnectorRequest(aqr.getAtomicRequestID()));
workItem.addConnectorRequest(aqr.getAtomicRequestID(), this);
}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -33,6 +33,7 @@
import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
import org.teiid.dqp.internal.datamgr.impl.ConnectorWork;
import org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem;
+import org.teiid.dqp.internal.process.AbstractWorkItem;
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -67,7 +68,7 @@
}
@Override
- public ConnectorWork executeRequest(AtomicRequestMessage message)
+ public ConnectorWork executeRequest(AtomicRequestMessage message, AbstractWorkItem awi)
throws ConnectorException {
if (throwExceptionOnExecute) {
throw new ConnectorException("Connector Exception"); //$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManager.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManager.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -31,7 +31,9 @@
import org.mockito.Mockito;
import org.teiid.connector.api.Connector;
import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.dqp.internal.process.AbstractWorkItem;
+import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.dqp.message.AtomicRequestID;
import com.metamatrix.dqp.message.AtomicRequestMessage;
import com.metamatrix.dqp.message.RequestID;
@@ -46,7 +48,7 @@
static ConnectorManager getConnectorManager(ConnectorEnvironment env) throws Exception {
final FakeConnector c = new FakeConnector();
c.setConnectorEnvironment(env);
- ConnectorManager cm = new ConnectorManager("FakeConnector") { //$NON-NLS-1$
+ ConnectorManager cm = new ConnectorManager("FakeConnector", 1) { //$NON-NLS-1$
Connector getConnector() {
return c;
}
@@ -70,7 +72,7 @@
}
void helpAssureOneState() throws Exception {
- csm.executeRequest(request);
+ csm.executeRequest(request, Mockito.mock(AbstractWorkItem.class));
ConnectorWork state = csm.getState(request.getAtomicRequestID());
assertEquals(state, csm.getState(request.getAtomicRequestID()));
}
@@ -102,5 +104,34 @@
assertEquals("Expected size of 1", 1, csm.size()); //$NON-NLS-1$
}
+
+ public void testQueuing() throws Exception {
+ ConnectorWork workItem = csm.executeRequest(request, Mockito.mock(AbstractWorkItem.class));
+ workItem.execute();
+
+ AbstractWorkItem awi1 = Mockito.mock(AbstractWorkItem.class);
+ ConnectorWork workItem1 = csm.executeRequest(TestConnectorWorkItem.createNewAtomicRequestMessage(2, 1), awi1);
+
+ AbstractWorkItem awi2 = Mockito.mock(AbstractWorkItem.class);
+ ConnectorWork workItem2 = csm.executeRequest(TestConnectorWorkItem.createNewAtomicRequestMessage(3, 1), awi2);
+
+ try {
+ workItem1.execute();
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (BlockedException e) {
+
+ }
+ workItem.close();
+
+ try {
+ workItem2.execute(); //ensure that another item cannot jump in the queue
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (BlockedException e) {
+
+ }
+
+ Mockito.verify(awi1).moreWork();
+ workItem1.execute();
+ }
}
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -38,6 +38,7 @@
import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.language.Call;
import org.teiid.dqp.internal.datamgr.language.LanguageBridgeFactory;
+import org.teiid.dqp.internal.process.AbstractWorkItem;
import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -116,7 +117,8 @@
Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1);
arm.setCommand(command);
- ConnectorWorkItem synchConnectorWorkItem = new ConnectorWorkItem(arm, TestConnectorManager.getConnectorManager(Mockito.mock(ConnectorEnvironment.class)));
+ ConnectorWorkItem synchConnectorWorkItem = new ConnectorWorkItem(arm, Mockito.mock(AbstractWorkItem.class),
+ TestConnectorManager.getConnectorManager(Mockito.mock(ConnectorEnvironment.class)));
return synchConnectorWorkItem.execute();
}
@@ -150,7 +152,7 @@
return Mockito.mock(Xid.class);
}} );
- new ConnectorWorkItem(requestMsg, cm);
+ new ConnectorWorkItem(requestMsg, Mockito.mock(AbstractWorkItem.class), cm);
}
@Ignore
@@ -178,7 +180,7 @@
return Mockito.mock(Xid.class);
}} );
- new ConnectorWorkItem(requestMsg, cm);
+ new ConnectorWorkItem(requestMsg, Mockito.mock(AbstractWorkItem.class), cm);
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java 2010-04-22 21:17:22 UTC (rev 2074)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java 2010-04-22 22:03:05 UTC (rev 2075)
@@ -95,7 +95,7 @@
ConnectorManager createConnectorManger(String deployedConnectorName, int maxThreads) {
- ConnectorManager mgr = new ConnectorManager(deployedConnectorName, maxThreads, securityHelper);
+ ConnectorManager mgr = new ConnectorManager(deployedConnectorName, maxThreads);
return mgr;
}
14 years, 8 months
teiid SVN: r2074 - trunk/console/src/main/java/org/teiid/rhq/admin.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-04-22 17:17:22 -0400 (Thu, 22 Apr 2010)
New Revision: 2074
Modified:
trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
Log:
Added filter for VDBs when getting sessions and request
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-04-22 18:55:02 UTC (rev 2073)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-04-22 21:17:22 UTC (rev 2074)
@@ -14,22 +14,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
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.EnumValueSupport;
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.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertyList;
-import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.configuration.PropertySimple;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
import org.teiid.adminapi.Transaction;
@@ -225,14 +217,14 @@
} else if (operationName.equals(VDB.Operations.GET_SESSIONS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue sessionMetaValue = getSessions();
- getSessionCollectionValue(sessionMetaValue,
- activeSessionsCollection);
+ getSessionCollectionValueForVDB(sessionMetaValue,
+ activeSessionsCollection, (String)valueMap.get(PluginConstants.ComponentType.VDB.NAME));
operationResult.setContent(createReportResultList(fieldNameList,
activeSessionsCollection.iterator()));
} else if (operationName.equals(VDB.Operations.GET_REQUESTS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue requestMetaValue = getRequests();
- getRequestCollectionValue(requestMetaValue, resultObject);
+ getRequestCollectionValueForVDB(requestMetaValue, resultObject, (String)valueMap.get(PluginConstants.ComponentType.VDB.NAME));
operationResult.setContent(createReportResultList(fieldNameList,
resultObject.iterator()));
}
@@ -507,6 +499,26 @@
}
}
+ public static <T> void getRequestCollectionValueForVDB(MetaValue pValue,
+ Collection<Request> list, String vdbName) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Request request = (Request) MetaValueFactory.getInstance()
+ .unwrap(value);
+ if (request.getName().equals(vdbName)){
+ list.add(request);
+ }
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type");
+ }
+ }
+ }
+ }
+
public static <T> void getTransactionCollectionValue(MetaValue pValue,
Collection<Transaction> list) {
MetaType metaType = pValue.getMetaType();
@@ -543,6 +555,26 @@
}
}
}
+
+ public static <T> void getSessionCollectionValueForVDB(MetaValue pValue,
+ Collection<Session> list, String vdbName) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Session session = (Session) MetaValueFactory.getInstance()
+ .unwrap(value);
+ if (session.getName().equals(vdbName)){
+ list.add(session);
+ }
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type");
+ }
+ }
+ }
+ }
private Collection createReportResultList(List fieldNameList,
Iterator objectIter) {
14 years, 8 months
teiid SVN: r2073 - in trunk: client/src/main/java/org/teiid/adminapi and 22 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-22 14:55:02 -0400 (Thu, 22 Apr 2010)
New Revision: 2073
Added:
trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
trunk/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
Modified:
trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/adminapi/Request.java
trunk/client/src/main/java/org/teiid/adminapi/Session.java
trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
trunk/client/src/main/java/org/teiid/client/security/LogonResult.java
trunk/client/src/main/java/org/teiid/client/security/SessionToken.java
trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java
trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
trunk/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java
trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java
trunk/engine/src/test/java/org/teiid/dqp/internal/cache/TestDQPContextCache.java
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
trunk/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java
trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Log:
TEIID-207 TEIID-1057 switching to a string based session id and fixing issues with the mapping of session and request metadata
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -146,7 +146,7 @@
@Doc(text = "Cancel a request")
public static void cancelRequest(
- @Doc(text = "session id") long sessionId,
+ @Doc(text = "session id") String sessionId,
@Doc(text = "request id") long requestId)
throws AdminException {
getAdmin().cancelRequest(sessionId, requestId);
@@ -246,7 +246,7 @@
@Doc(text = "Get all Request instances for the given session")
public static Collection<Request> getRequestsForSession(
- @Doc(text = "session id") long sessionId)
+ @Doc(text = "session id") String sessionId)
throws AdminException {
return getAdmin().getRequestsForSession(sessionId);
}
@@ -323,7 +323,7 @@
@Doc(text = "Terminate a session and associated requests")
public static void terminateSession(
- @Doc(text = "session id") long sessionId) throws AdminException {
+ @Doc(text = "session id") String sessionId) throws AdminException {
getAdmin().terminateSession(sessionId);
}
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -68,9 +68,9 @@
shortSb.append(")"); //$NON-NLS-1$
String shortHelpStr = String.format(" %-25s", shortSb.toString()); //$NON-NLS-1$
if (doc != null) {
- sb.append("/*\n *").append(doc.text()); //$NON-NLS-1$
+ sb.append("/*\n ").append(doc.text()); //$NON-NLS-1$
for (String string : doc.moreText()) {
- sb.append("\n *").append(string); //$NON-NLS-1$
+ sb.append("\n ").append(string); //$NON-NLS-1$
}
sb.append("\n */\n"); //$NON-NLS-1$
shortHelpStr += " -- " + doc.text(); //$NON-NLS-1$
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -244,7 +244,7 @@
* @return Collection of {@link Request}
* @throws AdminException
*/
- Collection<Request> getRequestsForSession(long sessionId) throws AdminException;
+ Collection<Request> getRequestsForSession(String sessionId) throws AdminException;
/**
@@ -307,7 +307,7 @@
* No wild cards currently supported, must be explicit
* @throws AdminException
*/
- void terminateSession(long sessionId) throws AdminException;
+ void terminateSession(String sessionId) throws AdminException;
/**
* Cancel Request
@@ -317,7 +317,7 @@
*
* @throws AdminException
*/
- void cancelRequest(long sessionId, long requestId) throws AdminException;
+ void cancelRequest(String sessionId, long requestId) throws AdminException;
/**
* Mark the given global transaction as rollback only.
Modified: trunk/client/src/main/java/org/teiid/adminapi/Request.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Request.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/Request.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -51,9 +51,9 @@
/**
* Get the SessionID for a Request
*
- * @return long SessionID
+ * @return String SessionID
*/
- public long getSessionId();
+ public String getSessionId();
/**
* Get the SQL Command sent to the Server for a Request
Modified: trunk/client/src/main/java/org/teiid/adminapi/Session.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Session.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/Session.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -52,7 +52,7 @@
*
* @return String of the Session ID
*/
- public long getSessionId();
+ public String getSessionId();
/**
* Get User Name for this Session
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -31,8 +31,8 @@
List<RequestMetadata> getRequestsForSession(long sessionId) ;
List<RequestMetadata> getRequests();
WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
- void terminateSession(long terminateeId);
- boolean cancelRequest(long sessionId, long requestId) throws AdminException;
+ void terminateSession(String terminateeId);
+ boolean cancelRequest(String sessionId, long requestId) throws AdminException;
Collection<String> getCacheTypes();
void clearCache(String cacheType);
Collection<SessionMetadata> getActiveSessions() throws AdminException;
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -37,7 +37,7 @@
private static final long serialVersionUID = -2779106368517784259L;
private long executionId;
- private long sessionId;
+ private String sessionId;
private String command;
private long startTime;
private boolean sourceRequest;
@@ -67,11 +67,11 @@
@Override
@ManagementProperty(description="Session ID", readOnly=true)
- public long getSessionId() {
+ public String getSessionId() {
return this.sessionId;
}
- public void setSessionId(long session) {
+ public void setSessionId(String session) {
this.sessionId = session;
}
@@ -111,7 +111,7 @@
return this.nodeID;
}
- public void setNodeId(int nodeID) {
+ public void setNodeId(Integer nodeID) {
this.nodeID = nodeID;
}
@@ -138,7 +138,7 @@
}
public int hashCode() {
- return HashCodeUtil.hashCode((int)executionId, (int)sessionId);
+ return HashCodeUtil.hashCode((int)executionId, sessionId);
}
@SuppressWarnings("nls")
@@ -146,7 +146,7 @@
StringBuilder str = new StringBuilder();
str.append("Request: sessionid=").append(sessionId);
str.append("; executionId=").append(executionId);
- if (nodeID != Integer.MIN_VALUE) {
+ if (nodeID != null) {
str.append("; nodeId=").append(nodeID);
}
if (transactionId != null) {
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -24,15 +24,18 @@
import java.lang.reflect.Type;
import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.EnumMetaType;
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.EnumValueSupport;
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;
+import org.teiid.adminapi.Request;
import org.teiid.adminapi.Request.State;
public class RequestMetadataMapper extends MetaMapper<RequestMetadata> {
@@ -40,8 +43,7 @@
private static final String NODE_ID = "nodeId"; //$NON-NLS-1$
private static final String SOURCE_REQUEST = "sourceRequest"; //$NON-NLS-1$
private static final String COMMAND = "command"; //$NON-NLS-1$
- private static final String PROCESSING_TIME = "startTime"; //$NON-NLS-1$
- private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String START_TIME = "startTime"; //$NON-NLS-1$
private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
private static final String EXECUTION_ID = "executionId"; //$NON-NLS-1$
private static final String STATE = "state"; //$NON-NLS-1$
@@ -51,14 +53,14 @@
static {
metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Request meta data"); //$NON-NLS-1$
metaType.addItem(EXECUTION_ID, EXECUTION_ID, SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem(PROCESSING_TIME, PROCESSING_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.STRING);
+ metaType.addItem(START_TIME, START_TIME, SimpleMetaType.LONG_PRIMITIVE);
metaType.addItem(COMMAND, COMMAND, SimpleMetaType.STRING);
metaType.addItem(SOURCE_REQUEST, SOURCE_REQUEST, SimpleMetaType.BOOLEAN_PRIMITIVE);
- metaType.addItem(NODE_ID, NODE_ID, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem(NODE_ID, NODE_ID, SimpleMetaType.INTEGER);
metaType.addItem(TRANSACTION_ID, TRANSACTION_ID, SimpleMetaType.STRING);
- metaType.addItem(STATE, STATE, SimpleMetaType.STRING);
+ EnumMetaType emt = new EnumMetaType(Request.State.values());
+ metaType.addItem(STATE, STATE, emt);
metaType.freeze();
}
@@ -82,12 +84,13 @@
request.set(EXECUTION_ID, SimpleValueSupport.wrap(object.getExecutionId()));
request.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
- request.set(PROCESSING_TIME, SimpleValueSupport.wrap(object.getStartTime()));
+ request.set(START_TIME, SimpleValueSupport.wrap(object.getStartTime()));
request.set(COMMAND, SimpleValueSupport.wrap(object.getCommand()));
request.set(SOURCE_REQUEST, SimpleValueSupport.wrap(object.sourceRequest()));
request.set(NODE_ID, SimpleValueSupport.wrap(object.getNodeId()));
request.set(TRANSACTION_ID,SimpleValueSupport.wrap(object.getTransactionId()));
- request.set(STATE,SimpleValueSupport.wrap(object.getState()));
+ EnumMetaType emt = (EnumMetaType)composite.getType(STATE);
+ request.set(STATE, new EnumValueSupport(emt, object.getState()));
return request;
}
throw new IllegalArgumentException("Cannot convert RequestMetadata " + object); //$NON-NLS-1$
@@ -103,8 +106,8 @@
RequestMetadata request = new RequestMetadata();
request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get(EXECUTION_ID)));
- request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
- request.setStartTime((Long) metaValueFactory.unwrap(compositeValue.get(PROCESSING_TIME)));
+ request.setSessionId((String) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ request.setStartTime((Long) metaValueFactory.unwrap(compositeValue.get(START_TIME)));
request.setCommand((String) metaValueFactory.unwrap(compositeValue.get(COMMAND)));
request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get(SOURCE_REQUEST)));
request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get(NODE_ID)));
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -48,7 +48,7 @@
private String userName;
private String vdbName;
private int vdbVersion;
- private long sessionId = -1; // invalid session
+ private String sessionId;
private String securityDomain;
//server session state
@@ -110,11 +110,11 @@
@Override
@ManagementProperty(description="Session ID", readOnly=true)
- public long getSessionId() {
+ public String getSessionId() {
return this.sessionId;
}
- public void setSessionId(long sessionId) {
+ public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -55,7 +55,7 @@
metaType.addItem(CLIENT_HOST_NAME, CLIENT_HOST_NAME, SimpleMetaType.STRING);
metaType.addItem(IP_ADDRESS, IP_ADDRESS, SimpleMetaType.STRING);
metaType.addItem(LAST_PING_TIME, LAST_PING_TIME, SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.STRING);
metaType.addItem(USER_NAME, USER_NAME, SimpleMetaType.STRING);
metaType.addItem(VDB_NAME, VDB_NAME, SimpleMetaType.STRING);
metaType.addItem(VDB_VERSION, VDB_VERSION, SimpleMetaType.INTEGER_PRIMITIVE);
@@ -111,7 +111,7 @@
session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_HOST_NAME)));
session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get(IP_ADDRESS)));
session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get(LAST_PING_TIME)));
- session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ session.setSessionId((String) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
session.setUserName((String) metaValueFactory.unwrap(compositeValue.get(USER_NAME)));
session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get(VDB_NAME)));
session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get(VDB_VERSION)));
Modified: trunk/client/src/main/java/org/teiid/client/security/LogonResult.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/security/LogonResult.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/client/security/LogonResult.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -60,7 +60,7 @@
* @return
* @since 4.3
*/
- public long getSessionID() {
+ public String getSessionID() {
return this.sessionToken.getSessionID();
}
Modified: trunk/client/src/main/java/org/teiid/client/security/SessionToken.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/security/SessionToken.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/client/security/SessionToken.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -26,8 +26,11 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import java.util.UUID;
+import java.security.SecureRandom;
+import java.util.Arrays;
+import com.metamatrix.core.util.Base64;
+
/**
* This class is an immutable identifier for a unique session that also
* maintains the name of the principal for that session.
@@ -36,49 +39,64 @@
* transit if sent to the client. Also it should only be sent to the client
* who creates the session.
*/
-public class SessionToken implements Externalizable, Cloneable {
+public class SessionToken implements Externalizable {
public final static long serialVersionUID = -2853708320435636107L;
+ private static final SecureRandom random = new SecureRandom();
+
/** The session ID */
- private long sessionID;
+ private String sessionID;
private String userName;
- private UUID secret;
-
- /**
- * Fake SessionToken representing a trusted user
- */
+ private byte[] secret = new byte[16];
+
public SessionToken() {
- this.sessionID = -1L;
- this.userName = "trusted"; //$NON-NLS-1$
- this.secret = new UUID(1,1);
}
/**
- * The primary constructor that specifies the id, userName, and product info
- * for the session represented by this token.
+ * Used by tests to control the session id
*
* @param id
- * (long) the unique identifier for the session
* @param userName
- * (String) the userName for this session
- * @throws IllegalArgumentException
- */
+ */
public SessionToken(long id, String userName) {
- this.sessionID = id;
+ this.sessionID = Long.toString(id);
this.userName = userName;
- this.secret = UUID.randomUUID();
}
- public UUID getSecret() {
- return secret;
+ /**
+ * The primary constructor that specifies userName
+ *
+ * @param userName
+ * (String) the userName for this session
+ */
+ public SessionToken(String userName) {
+ byte[] bytes = new byte[9]; //9 bytes fits evenly into base64 and should be sufficiently cluster unique
+ random.nextBytes(bytes);
+ this.sessionID = Base64.encodeBytes(bytes);
+ this.userName = userName;
+ random.nextBytes(secret);
}
-
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof SessionToken)) {
+ return false;
+ }
+ SessionToken other = (SessionToken)obj;
+ return userName.equals(other.userName)
+ && sessionID.equals(other.sessionID)
+ && Arrays.equals(secret, other.secret);
+ }
+
/**
* Returns unique session identifier
*
* @return the session ID
*/
- public long getSessionID() {
+ public String getSessionID() {
return this.sessionID;
}
@@ -92,76 +110,24 @@
}
/**
- * Returns true if the specified object is semantically equal to this
- * instance. Note: this method is consistent with <code>compareTo()</code>.
- * <p>
- *
- * @param obj
- * the object that this instance is to be compared to.
- * @return whether the object is equal to this object.
- */
- public boolean equals(Object obj) {
- // Check if instances are identical ...
- if (this == obj) {
- return true;
- }
-
- // Check if object can be compared to this one
- // (this includes checking for null ) ...
- if (!(obj instanceof SessionToken)) {
- return false;
- }
- SessionToken that = (SessionToken) obj;
- return (this.sessionID == that.sessionID)
- && this.userName.equals(that.userName)
- && this.secret.equals(that.secret);
- }
-
- /**
- * Overrides Object hashCode method.
- *
- * @return a hash code value for this object.
- * @see Object#hashCode()
- * @see Object#equals(Object)
- */
- public int hashCode() {
- return new Long(this.sessionID).hashCode();
- }
-
- /**
* Returns a string representing the current state of the object.
*/
public String toString() {
return "SessionToken[" + getUsername() + "," + this.sessionID + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- /**
- * Return a cloned instance of this object.
- *
- * @return the object that is the clone of this instance.
- */
- public Object clone() {
- try {
- // Everything is immutable, so bit-wise copy (of references) is okay
- // !
- return super.clone();
- } catch (CloneNotSupportedException e) {
- }
- return null;
- }
-
@Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- secret = (UUID)in.readObject();
- sessionID = in.readLong();
+ secret = (byte[])in.readObject();
+ sessionID = (String)in.readObject();
userName = (String)in.readObject();
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(secret);
- out.writeLong(sessionID);
+ out.writeObject(sessionID);
out.writeObject(userName);
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -215,7 +215,7 @@
* @throws SQLException
*/
public String getConnectionId() {
- return String.valueOf(this.serverConn.getLogonResult().getSessionID());
+ return this.serverConn.getLogonResult().getSessionID();
}
long currentRequestId() {
Added: trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java (rev 0)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -0,0 +1,45 @@
+/*
+ * 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 static org.junit.Assert.*;
+
+import org.jboss.metatype.api.values.MetaValue;
+import org.junit.Test;
+import org.teiid.adminapi.Request.State;
+
+public class TestRequestMetadata {
+
+ @Test public void testMapping() {
+ RequestMetadata request = new RequestMetadata();
+ request.setState(State.PROCESSING);
+
+ RequestMetadataMapper rmm = new RequestMetadataMapper();
+ MetaValue mv = rmm.createMetaValue(rmm.getMetaType(), request);
+
+ RequestMetadata request1 = rmm.unwrapMetaValue(mv);
+
+ assertEquals(request.getState(), request1.getState());
+ }
+
+}
Property changes on: trunk/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java (rev 0)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -0,0 +1,45 @@
+/*
+ * 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 static org.junit.Assert.*;
+
+import org.jboss.metatype.api.values.MetaValue;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class TestSessionMetadata {
+
+ @Test public void testMapping() {
+ SessionMetadata session = new SessionMetadata();
+ session.setSessionId("test");
+
+ SessionMetadataMapper smm = new SessionMetadataMapper();
+ MetaValue mv = smm.createMetaValue(smm.getMetaType(), session);
+
+ SessionMetadata session1 = smm.unwrapMetaValue(mv);
+
+ assertEquals(session.getSessionId(), session1.getSessionId());
+ }
+
+}
Property changes on: trunk/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java
===================================================================
--- trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -84,7 +84,7 @@
Properties connectionProperties)
throws LogonException,
MetaMatrixComponentException {
- return new LogonResult(new SessionToken(1, "fooUser"), "foo", 1, "fake"); //$NON-NLS-1$ //$NON-NLS-2$
+ return new LogonResult(new SessionToken(1, "fooUser"), "foo", 1, "fake"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
//## JDBC4.0-begin ##
@@ -148,7 +148,7 @@
public void testLogon() throws Exception {
SocketServerConnection connection = createConnection(null);
- assertEquals(1, connection.getLogonResult().getSessionID()); //$NON-NLS-1$
+ assertEquals(String.valueOf(1), connection.getLogonResult().getSessionID());
}
/**
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -87,7 +87,7 @@
public AtomicRequestMessage(RequestMessage requestMessage, DQPWorkContext parent, int nodeId){
this.executionPayload = requestMessage.getExecutionPayload();
this.workContext = parent;
- this.requestID = new RequestID(parent.getConnectionID(), requestMessage.getExecutionId());
+ this.requestID = new RequestID(parent.getSessionId(), requestMessage.getExecutionId());
this.atomicRequestId = new AtomicRequestID(this.requestID, nodeId, EXECUTION_COUNT.getAndIncrement());
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -78,7 +78,7 @@
* session
* @throws SessionServiceException
*/
- void closeSession(long sessionID) throws InvalidSessionException;
+ void closeSession(String sessionID) throws InvalidSessionException;
/**
* Terminates the specified session. This is an administrative action.
@@ -91,7 +91,7 @@
* does not have authority to terminate the <code>terminatedSessionID</code> session
* @throws SessionServiceException
*/
- boolean terminateSession(long terminatedSessionID, long adminSessionID);
+ boolean terminateSession(String terminatedSessionID, String adminSessionID);
/**
* Get the collection of active user sessions on the system.
@@ -115,7 +115,7 @@
* session
* @throws SessionServiceException
*/
- SessionMetadata validateSession(long sessionID)
+ SessionMetadata validateSession(String sessionID)
throws InvalidSessionException, SessionServiceException;
/**
@@ -133,9 +133,9 @@
*
* @param sessionID - identifies the client
*/
- public void pingServer(long sessionID) throws InvalidSessionException;
+ public void pingServer(String sessionID) throws InvalidSessionException;
- SessionMetadata getActiveSession(long sessionID);
+ SessionMetadata getActiveSession(String sessionID);
void setDqp(DQPCore dqp);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -260,10 +260,10 @@
CommandLogMessage message = null;
if (cmdStatus == Event.NEW) {
- message = new CommandLogMessage(System.currentTimeMillis(), qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName, qr.getWorkContext().getConnectionID(), principal, sqlStr, context);
+ message = new CommandLogMessage(System.currentTimeMillis(), qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName, qr.getWorkContext().getSessionId(), principal, sqlStr, context);
}
else {
- message = new CommandLogMessage(System.currentTimeMillis(), qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName, qr.getWorkContext().getConnectionID(), principal, finalRowCnt, cmdStatus, context);
+ message = new CommandLogMessage(System.currentTimeMillis(), qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName, qr.getWorkContext().getSessionId(), principal, finalRowCnt, cmdStatus, context);
}
LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -97,7 +97,7 @@
this.securityContext = new ExecutionContextImpl(requestMsg.getWorkContext().getVdbName(),
requestMsg.getWorkContext().getVdbVersion(),
requestMsg.getExecutionPayload(),
- requestMsg.getWorkContext().getConnectionID(),
+ requestMsg.getWorkContext().getSessionId(),
requestMsg.getConnectorName(),
requestMsg.getRequestID().toString(),
Integer.toString(requestID.getNodeID()),
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-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -244,7 +244,7 @@
RequestMetadata req = new RequestMetadata();
req.setExecutionId(holder.requestID.getExecutionID());
- req.setSessionId(Long.parseLong(holder.requestID.getConnectionID()));
+ req.setSessionId(holder.requestID.getConnectionID());
req.setCommand(holder.requestMsg.getCommandString());
req.setStartTime(holder.getProcessingTimestamp());
req.setState(holder.isCanceled()?State.CANCELED:holder.isDoneProcessing()?State.DONE:State.PROCESSING);
@@ -264,7 +264,7 @@
RequestMetadata info = new RequestMetadata();
info.setExecutionId(arm.getRequestID().getExecutionID());
- info.setSessionId(Long.parseLong(holder.requestID.getConnectionID()));
+ info.setSessionId(holder.requestID.getConnectionID());
info.setCommand(arm.getCommand().toString());
info.setStartTime(arm.getProcessingTimestamp());
info.setSourceRequest(true);
@@ -288,7 +288,7 @@
} else {
request = new Request();
}
- ClientState state = this.getClientState(workContext.getConnectionID(), true);
+ ClientState state = this.getClientState(workContext.getSessionId(), true);
request.initialize(requestMsg, bufferManager,
dataTierMgr, transactionService, processorDebugAllowed,
state.tempTableStoreImpl, workContext,
@@ -322,7 +322,7 @@
void removeRequest(final RequestWorkItem workItem) {
this.requests.remove(workItem.requestID);
- ClientState state = getClientState(workItem.getDqpWorkContext().getConnectionID(), false);
+ ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false);
if (state != null) {
state.removeRequest(workItem.requestID);
}
@@ -423,9 +423,7 @@
return processWorkerPool.getStats();
}
- public void terminateSession(long terminateeId) {
- String sessionId = String.valueOf(terminateeId);
-
+ public void terminateSession(String sessionId) {
// sometimes there will not be any atomic requests pending, in that
// situation we still need to clear the master request from our map
ClientState state = getClientState(sessionId, false);
@@ -447,8 +445,8 @@
contextCache.removeSessionScopedCache(sessionId);
}
- public boolean cancelRequest(long sessionId, long requestId) throws MetaMatrixComponentException {
- RequestID requestID = new RequestID(String.valueOf(sessionId), requestId);
+ public boolean cancelRequest(String sessionId, long requestId) throws MetaMatrixComponentException {
+ RequestID requestID = new RequestID(sessionId, requestId);
return cancelRequest(requestID);
}
@@ -551,7 +549,7 @@
RequestMessage msg = workItem.requestMsg;
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestID rID = new RequestID(workContext.getConnectionID(), msg.getExecutionId());
+ RequestID rID = new RequestID(workContext.getSessionId(), msg.getExecutionId());
String txnID = null;
TransactionContext tc = workItem.getTransactionContext();
if (tc != null && tc.getTransactionType() != Scope.NONE) {
@@ -561,9 +559,9 @@
// Log to request log
CommandLogMessage message = null;
if (status == Event.NEW) {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getConnectionID(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
} else {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getConnectionID(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status);
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status);
}
LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
}
@@ -658,14 +656,14 @@
// local txn
public ResultsFuture<?> begin() throws XATransactionException {
- String threadId = DQPWorkContext.getWorkContext().getConnectionID();
+ String threadId = DQPWorkContext.getWorkContext().getSessionId();
this.getTransactionService().begin(threadId);
return ResultsFuture.NULL_FUTURE;
}
// local txn
public ResultsFuture<?> commit() throws XATransactionException {
- final String threadId = DQPWorkContext.getWorkContext().getConnectionID();
+ final String threadId = DQPWorkContext.getWorkContext().getSessionId();
Callable<Void> processor = new Callable<Void>() {
@Override
public Void call() throws Exception {
@@ -678,7 +676,7 @@
// local txn
public ResultsFuture<?> rollback() throws XATransactionException {
- final String threadId = DQPWorkContext.getWorkContext().getConnectionID();
+ final String threadId = DQPWorkContext.getWorkContext().getSessionId();
Callable<Void> processor = new Callable<Void>() {
@Override
public Void call() throws Exception {
@@ -695,7 +693,7 @@
@Override
public Void call() throws Exception {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().commit(workContext.getConnectionID(), xid, onePhase, workContext.getSession().isEmbedded());
+ getTransactionService().commit(workContext.getSessionId(), xid, onePhase, workContext.getSession().isEmbedded());
return null;
}
};
@@ -704,13 +702,13 @@
// global txn
public ResultsFuture<?> end(XidImpl xid, int flags) throws XATransactionException {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- this.getTransactionService().end(workContext.getConnectionID(), xid, flags, workContext.getSession().isEmbedded());
+ this.getTransactionService().end(workContext.getSessionId(), xid, flags, workContext.getSession().isEmbedded());
return ResultsFuture.NULL_FUTURE;
}
// global txn
public ResultsFuture<?> forget(XidImpl xid) throws XATransactionException {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- this.getTransactionService().forget(workContext.getConnectionID(), xid, workContext.getSession().isEmbedded());
+ this.getTransactionService().forget(workContext.getSessionId(), xid, workContext.getSession().isEmbedded());
return ResultsFuture.NULL_FUTURE;
}
@@ -720,7 +718,7 @@
@Override
public Integer call() throws Exception {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- return getTransactionService().prepare(workContext.getConnectionID(),xid, workContext.getSession().isEmbedded());
+ return getTransactionService().prepare(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
}
};
return addWork(processor);
@@ -749,7 +747,7 @@
@Override
public Void call() throws Exception {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().rollback(workContext.getConnectionID(),xid, workContext.getSession().isEmbedded());
+ getTransactionService().rollback(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
return null;
}
};
@@ -762,7 +760,7 @@
@Override
public Void call() throws Exception {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().start(workContext.getConnectionID(), xid, flags, timeout, workContext.getSession().isEmbedded());
+ getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, workContext.getSession().isEmbedded());
return null;
}
};
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -114,11 +114,7 @@
return session.getVDBVersion();
}
- public String getConnectionID() {
- return String.valueOf(getSessionId());
- }
-
- public long getSessionId() {
+ public String getSessionId() {
return this.session.getSessionId();
}
@@ -127,7 +123,7 @@
}
public RequestID getRequestID(long exeuctionId) {
- return new RequestID(this.getConnectionID(), exeuctionId);
+ return new RequestID(this.getSessionId(), exeuctionId);
}
public SessionToken getSessionToken() {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -119,7 +119,7 @@
TempTableStore tempTableStore = null;
if(requestManager != null) {
if (workItem != null) {
- ClientState state = requestManager.getClientState(workContext.getConnectionID(), false);
+ ClientState state = requestManager.getClientState(workContext.getSessionId(), false);
if (state != null) {
tempTableStore = state.tempTableStoreImpl;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -224,12 +224,12 @@
// Create command context, used in rewriting, planning, and processing
// Identifies a "group" of requests on a per-connection basis to allow later
// cleanup of all resources in the group on connection shutdown
- String groupName = workContext.getConnectionID();
+ String groupName = workContext.getSessionId();
RequestID reqID = workContext.getRequestID(this.requestMsg.getExecutionId());
Properties props = new Properties();
- props.setProperty(ContextProperties.SESSION_ID, workContext.getConnectionID());
+ props.setProperty(ContextProperties.SESSION_ID, workContext.getSessionId());
this.context =
new CommandContext(
@@ -336,7 +336,7 @@
private void createProcessor() throws MetaMatrixComponentException {
- TransactionContext tc = transactionService.getOrCreateTransactionContext(workContext.getConnectionID());
+ TransactionContext tc = transactionService.getOrCreateTransactionContext(workContext.getSessionId());
Assertion.assertTrue(tc.getTransactionType() != TransactionContext.Scope.REQUEST, "Transaction already associated with request."); //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -105,7 +105,7 @@
this.sql = sql;
this.vdbInfo = new VDBKey(context.getVdbName(), context.getVdbVersion());
this.pi = pi;
- this.originalSessionId = context.getConnectionID();
+ this.originalSessionId = context.getSessionId();
}
private void setSessionId(String sessionId) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -290,7 +290,7 @@
// is not authorized in the exception message
handleValidationError(
- DQPPlugin.Util.getString("ERR.018.005.0095", new Object[]{DQPWorkContext.getWorkContext().getConnectionID(), getActionLabel(actionCode)}), //$NON-NLS-1$
+ DQPPlugin.Util.getString("ERR.018.005.0095", new Object[]{DQPWorkContext.getWorkContext().getSessionId(), getActionLabel(actionCode)}), //$NON-NLS-1$
inaccessibleSymbols);
}
}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -43,7 +43,7 @@
public static AtomicRequestMessage example() {
RequestMessage rm = new RequestMessage();
DQPWorkContext workContext = new DQPWorkContext();
- workContext.getSession().setSessionId(2);
+ workContext.getSession().setSessionId(String.valueOf(2));
AtomicRequestMessage message = new AtomicRequestMessage(rm, workContext, 1000);
message.setCommand(TestQueryImpl.helpExample(true));
message.setFetchSize(100);
@@ -64,7 +64,7 @@
assertEquals(example.getProcessingTimestamp(), copy.getProcessingTimestamp());
assertEquals(new RequestID(5000L), copy.getRequestID());
- assertEquals("2", copy.getWorkContext().getConnectionID()); //$NON-NLS-1$
+ assertEquals("2", copy.getWorkContext().getSessionId()); //$NON-NLS-1$
//AtomicRequestMessage-specific stuff
assertEquals("connectorBindingID", copy.getConnectorName()); //$NON-NLS-1$
assertEquals(1000, copy.getAtomicRequestID().getNodeID());
Modified: trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/com/metamatrix/query/unittest/FakeMetadataFactory.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -87,7 +87,7 @@
workContext.setSession(session);
session.setVDBName(vdb.getName());
session.setVDBVersion(vdb.getVersion());
- session.setSessionId(1);
+ session.setSessionId(String.valueOf(1));
session.setUserName("foo"); //$NON-NLS-1$
session.setVdb(vdb);
workContext.getVDB().addAttchment(QueryMetadataInterface.class, metadata);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/cache/TestDQPContextCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/cache/TestDQPContextCache.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/cache/TestDQPContextCache.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -44,7 +44,7 @@
DQPWorkContext workContext = new DQPWorkContext();
workContext.getSession().setVDBName("MyVDB"); //$NON-NLS-1$
workContext.getSession().setVDBVersion(1);
- workContext.getSession().setSessionId(1);
+ workContext.getSession().setSessionId(String.valueOf(1));
workContext.getSession().setUserName("foo"); //$NON-NLS-1$
return workContext;
}
@@ -55,17 +55,17 @@
Cache cache = this.cacheContext.getRequestScopedCache(context.getRequestID(12L).toString());
cache.put("key", "request-value"); //$NON-NLS-1$ //$NON-NLS-2$
- cache = this.cacheContext.getSessionScopedCache(context.getConnectionID());
+ cache = this.cacheContext.getSessionScopedCache(context.getSessionId());
cache.put("key", "session-value"); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("request-value", this.cacheContext.getRequestScopedCache(context.getRequestID(12L).toString()).get("key")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("session-value", this.cacheContext.getSessionScopedCache(context.getConnectionID()).get("key")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("session-value", this.cacheContext.getSessionScopedCache(context.getSessionId()).get("key")); //$NON-NLS-1$ //$NON-NLS-2$
// close the request
this.cacheContext.removeRequestScopedCache(context.getRequestID(12L).toString());
assertNull(this.cacheContext.getRequestScopedCache(context.getRequestID(12L).toString()).get("key")); //$NON-NLS-1$
- assertEquals("session-value", this.cacheContext.getSessionScopedCache(context.getConnectionID()).get("key")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("session-value", this.cacheContext.getSessionScopedCache(context.getSessionId()).get("key")); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -67,7 +67,7 @@
RequestMessage rm = new RequestMessage();
DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(EXAMPLE_BQT, FakeMetadataFactory.exampleBQTVDB());
- workContext.getSession().setSessionId(1);
+ workContext.getSession().setSessionId(String.valueOf(1));
workContext.getSession().setUserName("foo"); //$NON-NLS-1$
AtomicRequestMessage request = new AtomicRequestMessage(rm, workContext, nodeid);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -206,7 +206,7 @@
private ResultsMessage helpExecute(String sql, String userName, int sessionid, boolean txnAutoWrap) throws Exception {
RequestMessage reqMsg = exampleRequestMessage(sql);
- DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
+ DQPWorkContext.getWorkContext().getSession().setSessionId(String.valueOf(sessionid));
DQPWorkContext.getWorkContext().getSession().setUserName(userName);
if (txnAutoWrap) {
reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_ON);
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-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -141,7 +141,7 @@
if (workContext == null) {
workContext = new DQPWorkContext();
- workContext.getSession().setSessionId(Long.valueOf(id.getConnectionID()));
+ workContext.getSession().setSessionId(id.getConnectionID());
workContext.getSession().setUserName("foo"); //$NON-NLS-1$
}
RequestWorkItem workItem = new RequestWorkItem(rm, requestMsg, null, null, id, workContext);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -42,7 +42,7 @@
message.getSession().setVDBName("vdbName"); //$NON-NLS-1$
message.getSession().setVDBVersion(1);
message.getSession().setApplicationName("querybuilder"); //$NON-NLS-1$
- message.getSession().setSessionId(5);
+ message.getSession().setSessionId(String.valueOf(5));
message.getSession().setUserName("userName"); //$NON-NLS-1$
return message;
}
@@ -50,7 +50,7 @@
public void testSerialize() throws Exception {
DQPWorkContext copy = UnitTestUtil.helpSerialize(example());
- assertEquals("5", copy.getConnectionID()); //$NON-NLS-1$
+ assertEquals("5", copy.getSessionId()); //$NON-NLS-1$
assertEquals("userName", copy.getUserName()); //$NON-NLS-1$
assertEquals("vdbName", copy.getVdbName()); //$NON-NLS-1$
assertEquals(1, copy.getVdbVersion());
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -244,7 +244,7 @@
}
DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, vdb);
- workContext.getSession().setSessionId(conn);
+ workContext.getSession().setSessionId(String.valueOf(conn));
PreparedStatementRequest serverRequest = new PreparedStatementRequest(prepPlanCache);
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -96,7 +96,7 @@
import com.metamatrix.core.util.ObjectConverterUtil;
public class Admin extends TeiidAdmin {
- private static final String CONNECTOR_PREFIX = "connector-";
+ private static final String CONNECTOR_PREFIX = "connector-"; //$NON-NLS-1$
private static final String RAR = ".rar"; //$NON-NLS-1$
private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
private static final String XA_DATA_SOURCE_TEMPLATE = "XADataSourceTemplate"; //$NON-NLS-1$
@@ -105,11 +105,11 @@
private static ComponentType VDBTYPE = new ComponentType("teiid", "vdb");//$NON-NLS-1$ //$NON-NLS-2$
private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp");//$NON-NLS-1$ //$NON-NLS-2$
private static String DQPNAME = RuntimeEngineDeployer.class.getName();
- private static ExtendedComponentType NOTXTYPE = new ExtendedComponentType("ConnectionFactory", "NoTx", "no-tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$
- private static ExtendedComponentType TXTYPE = new ExtendedComponentType("ConnectionFactory", "Tx", "tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$
- private static ExtendedComponentType DS_LOCAL_TX = new ExtendedComponentType("DataSource", "LocalTx", "local-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$
- private static ExtendedComponentType DS_XA_TX = new ExtendedComponentType("DataSource", "XA", "xa-datasource");//$NON-NLS-1$ //$NON-NLS-2$
- private static ExtendedComponentType DS_NO_TX = new ExtendedComponentType("DataSource", "NoTx", "no-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ExtendedComponentType NOTXTYPE = new ExtendedComponentType("ConnectionFactory", "NoTx", "no-tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static ExtendedComponentType TXTYPE = new ExtendedComponentType("ConnectionFactory", "Tx", "tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static ExtendedComponentType DS_LOCAL_TX = new ExtendedComponentType("DataSource", "LocalTx", "local-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static ExtendedComponentType DS_XA_TX = new ExtendedComponentType("DataSource", "XA", "xa-datasource");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static ExtendedComponentType DS_NO_TX = new ExtendedComponentType("DataSource", "NoTx", "no-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private static ExtendedComponentType[] DS_TYPES = new ExtendedComponentType[] {DS_XA_TX, DS_LOCAL_TX, DS_NO_TX};
private static ExtendedComponentType[] CF_TYPES = new ExtendedComponentType[] {NOTXTYPE, TXTYPE};
@@ -204,9 +204,9 @@
private Reader exportJCAConnection(String deployedName, ManagedComponent mc, ExtendedComponentType type) throws AdminException {
try {
- DeploymentTemplateInfo info = getView().getTemplate("export-template");
+ DeploymentTemplateInfo info = getView().getTemplate("export-template"); //$NON-NLS-1$
if(info == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", "export-template")); //$NON-NLS-1$
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", "export-template")); //$NON-NLS-1$ //$NON-NLS-2$
}
for (ManagedProperty infoProperty:info.getProperties().values()) {
@@ -218,10 +218,10 @@
}
}
- ManagedProperty dsType = info.getProperties().get("dsType");
+ ManagedProperty dsType = info.getProperties().get("dsType"); //$NON-NLS-1$
dsType.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, type.getDsType()));
- File dsXml = File.createTempFile(deployedName, "-ds.xml");
+ File dsXml = File.createTempFile(deployedName, "-ds.xml"); //$NON-NLS-1$
ExportConnectorTypeTemplateInfo.writeTemplate(dsXml, info);
Reader r = new StringReader(ObjectConverterUtil.convertFileToString(dsXml));
dsXml.delete();
@@ -582,20 +582,20 @@
permission.setResourceName(ManagedUtil.getSimpleValue(mo, "resourceName", String.class));//$NON-NLS-1$
- if (ManagedUtil.getSimpleValue(mo, "allowCreate", Boolean.class) != null) {
- permission.setAllowCreate(ManagedUtil.getSimpleValue(mo, "allowCreate", Boolean.class));
+ if (ManagedUtil.getSimpleValue(mo, "allowCreate", Boolean.class) != null) { //$NON-NLS-1$
+ permission.setAllowCreate(ManagedUtil.getSimpleValue(mo, "allowCreate", Boolean.class)); //$NON-NLS-1$
}
- if (ManagedUtil.getSimpleValue(mo, "allowRead", Boolean.class) != null) {
- permission.setAllowRead(ManagedUtil.getSimpleValue(mo, "allowRead", Boolean.class));
+ if (ManagedUtil.getSimpleValue(mo, "allowRead", Boolean.class) != null) { //$NON-NLS-1$
+ permission.setAllowRead(ManagedUtil.getSimpleValue(mo, "allowRead", Boolean.class)); //$NON-NLS-1$
}
- if (ManagedUtil.getSimpleValue(mo, "allowUpdate", Boolean.class) != null) {
- permission.setAllowUpdate(ManagedUtil.getSimpleValue(mo, "allowUpdate", Boolean.class));
+ if (ManagedUtil.getSimpleValue(mo, "allowUpdate", Boolean.class) != null) { //$NON-NLS-1$
+ permission.setAllowUpdate(ManagedUtil.getSimpleValue(mo, "allowUpdate", Boolean.class)); //$NON-NLS-1$
}
- if (ManagedUtil.getSimpleValue(mo, "allowDelete", Boolean.class) != null) {
- permission.setAllowDelete(ManagedUtil.getSimpleValue(mo, "allowDelete", Boolean.class));
+ if (ManagedUtil.getSimpleValue(mo, "allowDelete", Boolean.class) != null) { //$NON-NLS-1$
+ permission.setAllowDelete(ManagedUtil.getSimpleValue(mo, "allowDelete", Boolean.class)); //$NON-NLS-1$
}
policy.addPermission(permission);
@@ -657,7 +657,7 @@
}
@Override
- public void terminateSession(long sessionId) throws AdminException {
+ public void terminateSession(String sessionId) throws AdminException {
try {
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
ManagedUtil.executeOperation(mc, "terminateSession", SimpleValueSupport.wrap(sessionId));//$NON-NLS-1$
@@ -683,7 +683,7 @@
}
@Override
- public Collection<Request> getRequestsForSession(long sessionId) throws AdminException {
+ public Collection<Request> getRequestsForSession(String sessionId) throws AdminException {
try {
Collection<Request> requestList = new ArrayList<Request>();
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
@@ -699,7 +699,7 @@
}
@Override
- public void cancelRequest(long sessionId, long requestId) throws AdminException{
+ public void cancelRequest(String sessionId, long requestId) throws AdminException{
try {
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
ManagedUtil.executeOperation(mc, "cancelRequest", SimpleValueSupport.wrap(sessionId), SimpleValueSupport.wrap(requestId));//$NON-NLS-1$
@@ -724,7 +724,7 @@
@Override
public void addConnector(String connectorName, InputStream contents) throws AdminException{
- if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {//$NON-NLS-1$
+ if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {
throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name")); //$NON-NLS-1$
}
@@ -748,13 +748,13 @@
@Override
public void deleteConnector(String connectorName) throws AdminException {
- if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {//$NON-NLS-1$
+ if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {
throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name")); //$NON-NLS-1$
}
String deployerName = getRarDeployerName(connectorName);
if (deployerName == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found", connectorName));
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found", connectorName)); //$NON-NLS-1$
}
//also need to delete template for the properties
@@ -765,13 +765,13 @@
@Override
public InputStream exportConnector(String connectorName) throws AdminException {
- if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {//$NON-NLS-1$
+ if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {
throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name")); //$NON-NLS-1$
}
String deployerName = getRarDeployerName(connectorName);
if (deployerName == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found", connectorName));
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found", connectorName)); //$NON-NLS-1$
}
return exportDeployment(deployerName);
}
@@ -1109,7 +1109,7 @@
}
}
else {
- roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING));
+ roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING)); //$NON-NLS-1$
mappedRoleNames.setValue(roleCollection);
}
@@ -1141,11 +1141,11 @@
public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException {
try {
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "mergeVDBs",
+ ManagedUtil.executeOperation(mc, "mergeVDBs", //$NON-NLS-1$
SimpleValueSupport.wrap(sourceVDBName),
SimpleValueSupport.wrap(sourceVDBVersion),
SimpleValueSupport.wrap(targetVDBName),
- SimpleValueSupport.wrap(targetVDBVersion));//$NON-NLS-1$
+ SimpleValueSupport.wrap(targetVDBVersion));
} catch (Exception e) {
throw new AdminComponentException(e.getMessage(), e);
}
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-04-22 17:22:34 UTC (rev 2072)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -261,13 +261,13 @@
@Override
@ManagementOperation(description="Terminate a Session",params={@ManagementParameter(name="terminateeId",description="The session to be terminated")})
- public void terminateSession(long terminateeId) {
+ public void terminateSession(String terminateeId) {
this.sessionService.terminateSession(terminateeId, DQPWorkContext.getWorkContext().getSessionId());
}
@Override
@ManagementOperation(description="Cancel a Request",params={@ManagementParameter(name="sessionId",description="The session Identifier"), @ManagementParameter(name="requestId",description="The request Identifier")})
- public boolean cancelRequest(long sessionId, long requestId) throws AdminException {
+ public boolean cancelRequest(String sessionId, long requestId) throws AdminException {
try {
return this.dqpCore.cancelRequest(sessionId, requestId);
} catch (MetaMatrixComponentException e) {
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -32,7 +32,6 @@
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
@@ -48,8 +47,8 @@
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.net.TeiidURL;
import org.teiid.net.ServerConnection;
+import org.teiid.net.TeiidURL;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.security.Credentials;
import org.teiid.security.SecurityHelper;
@@ -81,9 +80,8 @@
private DQPCore dqp;
- private Map<Long, SessionMetadata> sessionCache = new ConcurrentHashMap<Long, SessionMetadata>();
+ private Map<String, SessionMetadata> sessionCache = new ConcurrentHashMap<String, SessionMetadata>();
private Timer sessionMonitor = new Timer("SessionMonitor", true); //$NON-NLS-1$
- private AtomicLong idSequence = new AtomicLong();
private LinkedList<String> securityDomains = new LinkedList<String>();
private LinkedList<String> adminSecurityDomains = new LinkedList<String>();
@@ -110,7 +108,7 @@
}
@Override
- public void closeSession(long sessionID) throws InvalidSessionException {
+ public void closeSession(String sessionID) throws InvalidSessionException {
LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"closeSession", sessionID}); //$NON-NLS-1$
SessionMetadata info = this.sessionCache.remove(sessionID);
if (info == null) {
@@ -183,9 +181,9 @@
long creationTime = System.currentTimeMillis();
// Return a new session info object
- long id = idSequence.getAndIncrement();
SessionMetadata newSession = new SessionMetadata();
- newSession.setSessionId(id);
+ newSession.setSessionToken(new SessionToken(userName));
+ newSession.setSessionId(newSession.getSessionToken().getSessionID());
newSession.setUserName(userName);
newSession.setCreatedTime(creationTime);
newSession.setApplicationName(applicationName);
@@ -201,8 +199,7 @@
newSession.setLoginContext(loginContext);
newSession.setSecurityContext(securityContext);
newSession.setVdb(vdb);
- newSession.setSessionToken(new SessionToken(id, userName));
- LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", userName, "\" - created SessionID \"", "" + id, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", userName, "\" - created SessionID \"", "" + newSession.getSessionToken().getSessionID(), "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
this.sessionCache.put(newSession.getSessionId(), newSession);
return newSession;
}
@@ -220,7 +217,7 @@
}
@Override
- public SessionMetadata getActiveSession(long sessionID) {
+ public SessionMetadata getActiveSession(String sessionID) {
return this.sessionCache.get(sessionID);
}
@@ -245,14 +242,14 @@
}
@Override
- public void pingServer(long sessionID) throws InvalidSessionException {
+ public void pingServer(String sessionID) throws InvalidSessionException {
SessionMetadata info = getSessionInfo(sessionID);
info.setLastPingTime(System.currentTimeMillis());
this.sessionCache.put(sessionID, info);
}
@Override
- public boolean terminateSession(long terminatedSessionID, long adminSessionID) {
+ public boolean terminateSession(String terminatedSessionID, String adminSessionID) {
Object[] params = {adminSessionID, terminatedSessionID};
LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
try {
@@ -265,12 +262,12 @@
}
@Override
- public SessionMetadata validateSession(long sessionID) throws InvalidSessionException, SessionServiceException {
+ public SessionMetadata validateSession(String sessionID) throws InvalidSessionException, SessionServiceException {
SessionMetadata info = getSessionInfo(sessionID);
return info;
}
- private SessionMetadata getSessionInfo(long sessionID)
+ private SessionMetadata getSessionInfo(String sessionID)
throws InvalidSessionException {
SessionMetadata info = this.sessionCache.get(sessionID);
if (info == null) {
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -83,8 +83,8 @@
}
}
- private long updateDQPContext(SessionMetadata s) {
- long sessionID = s.getSessionId();
+ private String updateDQPContext(SessionMetadata s) {
+ String sessionID = s.getSessionId();
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
workContext.setSession(s);
@@ -93,15 +93,15 @@
public ResultsFuture<?> logoff() throws InvalidSessionException {
this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
- DQPWorkContext.getWorkContext().getSession().setSessionId(-1);
+ DQPWorkContext.getWorkContext().getSession().setSessionId(null);
return ResultsFuture.NULL_FUTURE;
}
public ResultsFuture<?> ping() throws InvalidSessionException,MetaMatrixComponentException {
// ping is double used to alert the aliveness of the client, as well as check the server instance is
// alive by socket server instance, so that they can be cached.
- long id = DQPWorkContext.getWorkContext().getSessionId();
- if (id != -1) {
+ String id = DQPWorkContext.getWorkContext().getSessionId();
+ if (id != null) {
this.service.pingServer(id);
}
LogManager.logTrace(LogConstants.CTX_SECURITY, "Ping", id); //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -139,7 +139,7 @@
} else if (e instanceof AdminProcessingException) {
logProcessingException(e, context);
} else {
- LogManager.logError(context, e, RuntimePlugin.Util.getString("ServerWorkItem.Received_exception_processing_request", this.socketClientInstance.getWorkContext().getConnectionID())); //$NON-NLS-1$
+ LogManager.logError(context, e, RuntimePlugin.Util.getString("ServerWorkItem.Received_exception_processing_request", this.socketClientInstance.getWorkContext().getSessionId())); //$NON-NLS-1$
}
return new ExceptionHolder(e);
@@ -151,7 +151,7 @@
cause = cause.getCause();
}
StackTraceElement elem = cause.getStackTrace()[0];
- LogManager.logDetail(context, e, "Processing exception for session", this.socketClientInstance.getWorkContext().getConnectionID()); //$NON-NLS-1$
- LogManager.logWarning(context, RuntimePlugin.Util.getString("ServerWorkItem.processing_error", e.getMessage(), this.socketClientInstance.getWorkContext().getConnectionID(), e.getClass().getName(), elem)); //$NON-NLS-1$
+ LogManager.logDetail(context, e, "Processing exception for session", this.socketClientInstance.getWorkContext().getSessionId()); //$NON-NLS-1$
+ LogManager.logWarning(context, RuntimePlugin.Util.getString("ServerWorkItem.processing_error", e.getMessage(), this.socketClientInstance.getWorkContext().getSessionId(), e.getClass().getName(), elem)); //$NON-NLS-1$
}
}
\ No newline at end of file
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -110,7 +110,7 @@
@Override
public void disconnected() {
- if (workContext.getSessionId() != -1) {
+ if (workContext.getSessionId() != null) {
workContext.runInContext(new Runnable() {
@Override
public void run() {
Modified: trunk/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -18,7 +18,7 @@
import org.teiid.services.TeiidLoginContext;
import org.teiid.services.SessionServiceImpl;
-
+@SuppressWarnings("nls")
public class TestSessionServiceImpl {
public void validateSession(boolean securityEnabled) throws Exception {
@@ -40,7 +40,7 @@
ssi.setSecurityDomains("somedomain");
try {
- ssi.validateSession(1);
+ ssi.validateSession(String.valueOf(1));
fail("exception expected"); //$NON-NLS-1$
} catch (InvalidSessionException e) {
@@ -48,14 +48,14 @@
SessionMetadata info = ssi.createSession("steve", null, "foo", new Properties(), false); //$NON-NLS-1$ //$NON-NLS-2$
if (securityEnabled) {
- Mockito.verify(impl).authenticateUser("steve", null, "foo", domains);
+ Mockito.verify(impl).authenticateUser("steve", null, "foo", domains);
}
- long id1 = info.getSessionId();
+ String id1 = info.getSessionId();
ssi.validateSession(id1);
assertEquals(1, ssi.getActiveSessionsCount());
- assertEquals(0, ssi.getSessionsLoggedInToVDB("a", 1).size()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(0, ssi.getSessionsLoggedInToVDB("a", 1).size()); //$NON-NLS-1$
ssi.closeSession(id1);
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -50,7 +50,7 @@
SessionMetadata session = new SessionMetadata();
session.setUserName(userName);
session.setApplicationName(applicationName);
- session.setSessionId(1);
+ session.setSessionId(String.valueOf(1));
session.setSessionToken(new SessionToken(1, userName));
Mockito.stub(ssi.createSession(userName, null, applicationName,p, false)).toReturn(session);
@@ -59,7 +59,7 @@
LogonResult result = impl.logon(p);
assertEquals(userName, result.getUserName());
- assertEquals(1, result.getSessionID());
+ assertEquals(String.valueOf(1), result.getSessionID());
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-04-22 17:22:34 UTC (rev 2072)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-04-22 18:55:02 UTC (rev 2073)
@@ -178,7 +178,7 @@
t.join();
}
- long sessionId = 0;
+ String sessionId = null;
Collection<Session> sessions = admin.getSessions();
for (Session s:sessions) {
sessionId = s.getSessionId();
14 years, 8 months
teiid SVN: r2072 - in trunk/console/src/main: java/org/teiid/rhq/plugin and 2 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-04-22 13:22:34 -0400 (Thu, 22 Apr 2010)
New Revision: 2072
Modified:
trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
Added getTransactions() and terminateTransaction(xid) operations on the Platform resource
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-04-21 19:07:27 UTC (rev 2071)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-04-22 17:22:34 UTC (rev 2072)
@@ -32,6 +32,7 @@
import org.rhq.core.domain.configuration.PropertySimple;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
+import org.teiid.adminapi.Transaction;
import org.teiid.rhq.comm.ExecutedResult;
import org.teiid.rhq.plugin.util.PluginConstants;
import org.teiid.rhq.plugin.util.ProfileServiceUtil;
@@ -144,7 +145,9 @@
final String operationName, final Map<String, Object> valueMap) {
Collection<Request> resultObject = new ArrayList<Request>();
Collection<Session> activeSessionsCollection = new ArrayList<Session>();
+ Collection<Transaction> transactionsCollection = new ArrayList<Transaction>();
+
if (operationName.equals(Platform.Operations.GET_LONGRUNNINGQUERIES)) {
Integer longRunningValue = (Integer) valueMap
.get(Operation.Value.LONG_RUNNING_QUERY_LIMIT);
@@ -165,6 +168,23 @@
getRequestCollectionValue(requestMetaValue, resultObject);
operationResult.setContent(createReportResultList(fieldNameList,
resultObject.iterator()));
+ } else if (operationName.equals(Platform.Operations.GET_TRANSACTIONS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue transactionMetaValue = getTransactions();
+ getTransactionCollectionValue(transactionMetaValue, transactionsCollection);
+ operationResult.setContent(createReportResultList(fieldNameList,
+ resultObject.iterator()));
+ } else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
+ Long sessionID = (Long) valueMap.get(Operation.Value.TRANSACTION_ID);
+ MetaValue[] args = new MetaValue[] { metaValueFactory
+ .create(sessionID) };
+ try {
+ executeManagedOperation(mc, Platform.Operations.KILL_TRANSACTION,
+ args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.KILL_TRANSACTION; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
} else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] { metaValueFactory
@@ -257,6 +277,24 @@
}
+ protected MetaValue getTransactions() {
+
+ MetaValue transactionsCollection = null;
+ MetaValue args = null;
+
+ try {
+ transactionsCollection = executeManagedOperation(mc,
+ Platform.Operations.GET_TRANSACTIONS, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_TRANSACTIONS; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return transactionsCollection;
+
+ }
+
+
public MetaValue getSessions() {
MetaValue sessionCollection = null;
@@ -468,7 +506,26 @@
}
}
}
+
+ public static <T> void getTransactionCollectionValue(MetaValue pValue,
+ Collection<Transaction> list) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Transaction transaction = (Transaction) MetaValueFactory.getInstance()
+ .unwrap(value);
+ list.add(transaction);
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type");
+ }
+ }
+ }
+ }
+
public static <T> void getSessionCollectionValue(MetaValue pValue,
Collection<Session> list) {
MetaType metaType = pValue.getMetaType();
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-04-21 19:07:27 UTC (rev 2071)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-04-22 17:22:34 UTC (rev 2072)
@@ -29,16 +29,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.api.RunState;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.teiid.rhq.admin.DQPManagementView;
import org.teiid.rhq.plugin.util.PluginConstants;
import org.teiid.rhq.plugin.util.ProfileServiceUtil;
@@ -61,7 +57,7 @@
@Override
public AvailabilityType getAvailability() {
-
+
RunState runState;
try {
runState = ProfileServiceUtil.getDQPManagementView().getRunState();
@@ -76,9 +72,9 @@
+ PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE);
return AvailabilityType.DOWN;
}
- return (runState == RunState.RUNNING) ? AvailabilityType.UP :
- AvailabilityType.DOWN;
-
+ return (runState == RunState.RUNNING) ? AvailabilityType.UP
+ : AvailabilityType.DOWN;
+
}
@Override
@@ -96,10 +92,13 @@
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());
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
Operation.Value.SESSION_ID).getLongValue());
- }
+ }
}
@@ -111,60 +110,67 @@
Map<String, Object> valueMap = new HashMap<String, Object>();
- for (MeasurementScheduleRequest request : requests) {
- String name = request.getName();
- LOG.debug("Measurement name = " + name); //$NON-NLS-1$
+ try {
+ for (MeasurementScheduleRequest request : requests) {
+ String name = request.getName();
+ LOG.debug("Measurement name = " + name); //$NON-NLS-1$
- // Initialize any parameters to be used in the retrieval of metric
- // values
- if (request
- .getName()
- .equals(
- PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- Integer value = getResourceConfiguration()
- .getSimple(
- PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT)
- .getIntegerValue();
- valueMap
- .put(
- PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT,
- value);
- }
-
- Object metricReturnObject = view.getMetric(getComponentType(), this
- .getComponentIdentifier(), name, valueMap);
-
- try {
+ // Initialize any parameters to be used in the retrieval of
+ // metric
+ // values
if (request
.getName()
.equals(
- PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
- } else {
+ PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
+ Integer value = getResourceConfiguration()
+ .getSimple(
+ PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT)
+ .getIntegerValue();
+ valueMap
+ .put(
+ PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT,
+ value);
+ }
+
+ Object metricReturnObject = view.getMetric(getComponentType(),
+ this.getComponentIdentifier(), name, valueMap);
+
+ try {
if (request
.getName()
.equals(
- PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+ PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
report.addData(new MeasurementDataNumeric(request,
(Double) metricReturnObject));
} else {
if (request
.getName()
.equals(
- PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
+ 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));
+ }
+
}
+ }
- }
+ } catch (Exception e) {
+ LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
+ + "]. Cause: " + e); //$NON-NLS-1$
+ throw (e);
}
-
- } catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- throw(e);
}
+ } catch (Exception e) {
+ LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
+ + "]. Cause: " + e); //$NON-NLS-1$
+ throw (e);
}
}
@@ -175,5 +181,4 @@
super.stop();
}
-
}
\ No newline at end of file
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-04-21 19:07:27 UTC (rev 2071)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-04-22 17:22:34 UTC (rev 2072)
@@ -73,8 +73,10 @@
public final static String GET_LONGRUNNINGQUERIES = "listLongRunningQueries"; //$NON-NLS-1$
public final static String KILL_REQUEST = "cancelRequest"; //$NON-NLS-1$
public final static String KILL_SESSION = "terminateSession"; //$NON-NLS-1$
+ public final static String KILL_TRANSACTION = "terminateTransaction"; //$NON-NLS-1$
public final static String GET_PROPERTIES = "getProperties"; //$NON-NLS-1$
public final static String GET_REQUESTS = "getRequests"; //$NON-NLS-1$
+ public final static String GET_TRANSACTIONS = "getTransactions"; //$NON-NLS-1$
public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
}
@@ -207,7 +209,7 @@
public final static String LONG_RUNNING_QUERY_LIMIT = "longRunningQueryLimit"; //$NON-NLS-1$
public final static String FIELD_LIST = "fieldList"; //$NON-NLS-1$
-
+ 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$
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2010-04-21 19:07:27 UTC (rev 2071)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2010-04-22 17:22:34 UTC (rev 2072)
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
02110-1301 USA. */
-->
-
+
<plugin name="TeiidPlugin" displayName="Teiid Plugin" package="org.teiid.rhq.plugin"
version="2.0.0" description="Supports management and monitoring of JBoss Teiid"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"
@@ -375,6 +375,37 @@
</results>
</operation>
+ <operation name="getTransactions" displayName="View current transactions"
+ description="Get current transactions executing against this VDB">
+ <results>
+ <c:list-property name="list" displayName="Current Transactions"
+ description="Transactions currently executing against the Teiid system"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Transaction ID"
+ name="getId" type="string"
+ description="The Xid string for GLOBAL transactions or the Transaction id string LOCAL/REQUEST." />
+ <c:simple-property displayName="Session ID"
+ name="getAssociatedSession" type="string"
+ description="Get the session associated with the this transaction. May be null for an unassociated Global transaction." />
+ <c:simple-property displayName="Scope" name="getScope"
+ type="string"
+ description="Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="The local creation time." />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="terminateTransaction" displayName="Terminate Transaction"
+ description="Terminate a specified transaction">
+ <parameters>
+ <c:simple-property displayName="Transaction ID" name="transactionID"
+ type="long" required="true" description="The ID of the transaction to terminate" />
+ </parameters>
+ </operation>
+
<metric displayName="Status" defaultOn="true" dataType="trait"
displayType="summary" category="availability" property="status"
description="The status of this VDB" />
14 years, 8 months