Author: shawkins
Date: 2009-04-08 11:36:06 -0400 (Wed, 08 Apr 2009)
New Revision: 730
Added:
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Transaction.java
trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
Removed:
trunk/common-internal/src/main/java/com/metamatrix/common/xa/TransactionID.java
trunk/common-internal/src/main/java/com/metamatrix/server/admin/api/TransactionAdminAPI.java
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/TransactionAdminAPIImpl.java
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreMonitoringAdmin.java
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreRuntimeStateAdmin.java
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java
trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties
trunk/common-core/src/test/java/com/metamatrix/core/util/SimpleMock.java
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/AuthorizationAdminAPI.java
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/SubSystemAdminAPI.java
trunk/common-internal/src/main/resources/com/metamatrix/common/properties/text.properties
trunk/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java
trunk/console/src/main/java/com/metamatrix/console/models/ModelManager.java
trunk/console/src/main/java/com/metamatrix/console/models/TransactionManager.java
trunk/console/src/main/java/com/metamatrix/console/ui/layout/PanelsTreeModel.java
trunk/console/src/main/java/com/metamatrix/console/ui/layout/WorkspaceController.java
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionTableModel.java
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionsPanel.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.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/SynchConnectorWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java
trunk/server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformTransactionService.java
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java
trunk/server/src/main/resources/com/metamatrix/admin/util/methodroles.properties
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
Log:
TEIID-129 exposing the ability to administer transactions. reviewed by RR.
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreMonitoringAdmin.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreMonitoringAdmin.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreMonitoringAdmin.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -34,6 +34,7 @@
import com.metamatrix.admin.api.objects.Request;
import com.metamatrix.admin.api.objects.Session;
import com.metamatrix.admin.api.objects.SystemObject;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.admin.api.objects.VDB;
@@ -228,5 +229,13 @@
*/
Collection getPropertyDefinitions(String identifier,
String className) throws AdminException;
+
+
+ /**
+ * Get all transaction matching the identifier.
+ * @return
+ * @throws AdminException
+ */
+ Collection<Transaction> getTransactions() throws AdminException;
}
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreRuntimeStateAdmin.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreRuntimeStateAdmin.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreRuntimeStateAdmin.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -22,6 +22,8 @@
package com.metamatrix.admin.api.core;
+import javax.transaction.xa.Xid;
+
import com.metamatrix.admin.api.exception.AdminException;
@@ -116,5 +118,21 @@
*/
public void changeVDBStatus(String name, String version, int status)
throws AdminException;
+
+ /**
+ * Mark the given global transaction as rollback only.
+ * @param transactionId
+ * @throws AdminException
+ */
+ void terminateTransaction(Xid transactionId) throws AdminException;
+
+ /**
+ * Mark the given transaction as rollback only.
+ * @param identifier
+ * The exact identifier of the transaction. Wild card is not supported.
+ * @param the session the transaction is associated with.
+ * @throws AdminException
+ */
+ void terminateTransaction(String transactionId, String sessionId) throws
AdminException;
}
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -31,8 +31,8 @@
* requests (the requests that are being processed on the physical data sources) as part
* of original request.
*
- * <p>A request is identified by a numbers separated by "." (dots).
usually in they are arranged
- * in the pattern [session].[request] or [session].[request].[source request]
</p>
+ * <p>A request is identified by a numbers separated by '|'. usually in
they are arranged
+ * in the pattern [session]|[request] or [session]|[request]|[source request]
</p>
* @since 4.3
*/
public interface Request extends AdminObject {
Added: trunk/client/src/main/java/com/metamatrix/admin/api/objects/Transaction.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/objects/Transaction.java
(rev 0)
+++
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Transaction.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -0,0 +1,63 @@
+/*
+ * 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 com.metamatrix.admin.api.objects;
+
+import java.util.Date;
+
+import javax.transaction.xa.Xid;
+
+public interface Transaction extends AdminObject {
+
+ /**
+ * Get the session associated with the this transaction.
+ * May be null for an unassociated Global transaction.
+ * @return
+ */
+ String getAssociatedSession();
+
+ /**
+ * Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST
+ * @return
+ */
+ String getScope();
+
+ /**
+ * Return the Xid of the Global transaction. Will be null for non-Global transactions.
+ * @return
+ */
+ Xid getXid();
+
+ /**
+ * Get the current status. See {@link javax.transaction.Status} for
+ * possible values.
+ * @return
+ */
+ String getStatus();
+
+ /**
+ * Get the date the transaction was created.
+ * @return
+ */
+ Date getCreated();
+
+}
Property changes on:
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Transaction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -32,6 +32,7 @@
import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.admin.api.objects.AdminObject;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.util.StringUtil;
@@ -82,14 +83,14 @@
public static final int OBJECT_TYPE_ROLE = 16;
/**Object type code for Session*/
public static final int OBJECT_TYPE_SESSION = 17;
- /**Object type code for SourceRequest*/
- public static final int OBJECT_TYPE_SOURCE_REQUEST = 18;
/**Object type code for SystemObject*/
public static final int OBJECT_TYPE_SYSTEM_OBJECT = 19;
/**Object type code for User*/
public static final int OBJECT_TYPE_USER = 20;
/**Object type code for VDB*/
public static final int OBJECT_TYPE_VDB = 21;
+ /**Object type code for TRANSACTION*/
+ public static final int OBJECT_TYPE_TRANSACTION = 22;
@@ -118,7 +119,7 @@
objectTypeMap.put(com.metamatrix.admin.api.objects.SystemObject.class.getName(),
new Integer(OBJECT_TYPE_SYSTEM_OBJECT));
objectTypeMap.put(com.metamatrix.admin.api.objects.User.class.getName(), new
Integer(OBJECT_TYPE_USER));
objectTypeMap.put(com.metamatrix.admin.api.objects.VDB.class.getName(), new
Integer(OBJECT_TYPE_VDB));
-
+ objectTypeMap.put(Transaction.class.getName(),
Integer.valueOf(OBJECT_TYPE_TRANSACTION));
}
@@ -164,7 +165,7 @@
* @param identifierParts Parts of the fully-qualified identifier of the MetaMatrix
Object
* @since 4.3
*/
- public MMAdminObject(String[] identifierParts) {
+ public MMAdminObject(String ... identifierParts) {
if (identifierParts == null) {
throw new
IllegalArgumentException(AdminPlugin.Util.getString("AbstractAdminObject.0"));
//$NON-NLS-1$
}
Added: trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
(rev 0)
+++
trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -0,0 +1,85 @@
+/*
+ * 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 com.metamatrix.admin.objects;
+
+import javax.transaction.xa.Xid;
+
+import com.metamatrix.admin.AdminPlugin;
+import com.metamatrix.admin.api.objects.Transaction;
+import com.metamatrix.common.xa.MMXid;
+
+public class TransactionImpl extends MMAdminObject implements Transaction {
+
+ private String associatedSession;
+ private String scope;
+ private MMXid xid;
+ private String status;
+
+ public TransactionImpl(String ... id) {
+ super(id);
+ }
+
+ public String getAssociatedSession() {
+ return associatedSession;
+ }
+
+ public void setAssociatedSession(String associatedSession) {
+ this.associatedSession = associatedSession;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public void setXid(MMXid xid) {
+ this.xid = xid;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+
result.append(AdminPlugin.Util.getString("TransactionImpl.identifier")).append(getIdentifier());
//$NON-NLS-1$
+
result.append(AdminPlugin.Util.getString("TransactionImpl.associatedSession")).append(associatedSession);
//$NON-NLS-1$
+
result.append(AdminPlugin.Util.getString("TransactionImpl.scope")).append(scope);
//$NON-NLS-1$
+
result.append(AdminPlugin.Util.getString("TransactionImpl.status")).append(status);
//$NON-NLS-1$
+
result.append(AdminPlugin.Util.getString("TransactionImpl.xid")).append(xid);
//$NON-NLS-1$
+ return result.toString();
+ }
+
+}
Property changes on:
trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties
===================================================================
--- trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties 2009-04-08
15:36:06 UTC (rev 730)
@@ -238,8 +238,12 @@
MMVDB.versionedBy=\n\ Versioned By:\
MMVDB.properties=\n\ properties:\
+TransactionImpl.identifier=Transaction:\n Identifier:\
+TransactionImpl.associatedSession=\n\ Associated Session:\
+TransactionImpl.scope=\n\ Scope:\
+TransactionImpl.status=\n\ Status:\
+TransactionImpl.xid=\n\ Xid:\
-
AdminStatus.CODE_UNKNOWN=Unknown.
AdminStatus.CODE_SUCCESS=Success.
AdminStatus.CODE_DECRYPTION_FAILED=Warning: The following connector bindings have NOT
been imported because the passwords could not be decrypted: {0}. The bindings may have
been exported from a system with a different keystore. You must either import with
AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR then manually re-enter the passwords by setting
the properties on the Connector binding via the Admin API, or via the Console
''Properties'' tab, or convert the file with the
''convertpasswords'' utility and re-import.
Modified: trunk/common-core/src/test/java/com/metamatrix/core/util/SimpleMock.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/core/util/SimpleMock.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/common-core/src/test/java/com/metamatrix/core/util/SimpleMock.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -43,7 +43,7 @@
}
if (clazz.isPrimitive()) {
- return null;
+ return 0;
}
if (!clazz.isInterface()) {
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/xa/TransactionID.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/xa/TransactionID.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/xa/TransactionID.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -1,86 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Date: Jan 2, 2003
- * Time: 3:27:45 PM
- */
-package com.metamatrix.common.xa;
-
-import java.io.Serializable;
-
-public class TransactionID implements Serializable {
-
- private String ID;
-
- /**
- * Create a new instance of TranscationID
- *
- * @param id uniqueID
- */
- public TransactionID(String id) {
- this.ID = id;
- }
-
- /**
- * Returns the ID value.
- * @return String ID value
- */
- public String getID() {
- return ID;
- }
-
- /**
- * Get hash code for object
- * @return Hash code
- */
- public int hashCode() {
- return this.ID.hashCode();
- }
-
- /**
- * Returns <code>true</code> if this object is equal to the other
object.
- * Equality is based on the ID value.
- *
- * @param obj Object to compare with
- * @return boolean indicating if objects are equal
- */
- public boolean equals(Object obj) {
- if ( this == obj ) {
- return true;
- }
- if (!(obj instanceof TransactionID)) {
- return false;
- }
-
- return ((TransactionID) obj).ID.equals(ID);
- }
-
- /**
- * Returns a string representation of an instance of this class.
- * @return String representation of this instance.
- */
- public String toString() {
- return this.ID;
- }
-
-}
Modified:
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/AuthorizationAdminAPI.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/AuthorizationAdminAPI.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/AuthorizationAdminAPI.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -36,7 +36,6 @@
import com.metamatrix.platform.security.api.AuthorizationPolicyID;
import com.metamatrix.platform.security.api.AuthorizationRealm;
import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
-import com.metamatrix.platform.security.api.SessionToken;
public interface AuthorizationAdminAPI extends SubSystemAdminAPI {
Modified:
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/SubSystemAdminAPI.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/SubSystemAdminAPI.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/SubSystemAdminAPI.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -26,6 +26,7 @@
/**
* This is the base interface of all subsystem administrative API interfaces.
+ * @deprecated
*/
public interface SubSystemAdminAPI extends Serializable {
Deleted:
trunk/common-internal/src/main/java/com/metamatrix/server/admin/api/TransactionAdminAPI.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/server/admin/api/TransactionAdminAPI.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/common-internal/src/main/java/com/metamatrix/server/admin/api/TransactionAdminAPI.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -1,77 +0,0 @@
-/*
- * 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 com.metamatrix.server.admin.api;
-
-import java.util.Collection;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MultipleException;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.common.xa.TransactionID;
-import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.platform.admin.api.SubSystemAdminAPI;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
-
-public interface TransactionAdminAPI extends SubSystemAdminAPI {
-
- /**
- * Return all transactions that are in the system.
- *
- * @return a collection of <code>ServerTransaction</code> objects.
- * @throws AuthorizationException if caller is not authorized to perform this method.
- * @throws InvalidSessionException if the <code>callerSessionID</code> is
not valid or is expired.
- * @throws MetaMatrixComponentException if an error occurred in communicating with a
component.
- */
- Collection getAllTransactions()
- throws AuthorizationException, InvalidSessionException,
MetaMatrixComponentException;
-
- /**
- * Terminate a transaction.
- * If status == STATUS_ACTIVE or STATUS_MARKED_ROLLBACK, rollback transaction.
- * Else, set status to STATUS_ROLLEDBACK.
- *
- * @param transactionID ID of the transaction to be rolledback.
- * @throws AuthorizationException if caller is not authorized to perform this method.
- * @throws InvalidSessionException if the <code>callerSessionID</code> is
not valid or is expired.
- * @throws com.metamatrix.common.xa.InvalidTransactionIDException if the Transaction
does not exist.
- * @throws MetaMatrixComponentException if an error occurred in communicating with a
component.
- */
- void terminateTransaction(TransactionID transactionID)
- throws AuthorizationException, InvalidSessionException, XATransactionException,
MetaMatrixComponentException ;
-
- /**
- * Terminate all transactions for the user session.
- * If status == STATUS_ACTIVE or STATUS_MARKED_ROLLBACK, rollback transaction.
- * Else, set status to STATUS_ROLLEDBACK.
- *
- * @param userSessionID the primary identifier for the user account.
- * @throws AuthorizationException if caller is not authorized to perform this method.
- * @throws InvalidSessionException if the <code>callerSessionID</code> is
not valid or is expired.
- * @throws MetaMatrixComponentException if an error occurred in communicating with a
component.
- */
- void terminateAllTransactions(MetaMatrixSessionID userSessionID)
- throws AuthorizationException, InvalidSessionException, MultipleException,
MetaMatrixComponentException ;
-
-}
-
Modified:
trunk/common-internal/src/main/resources/com/metamatrix/common/properties/text.properties
===================================================================
---
trunk/common-internal/src/main/resources/com/metamatrix/common/properties/text.properties 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/common-internal/src/main/resources/com/metamatrix/common/properties/text.properties 2009-04-08
15:36:06 UTC (rev 730)
@@ -37,7 +37,7 @@
//# SplashPanel
#
//################################################################################################################################
-SplashPanel.copyright = � {0}. All rights reserved.
+SplashPanel.copyright = {0}. All rights reserved.
SplashPanel.trademark = MetaMatrix, the MetaMatrix logo, MetaMatrix Enterprise
Server, MetaMatrix Enterprise Designer, MetaMatrix Enterprise Console and MetaMatrix
Enterprise Catalog are trademarks of MetaMatrix, Inc.
SplashPanel.penaltyNotice = This program is protected by copyright laws and
international treaties. Unauthorized reproduction or distribution of this program, or any
portion thereof, may result in serious civil and criminal penalties.
SplashPanel.applicationName = Application Name
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -30,11 +30,11 @@
public interface TransactionContext {
public enum Scope {
- TRANSACTION_BLOCK,
- TRANSACTION_GLOBAL,
- TRANSACTION_LOCAL,
- TRANSACTION_NONE,
- TRANSACTION_REQUEST
+ BLOCK,
+ GLOBAL,
+ LOCAL,
+ NONE,
+ REQUEST
}
public boolean isInTransaction();
Modified: trunk/console/src/main/java/com/metamatrix/console/models/ModelManager.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/models/ModelManager.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/console/src/main/java/com/metamatrix/console/models/ModelManager.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -44,7 +44,6 @@
import com.metamatrix.platform.admin.api.SubSystemAdminAPI;
import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
import com.metamatrix.server.admin.api.RuntimeMetadataAdminAPI;
-import com.metamatrix.server.admin.api.TransactionAdminAPI;
public class ModelManager {
@@ -329,11 +328,6 @@
return (RuntimeMetadataAdminAPI)
getSubSystemAdminAPI(RuntimeMetadataAdminAPI.class, conn);
}
- public static TransactionAdminAPI getTransactionAPI(ConnectionInfo conn) {
-
- return (TransactionAdminAPI) getSubSystemAdminAPI(TransactionAdminAPI.class,
conn);
- }
-
public static ExtensionSourceAdminAPI getExtensionSourceAPI(ConnectionInfo conn) {
return (ExtensionSourceAdminAPI)
getSubSystemAdminAPI(ExtensionSourceAdminAPI.class, conn);
Modified:
trunk/console/src/main/java/com/metamatrix/console/models/TransactionManager.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/models/TransactionManager.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/console/src/main/java/com/metamatrix/console/models/TransactionManager.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -24,23 +24,16 @@
import java.util.Collection;
-import com.metamatrix.api.exception.ComponentNotFoundException;
-
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.xa.TransactionID;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.console.connections.ConnectionInfo;
import com.metamatrix.console.ui.views.transactions.TransactionTableModel;
-import com.metamatrix.console.util.LogContexts;
import com.metamatrix.console.util.RuntimeExternalException;
-import com.metamatrix.server.admin.api.TransactionAdminAPI;
-
/**
* Extension of TimedManager to manage the Transactions tab. It creates and
* maintains the tab's table model, but has no reference to the tab itself.
*/
public class TransactionManager extends TimedManager {
- private TransactionAdminAPI transAPI;
private TransactionTableModel tableModel;
// Constructors and initialization methods
@@ -48,7 +41,6 @@
public TransactionManager(ConnectionInfo connection) {
super(connection);
super.init();
- transAPI = ModelManager.getTransactionAPI(getConnection());
//Create the table model, initially empty.
tableModel = new TransactionTableModel();
}
@@ -71,28 +63,15 @@
public void refreshTableModel() {
super.refresh(false);
//Make API call to get all transactions
- Collection /*<ServerTransaction>*/ tx = null;
+ Collection<Transaction> tx = null;
try {
- tx = transAPI.getAllTransactions();
- } catch (ComponentNotFoundException ex) {
- //Exception should not occur. Throw to caller as a
- //RuntimeExternalException.
- LogManager.logError(LogContexts.TRANSACTIONS, ex,
- "Error retrieving list of transactions. Transaction Service may
not be running."); //$NON-NLS-1$
- throw new RuntimeExternalException(ex);
+ tx = getConnection().getServerAdmin().getTransactions();
} catch (Exception ex) {
- //Exception should not occur. Throw to caller as a
- //RuntimeExternalException.
- LogManager.logError(LogContexts.TRANSACTIONS, ex,
- "Error retrieving list of transactions."); //$NON-NLS-1$
throw new RuntimeExternalException(ex);
}
//Repopulate the table model from the list of transactions returned.
tableModel.resetFromTransactionsList(tx);
}
- public TransactionID transactionIDForTransactionNum(Long transactionNum) {
- return tableModel.transactionIDForTransactionNum(transactionNum);
- }
}
Modified:
trunk/console/src/main/java/com/metamatrix/console/ui/layout/PanelsTreeModel.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/ui/layout/PanelsTreeModel.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/console/src/main/java/com/metamatrix/console/ui/layout/PanelsTreeModel.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -54,9 +54,9 @@
public static final String QUERIES = "Queries"; //$NON-NLS-1$
public static final Class QUERIES_PANEL_CLASS =
com.metamatrix.console.ui.views.queries.QueryPanel.class;
-// public static final String TRANSACTIONS = "Transactions";
-// public static final Class TRANSACTIONS_PANEL_CLASS =
-// com.metamatrix.console.ui.views.transactions.TransactionsPanel.class;
+ public static final String TRANSACTIONS = "Transactions";
+ public static final Class TRANSACTIONS_PANEL_CLASS =
+ com.metamatrix.console.ui.views.transactions.TransactionsPanel.class;
public static final String CONFIGURATION = "Configuration"; //$NON-NLS-1$
public static final String SYS_PROPS = "System Properties"; //$NON-NLS-1$
public static final Class SYSTEM_PROPERTIES_PANEL_CLASS =
@@ -221,12 +221,12 @@
runtimeMMServer.add(queries);
// transactions panel node
-// PanelsTreeNode transactions = new PanelsTreeNode(TRANSACTIONS,
-// TRANSACTIONS_PANEL_CLASS, connection, false);
-// transactions.setToolTipText(
-// "View and manage transactions that are currently being executed
"
-// + "in the MetaMatrix Server");
-// runtimeMMServer.add(transactions);
+ PanelsTreeNode transactions = new PanelsTreeNode(TRANSACTIONS,
+ TRANSACTIONS_PANEL_CLASS, connection, false);
+ transactions.setToolTipText(
+ "View and manage transactions that are currently being executed "
+ + "in the MetaMatrix Server");
+ runtimeMMServer.add(transactions);
//
--------------------------------------------------------------------------------
// setup Configuration header node
Modified:
trunk/console/src/main/java/com/metamatrix/console/ui/layout/WorkspaceController.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/ui/layout/WorkspaceController.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/console/src/main/java/com/metamatrix/console/ui/layout/WorkspaceController.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -45,6 +45,7 @@
import com.metamatrix.console.models.ModelManager;
import com.metamatrix.console.models.ResourceManager;
import com.metamatrix.console.models.ServerLogManager;
+import com.metamatrix.console.models.TransactionManager;
import com.metamatrix.console.notification.RuntimeUpdateNotification;
import com.metamatrix.console.security.UserCapabilities;
import com.metamatrix.console.ui.NotifyOnExitConsole;
@@ -63,6 +64,7 @@
import com.metamatrix.console.ui.views.sessions.SessionPanel;
import com.metamatrix.console.ui.views.summary.SummaryPanel;
import com.metamatrix.console.ui.views.syslog.SysLogPanel;
+import com.metamatrix.console.ui.views.transactions.TransactionsPanel;
import com.metamatrix.console.ui.views.users.AdminRolesMain;
import com.metamatrix.console.ui.views.vdb.VdbMainPanel;
import com.metamatrix.console.util.AutoRefreshable;
@@ -364,6 +366,8 @@
panel = createSystemLogSetupPanel(connection);
} else if (cls == ResourcesMainPanel.class) {
panel = createResourcesPanel(connection);
+ } else if (cls == TransactionsPanel.class) {
+ panel = createTransactionsPanel(connection);
}
if (panel instanceof AutoRefreshable) {
addToAutoRefreshableXref(panel);
@@ -489,6 +493,17 @@
}
return entPanel;
}
+
+ private TransactionsPanel createTransactionsPanel(ConnectionInfo connection) {
+ try {
+ UserCapabilities cap = UserCapabilities.getInstance();
+ boolean canModify = cap.isProductAdmin(connection);
+ return new TransactionsPanel(new TransactionManager(connection), canModify,
connection);
+ } catch (Exception ex) {
+ ExceptionUtility.showMessage("Create Transactions panel", ex);
//$NON-NLS-1$
+ }
+ return null;
+ }
private WorkspacePanel createResourcesPanel(ConnectionInfo connection) {
ResourcesMainPanel rp = null;
Modified:
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionTableModel.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionTableModel.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionTableModel.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -22,49 +22,42 @@
package com.metamatrix.console.ui.views.transactions;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
-import com.metamatrix.common.xa.TransactionID;
-import com.metamatrix.console.util.StaticUtilities;
+import com.metamatrix.admin.api.objects.Transaction;
+import com.metamatrix.common.xa.MMXid;
import com.metamatrix.toolbox.ui.widget.table.DefaultTableModel;
/**
* Extension to DefaultSortableTableModel to model the Transactions tab table.
*/
public class TransactionTableModel extends DefaultTableModel {
+
+ public static final int TXN_ID_INDEX = 0;
+ public static final int SESSION_ID_INDEX = 1;
+ public static final int XID_INDEX = 3;
//
// Static column information
//
- public final static int NUM_COLUMNS = 9;
- public final static int TRANSACTION_ID_COL = 0;
- public final static int SESSION_ID_COL = 1;
- public final static int STATUS_COL = 2;
- public final static int START_TIME_COL = 3;
- public final static int END_TIME_COL = 4;
- public final static int CONNECTOR_ID_COL = 5;
- public final static int PROCESSOR_ID_COL = 6;
- public final static int DATABASE_COL = 7;
- public final static int REQUEST_ID_COL = 8;
- public final static String TRANSACTION_ID_HDR = "Transaction ID";
- public final static String SESSION_ID_HDR = "Session ID";
- public final static String STATUS_HDR = "Status";
- public final static String START_TIME_HDR = "Start Time";
- public final static String END_TIME_HDR = "End Time";
- public final static String CONNECTOR_ID_HDR = "Connector ID";
- public final static String PROCESSOR_ID_HDR = "Processor ID";
- public final static String DATABASE_HDR = "Model";
- public final static String REQUEST_ID_HDR = "Request ID";
-
- private Map /*<Long (transaction num.) to TransactionID>*/ transMap;
- //Transaction-number-to-transaction-ID map of the model's current
- //contents. This map is accurate only if the model is populated
- //exclusively through use of the resetFromTransactionsList() method.
- private String[] colHdrs;
-
+ public final static Class<?>[] COLUMN_CLASS = new Class[]{
+ String.class,
+ String.class,
+ String.class,
+ Object.class,
+ String.class,
+ Date.class
+
+ };
+ public final static String[] COLUMN_HEADERS = new String[]{
+ "Transaction ID",
+ "Session ID",
+ "Scope",
+ "Xid",
+ "Status",
+ "Start Time",
+ };
+
//
// Constructors
//
@@ -72,17 +65,7 @@
super();
// Set columns for model
- colHdrs = new String[NUM_COLUMNS];
- colHdrs[TRANSACTION_ID_COL] = TRANSACTION_ID_HDR;
- colHdrs[SESSION_ID_COL] = SESSION_ID_HDR;
- colHdrs[STATUS_COL] = STATUS_HDR;
- colHdrs[START_TIME_COL] = START_TIME_HDR;
- colHdrs[END_TIME_COL] = END_TIME_HDR;
- colHdrs[CONNECTOR_ID_COL] = CONNECTOR_ID_HDR;
- colHdrs[PROCESSOR_ID_COL] = PROCESSOR_ID_HDR;
- colHdrs[DATABASE_COL] = DATABASE_HDR;
- colHdrs[REQUEST_ID_COL] = REQUEST_ID_HDR;
- super.setColumnIdentifiers(colHdrs);
+ super.setColumnIdentifiers(COLUMN_HEADERS);
// Set to 0 rows
super.setNumRows(0);
@@ -92,18 +75,7 @@
// Overridden methods
//
public Class getColumnClass(int columnIndex) {
- // Return appropriate column class based on the column index
- Class cls;
- if ((columnIndex == SESSION_ID_COL) || (columnIndex == PROCESSOR_ID_COL)
- || (columnIndex == REQUEST_ID_COL) || (columnIndex ==
- TRANSACTION_ID_COL)) {
- cls = Long.class;
- } else if ((columnIndex == START_TIME_COL) || (columnIndex == END_TIME_COL)) {
- cls = Date.class;
- } else {
- cls = String.class;
- }
- return cls;
+ return COLUMN_CLASS[columnIndex];
}
//
@@ -113,70 +85,28 @@
* Method to repopulate the table model based on a Collection of
* ServerTransaction objects.
*/
- public void resetFromTransactionsList(Collection /*<ServerTransaction>*/ tx) {
- transMap = new HashMap();
- int numRows = tx.size();
- String NA = "N/A"; //$NON-NLS-1$
+ public void resetFromTransactionsList(Collection<Transaction> txs) {
+ int numRows = txs.size();
// This panel needs to be removed, any transaction information provided
// should be on the queries panel.
//Store list's contents in a matrix-- one row per transaction.
- SimpleDateFormat formatter = StaticUtilities.getDefaultDateFormat();
- Object[][] data = new Object[numRows][NUM_COLUMNS];
- Iterator it = tx.iterator();
+ Object[][] data = new Object[numRows][COLUMN_HEADERS.length];
+ Iterator<Transaction> it = txs.iterator();
for (int row = 0; it.hasNext(); row++) {
-
- //getDisplayString() for TransactionID is guaranteed to return a
- //numeric string.
- data[row][TRANSACTION_ID_COL] = 0L;
- transMap.put(data[row][TRANSACTION_ID_COL], NA);
- data[row][SESSION_ID_COL] = NA;
- data[row][STATUS_COL] = NA;
-
- //Form new Date objects for begin and end time, rather than using
- //the objects returned by ServerTransaction. This is so we can
- //ensure that we have objects whose toString() method displays both
- //date and time. toString() for java.sql.Date displays date only.
- Date beginTime = new Date();
- if (beginTime == null) {
- data[row][START_TIME_COL] = null;
- } else {
- data[row][START_TIME_COL] = formatter.format(new
Date(beginTime.getTime()));
- }
- Date endTime = new Date();
- if (endTime == null) {
- data[row][END_TIME_COL] = null;
- } else {
- data[row][END_TIME_COL] = formatter.format(new Date(endTime.getTime()));
- }
- data[row][CONNECTOR_ID_COL] = null;
- data[row][PROCESSOR_ID_COL] = null;
- data[row][DATABASE_COL] = NA;
-// if (st.getRequestID() == null) {
-// data[row][REQUEST_ID_COL] = null;
-// } else {
- data[row][REQUEST_ID_COL] = new Long(0);
-// }
+ Transaction txn = it.next();
+ data[row][0] = txn.getIdentifier();
+ data[row][1] = txn.getAssociatedSession();
+ data[row][2] = txn.getScope();
+ data[row][3] = txn.getXid() != null?new MMXid(txn.getXid()):null;
+ data[row][4] = txn.getStatus();
+ data[row][5] = txn.getCreated();
}
//Set model's data to this matrix.
- this.setNumRows(0);
- this.setDataVector(data, colHdrs);
+ this.setRowCount(numRows);
+ this.setDataVector(data, COLUMN_HEADERS);
+ this.setEditable(false);
}
- /**
- * Method to return a TransactionID contained within the model, given its
- * transaction number. This method is accurate only if the model has been
- * populated exclusively through use of the resetFromTransactionsList()
- * method.
- */
- public TransactionID transactionIDForTransactionNum(Long transactionNum) {
- //transMap is a transaction-number-to-transaction-ID map for the model's
- //current contents. See if it contains the given transaction number.
- TransactionID id = null;
- if (transMap != null) {
- id = (TransactionID)transMap.get(transactionNum);
- }
- return id;
- }
}
Modified:
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionsPanel.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionsPanel.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/console/src/main/java/com/metamatrix/console/ui/views/transactions/TransactionsPanel.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -22,22 +22,39 @@
package com.metamatrix.console.ui.views.transactions;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.util.ArrayList;
-import javax.swing.*;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+import javax.transaction.xa.Xid;
import com.metamatrix.console.connections.ConnectionInfo;
-import com.metamatrix.console.models.*;
+import com.metamatrix.console.models.ManagerListener;
+import com.metamatrix.console.models.ModelChangedEvent;
+import com.metamatrix.console.models.TransactionManager;
import com.metamatrix.console.notification.RuntimeUpdateNotification;
-import com.metamatrix.console.ui.layout.*;
+import com.metamatrix.console.ui.layout.BasePanel;
+import com.metamatrix.console.ui.layout.ConsoleMenuBar;
+import com.metamatrix.console.ui.layout.MenuEntry;
+import com.metamatrix.console.ui.layout.WorkspacePanel;
import com.metamatrix.console.ui.util.AbstractPanelAction;
-import com.metamatrix.console.util.*;
-import com.metamatrix.server.admin.api.TransactionAdminAPI;
+import com.metamatrix.console.util.AutoRefreshable;
+import com.metamatrix.console.util.AutoRefresher;
+import com.metamatrix.console.util.DialogUtility;
+import com.metamatrix.console.util.ExceptionUtility;
+import com.metamatrix.console.util.StaticProperties;
+import com.metamatrix.console.util.StaticUtilities;
import com.metamatrix.toolbox.ui.widget.TableWidget;
import com.metamatrix.toolbox.ui.widget.table.DefaultTableColumnModel;
-import com.metamatrix.common.xa.XATransactionException;
public class TransactionsPanel extends BasePanel
implements ManagerListener,
@@ -74,10 +91,7 @@
new Insets(5, 5, 5, 5), 0, 0));
if (canTerminateTransactions) {
table.addMouseListener(new MouseAdapter() {
- //public void mousePressed(MouseEvent ev) {
- // checkMouseClick(ev);
- //}
- public void mouseReleased(MouseEvent ev) {
+ public void mousePressed(MouseEvent ev) {
checkMouseClick(ev);
}
});
@@ -91,23 +105,39 @@
}
private void checkMouseClick(MouseEvent ev) {
- if (ev.isPopupTrigger()) {
- int[] selectedRows = table.getSelectedRows();
- if (selectedRows.length == 1) {
- int row = selectedRows[0];
- //Was the mouse click over the selected row?
- int clickRow = table.rowAtPoint(ev.getPoint());
- if (row == clickRow) {
- //Yes. Put up popup menu with single action of terminate
transaction
- Long transactionNum = (Long)table.getModel().getValueAt(row,
- TransactionTableModel.TRANSACTION_ID_COL);
- JPopupMenu popupMenu = new JPopupMenu();
- Action terminateAction = new TerminateAction(transactionNum, this);
- popupMenu.add(terminateAction);
- popupMenu.show(table, ev.getX() + 10, ev.getY());
- }
- }
+ if (!SwingUtilities.isRightMouseButton(ev)) {
+ return;
}
+ int[] selectedRows = table.getSelectedRows();
+ if (selectedRows.length != 1) {
+ return;
+ }
+ int row = selectedRows[0];
+ //Was the mouse click over the selected row?
+ int clickRow = table.rowAtPoint(ev.getPoint());
+ if (row != clickRow) {
+ return;
+ }
+ //Yes. Put up popup menu with single action of terminate transaction
+ final String transactionNum = (String)table.getModel().getValueAt(row,
TransactionTableModel.TXN_ID_INDEX);
+ final String sessionId = (String)table.getModel().getValueAt(row,
TransactionTableModel.SESSION_ID_INDEX);
+ final Xid xid = (Xid)table.getModel().getValueAt(row,
TransactionTableModel.XID_INDEX);
+
+ JPopupMenu popupMenu = new JPopupMenu();
+ Action terminateAction = new AbstractAction("Terminate transaction") {
+
+ public void actionPerformed(ActionEvent ev) {
+ boolean confirmed = DialogUtility.yesNoDialog(null,
+ "Terminate transaction " + transactionNum.toString() +
"?",
+ "Confirm Termination");
+ if (confirmed) {
+ doTermination(transactionNum, sessionId, xid);
+ }
+ }
+ };
+
+ popupMenu.add(terminateAction);
+ popupMenu.show(table, ev.getX() + 10, ev.getY());
}
public void start() {
@@ -121,6 +151,7 @@
}
public java.util.List /*<Action>*/ resume() {
+ refresh();
AbstractPanelAction refreshAction = new AbstractPanelAction(0){
public void actionImpl(final ActionEvent e){
TransactionsPanel.this.refresh();
@@ -181,15 +212,13 @@
}
}
- public void doTermination(Long transactionNum) {
+ public void doTermination(String transactionNum, String sessionId, Xid xid) {
try {
- TransactionAdminAPI api = ModelManager.getTransactionAPI(connection);
-
api.terminateTransaction(manager.transactionIDForTransactionNum(transactionNum));
- } catch (XATransactionException ex) {
- StaticUtilities.displayModalDialogWithOK("Not Terminated",
- "Transaction " + transactionNum +
- " was not terminated. The transaction may have already "
+
- "completed.");
+ if (xid != null) {
+ getConnection().getServerAdmin().terminateTransaction(xid);
+ } else {
+ getConnection().getServerAdmin().terminateTransaction(transactionNum,
sessionId);
+ }
} catch (Exception e) {
ExceptionUtility.showMessage("Terminate Transaction", e);
}
@@ -242,22 +271,3 @@
}//end TransactionsPanel
-class TerminateAction extends AbstractAction {
- private Long transactionNum;
- private TransactionsPanel panel;
-
- public TerminateAction(Long trans, TransactionsPanel pnl) {
- super("Terminate transaction");
- transactionNum = trans;
- panel = pnl;
- }
-
- public void actionPerformed(ActionEvent ev) {
- boolean confirmed = DialogUtility.yesNoDialog(null,
- "Terminate transaction " + transactionNum.toString() +
"?",
- "Confirm Termination");
- if (confirmed) {
- panel.doTermination(transactionNum);
- }
- }
-}//end TerminateAction
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -65,6 +65,7 @@
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.DataService;
+import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
import com.metamatrix.platform.util.ProductInfoConstants;
@@ -146,6 +147,10 @@
return (DataService)getManager().findService(DQPServiceNames.DATA_SERVICE);
}
+ TransactionService getTransactionService() {
+ return
(TransactionService)getManager().findService(DQPServiceNames.TRANSACTION_SERVICE);
+ }
+
ConfigurationService getConfigurationService() {
return
(ConfigurationService)getManager().findService(DQPServiceNames.CONFIGURATION_SERVICE);
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -39,12 +39,14 @@
import com.metamatrix.admin.api.objects.AdminObject;
import com.metamatrix.admin.api.objects.ConnectorBinding;
import com.metamatrix.admin.api.objects.SystemObject;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -355,8 +357,14 @@
}
}
+ @Override
+ public Collection<Transaction> getTransactions()
+ throws AdminException {
+ TransactionService ts = getTransactionService();
+ if (ts == null) {
+ return Collections.emptyList();
+ }
+ return ts.getTransactions();
+ }
-
-
-
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -28,6 +28,8 @@
import java.util.Iterator;
import java.util.Set;
+import javax.transaction.xa.Xid;
+
import com.metamatrix.admin.api.embedded.EmbeddedLogger;
import com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin;
import com.metamatrix.admin.api.exception.AdminComponentException;
@@ -44,6 +46,7 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.message.RequestID;
+import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
@@ -326,4 +329,22 @@
throw new AdminProcessingException("Admin_invalid_log_listener");
//$NON-NLS-1$
}
}
+
+ @Override
+ public void terminateTransaction(String transactionId, String sessionId)
+ throws AdminException {
+ TransactionService ts = getTransactionService();
+ if (ts != null) {
+ ts.terminateTransaction(transactionId, sessionId);
+ }
+ }
+
+ @Override
+ public void terminateTransaction(Xid transactionId) throws AdminException {
+ TransactionService ts = getTransactionService();
+ if (ts != null) {
+ ts.terminateTransaction(transactionId);
+ }
+ }
+
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -26,71 +26,28 @@
import org.teiid.dqp.internal.transaction.TransactionServerImpl;
-import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.LogCommonConstants;
import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.dqp.transaction.TransactionServer;
-import com.metamatrix.dqp.transaction.XAServer;
import com.metamatrix.xa.arjuna.ArjunaTransactionProvider;
-public class EmbeddedTransactionService extends EmbeddedBaseDQPService implements
TransactionService {
+public class EmbeddedTransactionService extends TransactionServerImpl {
public static final String TRANSACTIONS_ENABLED =
"metamatrix.xatxnmgr.enabled"; //$NON-NLS-1$
- private TransactionServerImpl arjunaTs = new TransactionServerImpl();
- private TransactionServer ts;
- /**
- * @param props
- * @throws ApplicationInitializationException
- */
- public void initializeService(Properties props) throws
ApplicationInitializationException {
+ @Override
+ public void initialize(Properties props)
+ throws ApplicationInitializationException {
try {
props = new Properties(props);
props.put(TransactionService.HOSTNAME, "dqp"); //$NON-NLS-1$
props.put(TransactionService.VMNAME,
props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY));
- arjunaTs.init(ArjunaTransactionProvider.getInstance(props));
-
- final Class[] interfaces = new Class[] {TransactionServer.class,
XAServer.class};
-
- ts =
(TransactionServer)LogManager.createLoggingProxy(LogCommonConstants.CTX_XA_TXN, arjunaTs,
interfaces, MessageLevel.DETAIL);
+ this.setTransactionProvider(ArjunaTransactionProvider.getInstance(props));
} catch (XATransactionException e) {
throw new ApplicationInitializationException(e);
}
}
-
- /*
- * @see
com.metamatrix.common.application.ApplicationService#start(com.metamatrix.common.application.ApplicationEnvironment)
- */
- public void startService(ApplicationEnvironment environment) throws
ApplicationLifecycleException {
-
- }
-
- /*
- * @see com.metamatrix.common.application.ApplicationService#stop()
- */
- public void stopService() throws ApplicationLifecycleException {
- arjunaTs.shutdown(true);
- }
-
- /**
- * @see com.metamatrix.dqp.service.TransactionService#getTransactionServer()
- */
- public TransactionServer getTransactionServer() {
- return ts;
- }
-
- /**
- * @see com.metamatrix.dqp.service.TransactionService#getXAServer()
- */
- public XAServer getXAServer() {
- return (XAServer)ts;
- }
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -23,7 +23,6 @@
package com.metamatrix.jdbc;
import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.SQLException;
@@ -31,10 +30,9 @@
import com.metamatrix.admin.api.core.Admin;
import com.metamatrix.admin.api.embedded.EmbeddedAdmin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.core.util.MixinProxy;
import com.metamatrix.dqp.embedded.admin.DQPConfigAdminImpl;
import com.metamatrix.dqp.embedded.admin.DQPMonitoringAdminImpl;
import com.metamatrix.dqp.embedded.admin.DQPRuntimeStateAdminImpl;
@@ -80,17 +78,14 @@
*/
public Admin getAdminAPI() throws SQLException {
- InvocationHandler handler = new InvocationHandler() {
- Object[] implementors = {
- new DQPConfigAdminImpl(manager),
- new DQPMonitoringAdminImpl(manager),
- new DQPRuntimeStateAdminImpl(manager),
- new DQPSecurityAdminImpl(manager)
- };
+ InvocationHandler handler = new MixinProxy(new Object[] {
+ new DQPConfigAdminImpl(manager),
+ new DQPMonitoringAdminImpl(manager),
+ new DQPRuntimeStateAdminImpl(manager),
+ new DQPSecurityAdminImpl(manager)
+ }) {
public Object invoke(Object proxy, Method method, Object[] args) throws
Throwable {
- Exception ex = null;
-
// We we perform any DQP functions check if the DQP is still alive
if (!manager.isAlive()) {
throw new
AdminProcessingException(JDBCPlugin.Util.getString("EmbeddedConnection.DQP_shutDown"));
//$NON-NLS-1$
@@ -105,28 +100,7 @@
try {
// Set the class loader to current class classloader so that the this
classe's class loader gets used
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
- for (int i = 0; i < implementors.length; i++) {
- try {
- return method.invoke(implementors[i], args);
- } catch (IllegalArgumentException e) {
- ex = e; // try all classes
- } catch (IllegalAccessException e) {
- throw e;
- } catch (InvocationTargetException e) {
- // Since we know all the admin methods throw the Admin
Exceptions
- // no need to wrap with undeclared exception.
- Throwable target = e.getTargetException();
- if (target instanceof AdminException) {
- throw target;
- }
- throw new AdminComponentException(e);
- }
- }
- if (ex != null) {
- throw ex;
- }
- return null;
+ return super.invoke(proxy, method, args);
}
finally {
Thread.currentThread().setContextClassLoader(callingClassLoader);
Modified: trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -32,6 +32,7 @@
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.util.LogConstants;
@@ -59,6 +60,10 @@
LogManager.logWarning(LogConstants.CTX_DQP,
DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceIsNull",
serviceName)); //$NON-NLS-1$
}else{
ApplicationService appService = injector.getInstance(type);
+ String loggingContext = DQPServiceNames.SERVICE_LOGGING_CONTEXT[i];
+ if (loggingContext != null) {
+ appService = (ApplicationService)LogManager.createLoggingProxy(loggingContext,
appService, new Class[] {type}, MessageLevel.DETAIL);
+ }
appService.initialize(configSource.getProperties());
installService(serviceName, appService);
LogManager.logInfo(LogConstants.CTX_DQP,
DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceInstalled",
serviceName)); //$NON-NLS-1$
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -22,7 +22,9 @@
package com.metamatrix.dqp.service;
+import com.metamatrix.common.util.LogCommonConstants;
+
/**
* Defines constants used for naming DQP services.
*/
@@ -78,4 +80,15 @@
MetadataService.class,
DataService.class,
};
+
+ public static final String[] SERVICE_LOGGING_CONTEXT = new String[] {
+ null,
+ null,
+ null,
+ null,
+ LogCommonConstants.CTX_TXN_LOG,
+ null,
+ null,
+ null,
+ };
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -24,9 +24,21 @@
*/
package com.metamatrix.dqp.service;
+import java.util.Collection;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.SystemException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.teiid.connector.xa.api.TransactionContext;
+import org.teiid.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
+
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.dqp.transaction.TransactionServer;
-import com.metamatrix.dqp.transaction.XAServer;
+import com.metamatrix.common.xa.MMXid;
+import com.metamatrix.common.xa.XATransactionException;
/**
*/
@@ -52,7 +64,65 @@
public static final String DEFAULT_TXN_STORE_DIR =
System.getProperty("metamatrix.xatxnmgr.txnstore_dir",
System.getProperty("user.dir")); //$NON-NLS-1$ //$NON-NLS-2$
public static final String DEFAULT_TXN_STATUS_PORT = "0"; //$NON-NLS-1$
- TransactionServer getTransactionServer();
+ // processor level methods
+ TransactionContext start(TransactionContext context) throws XATransactionException,
SystemException;
+
+ TransactionContext commit(TransactionContext context) throws XATransactionException,
SystemException;
+
+ TransactionContext rollback(TransactionContext context) throws
XATransactionException, SystemException;
+
+ TransactionContext getOrCreateTransactionContext(String threadId);
+
+ // local transaction
+ TransactionContext begin(String threadId) throws XATransactionException,
SystemException;
+
+ void commit(String threadId) throws XATransactionException, SystemException;
+
+ void rollback(String threadId) throws XATransactionException, SystemException;
+
+ // connector worker
+ TransactionContext delist(TransactionContext context,
+ XAResource resource,
+ int flags) throws XATransactionException;
+
+ TransactionContext enlist(TransactionContext context,
+ XAResource resource) throws XATransactionException;
- XAServer getXAServer();
+ void cancelTransactions(String threadId, boolean requestOnly) throws
InvalidTransactionException, SystemException;
+
+
+ // recovery
+ void registerRecoverySource(String name, XAConnectionSource resource);
+
+ void removeRecoverySource(String name);
+
+ int prepare(final String threadId,
+ MMXid xid) throws XATransactionException;
+
+ void commit(final String threadId,
+ MMXid xid,
+ boolean onePhase) throws XATransactionException;
+
+ void rollback(final String threadId,
+ MMXid xid) throws XATransactionException;
+
+ Xid[] recover(int flag) throws XATransactionException;
+
+ void forget(final String threadId,
+ MMXid xid) throws XATransactionException;
+
+ void start(final String threadId,
+ MMXid xid,
+ int flags,
+ int timeout) throws XATransactionException;
+
+ void end(final String threadId,
+ MMXid xid,
+ int flags) throws XATransactionException;
+
+ Collection<Transaction> getTransactions();
+
+ void terminateTransaction(Xid transactionId) throws AdminException;
+
+ void terminateTransaction(String transactionId, String sessionId) throws
AdminException;
}
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 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -83,7 +83,6 @@
import com.metamatrix.dqp.service.TrackingService;
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.spi.TrackerLogConstants;
-import com.metamatrix.dqp.transaction.TransactionServer;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
@@ -398,7 +397,7 @@
if (this.isXa) {
if (this.connector.supportsSingleIdentity()) {
// add this connector as the recovery source
- TransactionServer ts =
this.getTransactionService().getTransactionServer();
+ TransactionService ts = this.getTransactionService();
ts.registerRecoverySource(connectorName, new
TransactionProvider.XAConnectionSource() {
XAConnection conn = null;
@@ -501,7 +500,7 @@
if(this.isXa){
if (this.getTransactionService() != null) {
- TransactionServer ts =
this.getTransactionService().getTransactionServer();
+ TransactionService ts = this.getTransactionService();
ts.removeRecoverySource(connectorName);
}
}
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -38,7 +38,7 @@
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.dqp.message.AtomicRequestMessage;
import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.transaction.TransactionServer;
+import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.util.LogConstants;
public class SynchConnectorWorkItem extends ConnectorWorkItem {
@@ -167,8 +167,8 @@
this.lock = null;
}
- private TransactionServer getTransactionServer() {
- return manager.getTransactionService().getTransactionServer();
+ private TransactionService getTransactionServer() {
+ return manager.getTransactionService();
}
@Override
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 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -57,6 +57,7 @@
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
+import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.LRUCache;
import com.metamatrix.dqp.DQPPlugin;
@@ -422,7 +423,7 @@
if (transactionService != null) {
try {
- transactionService.getTransactionServer().cancelTransactions(sessionId,
false);
+ transactionService.cancelTransactions(sessionId, false);
} catch (InvalidTransactionException err) {
LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for
requestID=" + sessionId); //$NON-NLS-1$
} catch (SystemException err) {
@@ -543,9 +544,16 @@
return tracker;
}
- TransactionService getTransactionService() {
+ public TransactionService getTransactionService() {
+ if (transactionService == null) {
+ throw new MetaMatrixRuntimeException("Transactions are not enabled");
//$NON-NLS-1$
+ }
return transactionService;
}
+
+ public TransactionService getTransactionServiceDirect() {
+ return transactionService;
+ }
ResultSetCache getRsCache() {
return rsCache;
@@ -645,7 +653,7 @@
public void begin() throws XATransactionException {
String threadId = DQPWorkContext.getWorkContext().getConnectionID();
try {
- this.transactionService.getTransactionServer().begin(threadId);
+ this.getTransactionService().begin(threadId);
} catch (SystemException e) {
throw new XATransactionException(e);
}
@@ -654,7 +662,7 @@
public void commit() throws XATransactionException {
String threadId = DQPWorkContext.getWorkContext().getConnectionID();
try {
- this.transactionService.getTransactionServer().commit(threadId);
+ this.getTransactionService().commit(threadId);
} catch (SystemException e) {
throw new XATransactionException(e);
}
@@ -662,7 +670,7 @@
public void rollback() throws XATransactionException {
try {
- this.transactionService.getTransactionServer().rollback(
+ this.getTransactionService().rollback(
DQPWorkContext.getWorkContext().getConnectionID());
} catch (SystemException e) {
throw new XATransactionException(e);
@@ -672,31 +680,31 @@
public void commit(MMXid xid, boolean onePhase)
throws XATransactionException {
String threadId = DQPWorkContext.getWorkContext().getConnectionID();
- this.transactionService.getXAServer().commit(threadId, xid, onePhase);
+ this.getTransactionService().commit(threadId, xid, onePhase);
}
public void end(MMXid xid, int flags) throws XATransactionException {
String threadId = DQPWorkContext.getWorkContext().getConnectionID();
- this.transactionService.getXAServer().end(threadId, xid, flags);
+ this.getTransactionService().end(threadId, xid, flags);
}
public void forget(MMXid xid) throws XATransactionException {
String threadId = DQPWorkContext.getWorkContext().getConnectionID();
- this.transactionService.getXAServer().forget(threadId, xid);
+ this.getTransactionService().forget(threadId, xid);
}
public int prepare(MMXid xid) throws XATransactionException {
- return this.transactionService.getXAServer().prepare(
+ return this.getTransactionService().prepare(
DQPWorkContext.getWorkContext().getConnectionID(),
xid);
}
public Xid[] recover(int flag) throws XATransactionException {
- return this.transactionService.getXAServer().recover(flag);
+ return this.getTransactionService().recover(flag);
}
public void rollback(MMXid xid) throws XATransactionException {
- this.transactionService.getXAServer().rollback(
+ this.getTransactionService().rollback(
DQPWorkContext.getWorkContext().getConnectionID(),
xid);
}
@@ -704,7 +712,7 @@
public void start(MMXid xid, int flags, int timeout)
throws XATransactionException {
String threadId = DQPWorkContext.getWorkContext().getConnectionID();
- this.transactionService.getXAServer().start(threadId, xid, flags, timeout);
+ this.getTransactionService().start(threadId, xid, flags, timeout);
}
public MetadataResult getMetadata(long requestID)
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 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -434,11 +434,11 @@
TransactionContext tc = null;
if (transactionService != null) {
- tc =
transactionService.getTransactionServer().getOrCreateTransactionContext(workContext.getConnectionID());
+ tc =
transactionService.getOrCreateTransactionContext(workContext.getConnectionID());
}
if (tc != null){
- Assertion.assertTrue(tc.getTransactionType() !=
TransactionContext.Scope.TRANSACTION_REQUEST, "Transaction already associated with
request."); //$NON-NLS-1$
+ Assertion.assertTrue(tc.getTransactionType() !=
TransactionContext.Scope.REQUEST, "Transaction already associated with
request."); //$NON-NLS-1$
}
if (tc == null || !tc.isInTransaction()) {
@@ -467,7 +467,7 @@
throw new
MetaMatrixComponentException(DQPPlugin.Util.getString("Request.transaction_not_supported"));
//$NON-NLS-1$
}
try {
- tc = transactionService.getTransactionServer().start(tc);
+ tc = transactionService.start(tc);
} catch (XATransactionException err) {
throw new MetaMatrixComponentException(err);
} catch (SystemException err) {
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 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -175,7 +175,7 @@
if (this.rsCache != null) {
this.cid = ResultSetCacheUtil.createCacheID(requestMsg, rsCache);
}
- this.transactionService = dqpCore.getTransactionService();
+ this.transactionService = dqpCore.getTransactionServiceDirect();
this.dqpCore = dqpCore;
this.request = request;
this.resultsReceiver = receiver;
@@ -283,8 +283,8 @@
this.transactionState = TransactionState.END;
}
}
- if (this.transactionState == TransactionState.END &&
transactionContext.getTransactionType() == TransactionContext.Scope.TRANSACTION_REQUEST)
{
- this.transactionService.getTransactionServer().commit(transactionContext);
+ if (this.transactionState == TransactionState.END &&
transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
+ this.transactionService.commit(transactionContext);
this.transactionState = TransactionState.DONE;
}
sendResultsIfNeeded(null);
@@ -343,10 +343,10 @@
this.transactionState = TransactionState.END;
}
- if (this.transactionState == TransactionState.END &&
transactionContext.getTransactionType() == TransactionContext.Scope.TRANSACTION_REQUEST)
{
+ if (this.transactionState == TransactionState.END &&
transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
this.transactionState = TransactionState.DONE;
try {
- this.transactionService.getTransactionServer().rollback(transactionContext);
+ this.transactionService.rollback(transactionContext);
} catch (XATransactionException e1) {
LogManager.logWarning(LogConstants.CTX_DQP, e1,
DQPPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$
} catch (SystemException err) {
@@ -590,7 +590,7 @@
try {
if (transactionService != null) {
try {
-
transactionService.getTransactionServer().cancelTransactions(requestID.getConnectionID(),
true);
+ transactionService.cancelTransactions(requestID.getConnectionID(),
true);
} catch (InvalidTransactionException err) {
LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed
for requestID=" + requestID.getConnectionID()); //$NON-NLS-1$
} catch (SystemException err) {
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -46,10 +46,11 @@
private MMXid xid;
private String txnID;
private Transaction transaction;
- private Scope transactionType = Scope.TRANSACTION_NONE;
- private Set suspendedBy = Collections.newSetFromMap(new ConcurrentHashMap());
+ private Scope transactionType = Scope.NONE;
+ private Set<String> suspendedBy = Collections.newSetFromMap(new
ConcurrentHashMap<String, Boolean>());
private int transactionTimeout = -1;
- private Set xaResources = Collections.newSetFromMap(new ConcurrentHashMap());
+ private Set<XAResource> xaResources = Collections.newSetFromMap(new
ConcurrentHashMap<XAResource, Boolean>());
+ private long creationTime;
public TransactionContextImpl() {}
@@ -64,8 +65,13 @@
void setTransaction(Transaction transaction, String id) {
this.transaction = transaction;
this.txnID = id;
+ this.creationTime = System.currentTimeMillis();
}
-
+
+ long getCreationTime() {
+ return creationTime;
+ }
+
/**
* @return Returns the transaction.
*/
@@ -117,7 +123,7 @@
this.xid = xid;
}
- Set getSuspendedBy() {
+ Set<String> getSuspendedBy() {
return this.suspendedBy;
}
@@ -136,7 +142,7 @@
this.xaResources.add(resource);
}
- Set getXAResources() {
+ Set<XAResource> getXAResources() {
return xaResources;
}
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -22,15 +22,22 @@
package org.teiid.dqp.internal.transaction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.IdentityHashMap;
import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.InvalidTransactionException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
+import javax.transaction.Status;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
@@ -42,25 +49,31 @@
import org.teiid.connector.xa.api.TransactionContext;
import org.teiid.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
+import com.metamatrix.admin.api.exception.AdminComponentException;
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.exception.AdminProcessingException;
+import com.metamatrix.admin.objects.MMAdminObject;
+import com.metamatrix.admin.objects.TransactionImpl;
+import com.metamatrix.common.application.ApplicationEnvironment;
+import com.metamatrix.common.application.exception.ApplicationInitializationException;
+import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.core.util.Assertion;
import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.transaction.TransactionServer;
-import com.metamatrix.dqp.transaction.XAServer;
+import com.metamatrix.dqp.service.TransactionService;
-public class TransactionServerImpl implements
- TransactionServer, XAServer {
+public class TransactionServerImpl implements TransactionService {
private static class TransactionMapping {
// (connection -> transaction for global and local)
- private Map threadToTransactionContext = new HashMap();
+ private Map<String, TransactionContextImpl> threadToTransactionContext =
new HashMap<String, TransactionContextImpl>();
// (MMXid -> global transactions keyed)
- private Map xidToTransactionContext = new HashMap();
-
+ private Map<MMXid, TransactionContextImpl> xidToTransactionContext = new
HashMap<MMXid, TransactionContextImpl>();
+
public synchronized TransactionContextImpl getOrCreateTransactionContext(String
threadId) {
- TransactionContextImpl tc =
(TransactionContextImpl)threadToTransactionContext.get(threadId);
+ TransactionContextImpl tc = threadToTransactionContext.get(threadId);
if (tc == null) {
tc = new TransactionContextImpl();
@@ -72,15 +85,15 @@
}
public synchronized TransactionContextImpl getTransactionContext(String threadId)
{
- return (TransactionContextImpl)threadToTransactionContext.get(threadId);
+ return threadToTransactionContext.get(threadId);
}
public synchronized TransactionContextImpl getTransactionContext(MMXid xid) {
- return (TransactionContextImpl)xidToTransactionContext.get(xid);
+ return xidToTransactionContext.get(xid);
}
public synchronized TransactionContextImpl removeTransactionContext(String
threadId) {
- return (TransactionContextImpl)threadToTransactionContext.remove(threadId);
+ return threadToTransactionContext.remove(threadId);
}
public synchronized void removeTransactionContext(TransactionContextImpl tc) {
@@ -109,18 +122,19 @@
private TransactionMapping transactions = new TransactionMapping();
private TransactionProvider provider;
+ private String processName = "embedded"; //$NON-NLS-1$
public TransactionServerImpl() {
}
- public void init(TransactionProvider theProvider) throws XATransactionException {
+ public void setProcessName(String processName) {
+ this.processName = processName;
+ }
+
+ public void setTransactionProvider(TransactionProvider theProvider) {
this.provider = theProvider;
}
- public synchronized void shutdown(boolean force) {
- this.provider.shutdown();
- }
-
@SuppressWarnings("finally")
public int prepare(final String threadId,
MMXid xid) throws XATransactionException {
@@ -155,8 +169,7 @@
private void endAssociations(TransactionContextImpl impl) throws
XATransactionException, SystemException {
Transaction tx = getTransactionManager().getTransaction();
Assertion.isNotNull(tx);
- for (Iterator i = impl.getXAResources().iterator(); i.hasNext();) {
- XAResource resource = (XAResource)i.next();
+ for (XAResource resource : impl.getXAResources()) {
if (!tx.delistResource(resource, XAResource.TMSUCCESS)) {
throw new
XATransactionException(DQPPlugin.Util.getString("TransactionServer.failed_to_delist"));
//$NON-NLS-1$
}
@@ -228,7 +241,7 @@
case XAResource.TMNOFLAGS: {
checkXAState(threadId, xid, false, false);
tc = transactions.getOrCreateTransactionContext(threadId);
- if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE)
{
+ if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
throw new XATransactionException(XAException.XAER_PROTO,
DQPPlugin.Util.getString("TransactionServer.existing_transaction"));
//$NON-NLS-1$
}
Transaction tx;
@@ -255,14 +268,14 @@
tc.setTransaction(tx, provider.getTransactionID(tx));
tc.setTransactionTimeout(timeout);
tc.setXid(xid);
- tc.setTransactionType(TransactionContext.Scope.TRANSACTION_GLOBAL);
+ tc.setTransactionType(TransactionContext.Scope.GLOBAL);
break;
}
case XAResource.TMJOIN:
case XAResource.TMRESUME: {
tc = checkXAState(threadId, xid, true, false);
TransactionContextImpl threadContext =
transactions.getOrCreateTransactionContext(threadId);
- if (threadContext.getTransactionType() !=
TransactionContext.Scope.TRANSACTION_NONE) {
+ if (threadContext.getTransactionType() != TransactionContext.Scope.NONE)
{
throw new XATransactionException(XAException.XAER_PROTO,
DQPPlugin.Util.getString("TransactionServer.existing_transaction"));
//$NON-NLS-1$
}
@@ -323,7 +336,7 @@
}
if (!threadBound) {
tc = transactions.getOrCreateTransactionContext(threadId);
- if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE)
{
+ if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
throw new XATransactionException(XAException.XAER_PROTO,
DQPPlugin.Util.getString("TransactionServer.existing_transaction", new Object[]
{xid, threadId})); //$NON-NLS-1$
}
}
@@ -350,8 +363,8 @@
final TransactionManager tm = getTransactionManager();
- if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
- if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_LOCAL) {
+ if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
+ if (tc.getTransactionType() != TransactionContext.Scope.LOCAL) {
throw new
NotSupportedException(DQPPlugin.Util.getString("TransactionServer.existing_transaction"));
//$NON-NLS-1$
}
if (!transactionExpected) {
@@ -372,7 +385,7 @@
tm.begin();
Transaction tx = tm.suspend();
tc.setTransaction(tx, provider.getTransactionID(tx));
- tc.setTransactionType(TransactionContext.Scope.TRANSACTION_LOCAL);
+ tc.setTransactionType(TransactionContext.Scope.LOCAL);
return tc;
} catch (InvalidTransactionException err) {
throw new XATransactionException(err);
@@ -446,14 +459,14 @@
TransactionContextImpl tc = (TransactionContextImpl)context;
try {
- if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
+ if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
throw new
XATransactionException(DQPPlugin.Util.getString("TransactionServer.existing_transaction"));
//$NON-NLS-1$
}
tm.begin();
Transaction tx = tm.suspend();
tc.setTransaction(tx, provider.getTransactionID(tx));
- tc.setTransactionType(TransactionContext.Scope.TRANSACTION_REQUEST);
+ tc.setTransactionType(TransactionContext.Scope.REQUEST);
return tc;
} catch (NotSupportedException e) {
throw new XATransactionException(e);
@@ -461,13 +474,13 @@
}
public TransactionContext commit(TransactionContext context) throws
XATransactionException, SystemException {
- Assertion.assertTrue(context.getTransactionType() ==
TransactionContext.Scope.TRANSACTION_REQUEST);
+ Assertion.assertTrue(context.getTransactionType() ==
TransactionContext.Scope.REQUEST);
TransactionContextImpl tc = (TransactionContextImpl)context;
//commit may be called multiple times by the processworker, if this is a
subsequent call, then the current
//context will not be active
TransactionContextImpl currentContext =
transactions.getTransactionContext(tc.getThreadId());
- if (currentContext == null || currentContext.getTransactionType() ==
TransactionContext.Scope.TRANSACTION_NONE) {
+ if (currentContext == null || currentContext.getTransactionType() ==
TransactionContext.Scope.NONE) {
return currentContext;
}
TransactionManager tm = getTransactionManager();
@@ -494,7 +507,7 @@
}
public TransactionContext rollback(TransactionContext context) throws
XATransactionException, SystemException {
- Assertion.assertTrue(context.getTransactionType() ==
TransactionContext.Scope.TRANSACTION_REQUEST);
+ Assertion.assertTrue(context.getTransactionType() ==
TransactionContext.Scope.REQUEST);
TransactionManager tm = getTransactionManager();
try {
tm.resume(context.getTransaction());
@@ -584,24 +597,29 @@
public void cancelTransactions(String threadId, boolean requestOnly) throws
InvalidTransactionException, SystemException {
TransactionContextImpl tc = transactions.getTransactionContext(threadId);
- if (tc == null || tc.getTransactionType() ==
TransactionContext.Scope.TRANSACTION_NONE) {
+ if (tc == null || tc.getTransactionType() == TransactionContext.Scope.NONE) {
return;
}
- if (requestOnly && tc.getTransactionType() !=
TransactionContext.Scope.TRANSACTION_REQUEST) {
+ if (requestOnly && tc.getTransactionType() !=
TransactionContext.Scope.REQUEST) {
return;
}
- TransactionManager tm = getTransactionManager();
+ cancelTransaction(tc);
+ }
+
+ private void cancelTransaction(TransactionContextImpl tc)
+ throws InvalidTransactionException, SystemException {
+ TransactionManager tm = getTransactionManager();
try {
tm.resume(tc.getTransaction());
tm.setRollbackOnly();
} finally {
tm.suspend();
- transactions.removeTransactionContext(tc);
+ //transactions.removeTransactionContext(tc);
}
- }
+ }
public synchronized void registerRecoverySource(String name, XAConnectionSource
resource) {
this.provider.registerRecoverySource(name, resource);
@@ -609,6 +627,111 @@
public synchronized void removeRecoverySource(String name) {
this.provider.removeRecoverySource(name);
- }
+ }
+
+ @Override
+ public Collection<com.metamatrix.admin.api.objects.Transaction> getTransactions()
{
+ Set<TransactionContextImpl> txnSet = Collections.newSetFromMap(new
IdentityHashMap<TransactionContextImpl, Boolean>());
+ synchronized (this.transactions) {
+ txnSet.addAll(this.transactions.threadToTransactionContext.values());
+ txnSet.addAll(this.transactions.xidToTransactionContext.values());
+ }
+ Collection<com.metamatrix.admin.api.objects.Transaction> result = new
ArrayList<com.metamatrix.admin.api.objects.Transaction>(txnSet.size());
+ for (TransactionContextImpl transactionContextImpl : txnSet) {
+ if (transactionContextImpl.getTxnID() == null) {
+ continue;
+ }
+ TransactionImpl txnImpl = new TransactionImpl(processName,
transactionContextImpl.getTxnID());
+ txnImpl.setAssociatedSession(transactionContextImpl.getThreadId());
+ txnImpl.setCreated(new Date(transactionContextImpl.getCreationTime()));
+ txnImpl.setScope(transactionContextImpl.getTransactionType().toString());
+ try {
+ txnImpl.setStatus(getStatusString(transactionContextImpl.getTransaction().getStatus()));
+ } catch (SystemException e) {
+ txnImpl.setStatus(getStatusString(Status.STATUS_UNKNOWN));
+ }
+ txnImpl.setXid(transactionContextImpl.getXid());
+ result.add(txnImpl);
+ }
+ return result;
+ }
+
+ public static String getStatusString(int status) {
+ switch (status) {
+ case Status.STATUS_ACTIVE:
+ return "ACTIVE"; //$NON-NLS-1$
+ case Status.STATUS_COMMITTED:
+ return "COMMITTED"; //$NON-NLS-1$
+ case Status.STATUS_COMMITTING:
+ return "COMMITTING"; //$NON-NLS-1$
+ case Status.STATUS_MARKED_ROLLBACK:
+ return "MARKED_ROLLBACK"; //$NON-NLS-1$
+ case Status.STATUS_NO_TRANSACTION:
+ return "NO_TRANSACTION"; //$NON-NLS-1$
+ case Status.STATUS_PREPARED:
+ return "PREPARED"; //$NON-NLS-1$
+ case Status.STATUS_PREPARING:
+ return "PREPARING"; //$NON-NLS-1$
+ case Status.STATUS_ROLLEDBACK:
+ return "ROLLEDBACK"; //$NON-NLS-1$
+ case Status.STATUS_ROLLING_BACK:
+ return "ROLLING_BACK"; //$NON-NLS-1$
+ }
+ return "UNKNOWN"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void terminateTransaction(Xid transactionId) throws AdminException {
+ if (transactionId == null) {
+ return;
+ }
+ TransactionContextImpl context = this.transactions.getTransactionContext(new
MMXid(transactionId));
+ if (context != null) {
+ try {
+ cancelTransaction(context);
+ } catch (InvalidTransactionException e) {
+ throw new AdminProcessingException(e);
+ } catch (SystemException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+ }
+
+ @Override
+ public void terminateTransaction(String transactionId, String sessionId) throws
AdminException {
+ if (transactionId == null) {
+ return;
+ }
+ String[] id = MMAdminObject.buildIdentifierArray(transactionId);
+ if (!this.processName.equalsIgnoreCase(id[0]) || id.length != 2) {
+ return;
+ }
+ TransactionContextImpl context = this.transactions.getTransactionContext(sessionId);
+ if (context != null && id[1].equalsIgnoreCase(context.getTxnID())) {
+ try {
+ cancelTransaction(context);
+ } catch (InvalidTransactionException e) {
+ throw new AdminProcessingException(e);
+ } catch (SystemException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+ }
+
+ @Override
+ public void initialize(Properties props)
+ throws ApplicationInitializationException {
+ }
+
+ @Override
+ public void start(ApplicationEnvironment environment)
+ throws ApplicationLifecycleException {
+
+ }
+
+ @Override
+ public synchronized void stop() throws ApplicationLifecycleException {
+ this.provider.shutdown();
+ }
}
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -22,49 +22,15 @@
package org.teiid.dqp.internal.datamgr.impl;
-import java.util.Properties;
-
import org.teiid.dqp.internal.transaction.TransactionProvider;
import org.teiid.dqp.internal.transaction.TransactionServerImpl;
-import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.core.util.SimpleMock;
-import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.dqp.transaction.TransactionServer;
-import com.metamatrix.dqp.transaction.XAServer;
-public class FakeTransactionService implements TransactionService {
+public class FakeTransactionService extends TransactionServerImpl {
- private TransactionServerImpl server = new TransactionServerImpl();
-
public FakeTransactionService() {
- try {
- server.init(SimpleMock.createSimpleMock(TransactionProvider.class));
- } catch (XATransactionException e) {
- throw new RuntimeException(e);
- }
+ this.setTransactionProvider(SimpleMock.createSimpleMock(TransactionProvider.class));
}
- public TransactionServer getTransactionServer() {
- return server;
- }
-
- public XAServer getXAServer() {
- return server;
- }
-
- public void initialize(Properties props)
- throws ApplicationInitializationException {
- }
-
- public void start(ApplicationEnvironment environment)
- throws ApplicationLifecycleException {
- }
-
- public void stop() throws ApplicationLifecycleException {
- }
-
}
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -24,11 +24,9 @@
import javax.transaction.xa.XAResource;
-import org.teiid.dqp.internal.transaction.TransactionProvider;
-import org.teiid.dqp.internal.transaction.TransactionServerImpl;
-
import junit.framework.TestCase;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.core.util.SimpleMock;
@@ -52,7 +50,7 @@
*/
protected void setUp() throws Exception {
server = new TransactionServerImpl();
- server.init(SimpleMock.createSimpleMock(TransactionProvider.class));
+
server.setTransactionProvider(SimpleMock.createSimpleMock(TransactionProvider.class));
}
/**
@@ -239,4 +237,18 @@
public void testGetTransactionContext() throws Exception {
assertSame(server.getOrCreateTransactionContext(THREAD1),
server.getOrCreateTransactionContext(THREAD1));
}
+
+ public void testGetTransactions() throws Exception {
+ server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100);
+ server.begin(THREAD2);
+
+ assertEquals(2, server.getTransactions().size());
+
+ server.commit(THREAD2);
+ assertEquals(1, server.getTransactions().size());
+
+ Transaction t = server.getTransactions().iterator().next();
+ assertEquals(THREAD1, t.getAssociatedSession());
+ assertNotNull(t.getXid());
+ }
}
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -522,16 +522,14 @@
return parent.getResources(identifier);
case MMAdminObject.OBJECT_TYPE_SESSION:
return parent.getSessions(identifier);
- case MMAdminObject.OBJECT_TYPE_SOURCE_REQUEST:
- return parent.getSourceRequests(identifier);
case MMAdminObject.OBJECT_TYPE_SYSTEM_OBJECT:
list = new ArrayList();
list.add(parent.getSystem());
return list;
case MMAdminObject.OBJECT_TYPE_VDB:
return parent.getVDBs(identifier);
-
-
+ case MMAdminObject.OBJECT_TYPE_TRANSACTION:
+ return parent.getTransactions();
case MMAdminObject.OBJECT_TYPE_ENTITLEMENT:
case MMAdminObject.OBJECT_TYPE_MODEL:
case MMAdminObject.OBJECT_TYPE_PROPERTY_DEFINITION:
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -28,6 +28,8 @@
import java.util.List;
import java.util.Properties;
+import javax.transaction.xa.Xid;
+
import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.objects.AdminOptions;
import com.metamatrix.admin.api.objects.ConnectorBinding;
@@ -35,6 +37,7 @@
import com.metamatrix.admin.api.objects.LogConfiguration;
import com.metamatrix.admin.api.objects.ScriptsContainer;
import com.metamatrix.admin.api.objects.SystemObject;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.admin.api.objects.VDB;
import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -969,4 +972,22 @@
throws AdminException {
return getSecurityAdmin().getGroupsForDomain(domainName);
}
+
+ @Override
+ public Collection<Transaction> getTransactions()
+ throws AdminException {
+ return getMonitoringAdmin().getTransactions();
+ }
+
+ @Override
+ public void terminateTransaction(String transactionId, String sessionId)
+ throws AdminException {
+ getRuntimeAdmin().terminateTransaction(transactionId, sessionId);
+ }
+
+ @Override
+ public void terminateTransaction(Xid transactionId) throws AdminException {
+ getRuntimeAdmin().terminateTransaction(transactionId);
+ }
+
}
\ No newline at end of file
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -49,6 +49,7 @@
import com.metamatrix.admin.api.objects.Resource;
import com.metamatrix.admin.api.objects.Session;
import com.metamatrix.admin.api.objects.SystemObject;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.admin.api.objects.VDB;
import com.metamatrix.admin.api.server.ServerMonitoringAdmin;
import com.metamatrix.admin.objects.MMAdminObject;
@@ -1226,5 +1227,10 @@
return null;
}
+ @Override
+ public Collection<Transaction> getTransactions()
+ throws AdminException {
+ return getQueryServiceProxy().getTransactions();
+ }
}
\ No newline at end of file
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -29,6 +29,8 @@
import java.util.List;
import java.util.Map;
+import javax.transaction.xa.Xid;
+
import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.admin.api.exception.AdminComponentException;
@@ -730,7 +732,16 @@
return true;
}
+ @Override
+ public void terminateTransaction(String transactionId, String sessionId)
+ throws AdminException {
+ this.getQueryServiceProxy().terminateTransaction(transactionId, sessionId);
+ }
+ @Override
+ public void terminateTransaction(Xid transactionId) throws AdminException {
+ this.getQueryServiceProxy().terminateTransaction(transactionId);
+ }
}
\ No newline at end of file
Modified:
trunk/server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -208,8 +208,7 @@
try {
vdbID =
RuntimeMetadataCatalog.getInstance().getActiveVirtualDatabaseID(vdbName, vdbVersion);
} catch (VirtualDatabaseDoesNotExistException e) {
- // Propagate message, don't care about stack trace
- throw new MetaMatrixAuthenticationException(e.getMessage());
+ throw new SessionServiceException(e);
} catch (VirtualDatabaseException e) {
if (vdbVersion == null) {
throw new
SessionServiceException(e,PlatformPlugin.Util.getString("SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database",
new Object[] {vdbName})); //$NON-NLS-1$
Modified:
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -112,9 +112,7 @@
import com.metamatrix.server.HostManagement;
import com.metamatrix.server.ResourceFinder;
import com.metamatrix.server.admin.api.RuntimeMetadataAdminAPI;
-import com.metamatrix.server.admin.api.TransactionAdminAPI;
import com.metamatrix.server.admin.apiimpl.RuntimeMetadataAdminAPIImpl;
-import com.metamatrix.server.admin.apiimpl.TransactionAdminAPIImpl;
import com.metamatrix.server.util.ServerPropertyNames;
/**
@@ -211,7 +209,6 @@
this.clientServices.registerClientService(AuthorizationAdminAPI.class,
AuthorizationAdminAPIImpl.getInstance(),
PlatformAdminConstants.CTX_AUTHORIZATION_ADMIN_API);
this.clientServices.registerClientService(ExtensionSourceAdminAPI.class,
ExtensionSourceAdminAPIImpl.getInstance(), PlatformAdminConstants.CTX_ADMIN_API);
this.clientServices.registerClientService(RuntimeMetadataAdminAPI.class,
RuntimeMetadataAdminAPIImpl.getInstance(),
PlatformAdminConstants.CTX_RUNTIME_METADATA_ADMIN_API);
- this.clientServices.registerClientService(TransactionAdminAPI.class,
TransactionAdminAPIImpl.getInstance(), PlatformAdminConstants.CTX_ADMIN_API);
}
Deleted:
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/TransactionAdminAPIImpl.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/TransactionAdminAPIImpl.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/TransactionAdminAPIImpl.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -1,127 +0,0 @@
-/*
- * 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 com.metamatrix.server.admin.apiimpl;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.server.AdminRoles;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MultipleException;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.common.xa.TransactionID;
-import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.platform.admin.apiimpl.AdminAPIHelper;
-import com.metamatrix.platform.admin.apiimpl.SubSystemAdminAPIImpl;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.server.admin.api.TransactionAdminAPI;
-
-public class TransactionAdminAPIImpl extends SubSystemAdminAPIImpl implements
TransactionAdminAPI {
-
- //Transaction service proxy
- private static TransactionAdminAPI transactionAdminAPI;
-
- /**
- * ctor
- */
- private TransactionAdminAPIImpl() throws MetaMatrixComponentException {
- }
-
- public synchronized static TransactionAdminAPI getInstance() throws
MetaMatrixComponentException {
- if (transactionAdminAPI == null) {
- transactionAdminAPI = new TransactionAdminAPIImpl();
- }
- return transactionAdminAPI;
- }
-
- /**
- * Return all transactions that are in the system.
- *
- * @return a collection of <code>ServerTransaction</code> objects.
- * @throws AuthorizationException if caller is not authorized to perform this method.
- * @throws InvalidSessionException if the <code>callerSessionID</code> is
not valid or is expired.
- * @throws MetaMatrixComponentException if an error occurred in communicating with a
component.
- */
- public synchronized Collection getAllTransactions()
- throws AuthorizationException, InvalidSessionException,
MetaMatrixComponentException {
-
- // Validate caller's session
- AdminAPIHelper.validateSession(getSessionID());
- // Any administrator may call this read-only method - no need to validate role
-
- // TODO: This will eventually be replaced
- return Collections.EMPTY_LIST;
- }
-
-
- /**
- * Terminate a transactions.
- * If status == STATUS_ACTIVE or STATUS_MARKED_ROLLBACK, rollback transaction.
- * Else, set status to STATUS_ROLLEDBACK.
- *
- * @param transactionID ID of the transaction to be rolledback.
- * @throws AuthorizationException if caller is not authorized to perform this method.
- * @throws InvalidSessionException if the <code>callerSessionID</code> is
not valid or is expired.
- * @throws com.metamatrix.common.xa.InvalidTransactionIDException if the Transaction
does not exist.
- * @throws MetaMatrixComponentException if an error occurred in communicating with a
component.
- */
- public synchronized void terminateTransaction(TransactionID transactionID)
- throws AuthorizationException, InvalidSessionException, XATransactionException,
MetaMatrixComponentException {
-
- // Validate caller's session
- SessionToken callerToken = AdminAPIHelper.validateSession(getSessionID());
- // Validate caller's role
- AdminAPIHelper.checkForRequiredRole(callerToken,
AdminRoles.RoleName.ADMIN_PRODUCT,
"TransactionAdminAPIImpl.terminateTransaction(" + transactionID +
")"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // TODO: This will eventually be replaced
-// transAdmin.terminateTransaction(transactionID);
- }
-
-
-
- /**
- * Terminate all transactions for the user session.
- * If status == STATUS_ACTIVE or STATUS_MARKED_ROLLBACK, rollback transaction.
- * Else, set status to STATUS_ROLLEDBACK.
- *
- * @param userSessionID the primary identifier for the user account.
- * @throws AuthorizationException if caller is not authorized to perform this method.
- * @throws InvalidSessionException if the <code>callerSessionID</code> is
not valid or is expired.
- * @throws MetaMatrixComponentException if an error occurred in communicating with a
component.
- */
- public synchronized void terminateAllTransactions(MetaMatrixSessionID userSessionID)
- throws AuthorizationException, InvalidSessionException, MultipleException,
MetaMatrixComponentException {
-
- // Validate caller's session
- SessionToken callerToken = AdminAPIHelper.validateSession(getSessionID());
- // Validate caller's role
- AdminAPIHelper.checkForRequiredRole(callerToken,
AdminRoles.RoleName.ADMIN_PRODUCT,
"TransactionAdminAPIImpl.terminateAllTransactions(" + userSessionID +
")"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // TODO: This will eventually be replaced
-// transAdmin.terminateTransactionsForSession(callerToken);
- }
-
-}
-
Modified:
trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformTransactionService.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformTransactionService.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformTransactionService.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -30,30 +30,21 @@
import com.google.inject.Inject;
import com.google.inject.name.Named;
-import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.ResourceNames;
import com.metamatrix.common.config.api.Host;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.LogCommonConstants;
import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.FileUtils;
import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.dqp.transaction.TransactionServer;
-import com.metamatrix.dqp.transaction.XAServer;
import com.metamatrix.server.Configuration;
import com.metamatrix.xa.arjuna.ArjunaTransactionProvider;
/**
*/
-public class PlatformTransactionService implements TransactionService{
+public class PlatformTransactionService extends TransactionServerImpl {
- private TransactionServerImpl arjunaTs = new TransactionServerImpl();
- private TransactionServer ts;
private Host host;
@Inject
@@ -83,42 +74,11 @@
props.setProperty(TransactionService.VMNAME,
CurrentConfiguration.getInstance().getProcessName());
props.setProperty(TransactionService.TXN_STORE_DIR, host.getDataDirectory());
- arjunaTs.init(ArjunaTransactionProvider.getInstance(props));
-
- final Class[] interfaces = new Class[] {TransactionServer.class,
XAServer.class};
-
- ts =
(TransactionServer)LogManager.createLoggingProxy(LogCommonConstants.CTX_XA_TXN, arjunaTs,
interfaces, MessageLevel.DETAIL);
+ this.setTransactionProvider(ArjunaTransactionProvider.getInstance(props));
+ this.setProcessName(CurrentConfiguration.getInstance().getProcessName());
} catch (XATransactionException err) {
throw new ApplicationInitializationException(err);
}
}
- /*
- * @see
com.metamatrix.common.application.ApplicationService#start(com.metamatrix.common.application.ApplicationEnvironment)
- */
- public void start(ApplicationEnvironment environment) throws
ApplicationLifecycleException {
-
- }
-
- /*
- * @see com.metamatrix.common.application.ApplicationService#stop()
- */
- public void stop() throws ApplicationLifecycleException {
- arjunaTs.shutdown(true);
- }
-
- /**
- * @see com.metamatrix.dqp.service.TransactionService#getTransactionServer()
- */
- public TransactionServer getTransactionServer() {
- return ts;
- }
-
- /**
- * @see com.metamatrix.dqp.service.TransactionService#getXAServer()
- */
- public XAServer getXAServer() {
- return (XAServer)ts;
- }
-
}
Modified:
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -26,13 +26,18 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+import javax.transaction.xa.Xid;
+
import org.teiid.dqp.internal.process.DQPCore;
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
@@ -49,6 +54,7 @@
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.message.RequestID;
+import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.platform.service.api.CacheAdmin;
import com.metamatrix.platform.service.api.ServiceID;
@@ -160,7 +166,7 @@
* @see
com.metamatrix.server.query.service.QueryServiceInterface#cancelQueries(com.metamatrix.platform.security.api.SessionToken,
boolean, boolean)
*/
public void cancelQueries(SessionToken sessionToken, boolean shouldRollback)
- throws InvalidRequestIDException, MetaMatrixComponentException{
+ throws MetaMatrixComponentException{
this.dqp.terminateConnection(sessionToken.getSessionID().toString());
}
@@ -249,5 +255,35 @@
super.init(id, deployedComponentID, props, listenerRegistry);
listenerRegistry.registerClientService(ClientSideDQP.class, this.dqp,
LogConstants.CTX_QUERY_SERVICE);
}
+
+ @Override
+ public Collection<Transaction> getTransactions() {
+ TransactionService ts = getTransactionService();
+ if (ts == null) {
+ return Collections.emptyList();
+ }
+ return ts.getTransactions();
+ }
+
+ @Override
+ public void terminateTransaction(String transactionId, String sessionId)
+ throws AdminException {
+ TransactionService ts = getTransactionService();
+ if (ts != null) {
+ ts.terminateTransaction(transactionId, sessionId);
+ }
+ }
+
+ @Override
+ public void terminateTransaction(Xid transactionId) throws AdminException {
+ TransactionService ts = getTransactionService();
+ if (ts != null) {
+ ts.terminateTransaction(transactionId);
+ }
+ }
+
+ protected TransactionService getTransactionService() {
+ return this.dqp.getTransactionServiceDirect();
+ }
}
Modified:
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -24,6 +24,10 @@
import java.util.Collection;
+import javax.transaction.xa.Xid;
+
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
@@ -47,8 +51,6 @@
public Collection getAllQueries();
- public Collection getQueriesForSession(SessionToken userToken);
-
//=========================================================================
// Methods to cancel running queries and cursors associated with them
//=========================================================================
@@ -59,6 +61,12 @@
throws InvalidRequestIDException, MetaMatrixComponentException;
public void cancelQuery(RequestID requestID, int nodeID)
- throws InvalidRequestIDException, MetaMatrixComponentException;
+ throws InvalidRequestIDException, MetaMatrixComponentException;
+
+ Collection<Transaction> getTransactions();
+
+ void terminateTransaction(Xid transactionId) throws AdminException;
+
+ void terminateTransaction(String transactionId, String sessionId) throws
AdminException;
}
Modified:
trunk/server/src/main/resources/com/metamatrix/admin/util/methodroles.properties
===================================================================
---
trunk/server/src/main/resources/com/metamatrix/admin/util/methodroles.properties 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/main/resources/com/metamatrix/admin/util/methodroles.properties 2009-04-08
15:36:06 UTC (rev 730)
@@ -65,6 +65,7 @@
getPropertyDefinitions=Admin.ReadOnlyAdmin
getQueueWorkerPools=Admin.ReadOnlyAdmin
getRequests=Admin.ReadOnlyAdmin
+getTransactions=Admin.ReadOnlyAdmin
getSessions=Admin.ReadOnlyAdmin
getSourceRequests=Admin.ReadOnlyAdmin
getSystem=Admin.ReadOnlyAdmin
@@ -79,6 +80,7 @@
startConnectorBinding=Admin.ProductAdmin
stopConnectorBinding=Admin.ProductAdmin
terminateSession=Admin.ProductAdmin
+terminateTransaction=Admin.ProductAdmin
#===============================
# ServerAdmin
#===============================
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java 2009-04-08
11:50:41 UTC (rev 729)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java 2009-04-08
15:36:06 UTC (rev 730)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@@ -31,7 +32,11 @@
import java.util.Properties;
import java.util.Set;
+import javax.transaction.xa.Xid;
+
+import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.objects.Request;
+import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
@@ -291,5 +296,21 @@
public Throwable getInitException() {
return null;
}
+
+ @Override
+ public Collection<Transaction> getTransactions() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void terminateTransaction(String transactionId, String sessionId)
+ throws AdminException {
+
+ }
+
+ @Override
+ public void terminateTransaction(Xid transactionId) throws AdminException {
+
+ }
}