[jboss-svn-commits] JBL Code SVN: r21258 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator and 64 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jul 28 13:23:02 EDT 2008
Author: mmusgrov
Date: 2008-07-28 13:23:01 -0400 (Mon, 28 Jul 2008)
New Revision: 21258
Added:
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/IToolInitializer.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/TransactionLister.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/UidConverter.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/AbstractResourceActionHandle.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StateTable.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxInputObjectState.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/ArjunaTransactionWrapper.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/BasicActionInfo.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationInfo.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/UidInfo.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceInfo.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/AtomicTransactionViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/treenodes/IUidCollection.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsFramework.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/images/
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/images/ImageCommon.java
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/build.xml
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/resources/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/resources/META-INF/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/resources/META-INF/jboss-service.xml
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/embedded/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/embedded/EmbeddedToolsFramework.java
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedTools.java
labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedToolsMBean.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTAToolInitializer.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/InFlightTransactionPseudoStore.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxTester.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/InFlightTransactionViewer.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/AbstractRecordViewer.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/XAResourceRecordViewer.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ArjunaTransactionViewEntry.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/FailedViewEntry.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/HeuristicViewEntry.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PendingViewEntry.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PreparedViewEntry.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ReadOnlyViewEntry.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ArjunaTransactionListNode.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/FailedListNode.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/HeuristicListNode.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PendingListNode.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PreparedListNode.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ReadOnlyListNode.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/
labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/LiveAtomicActionWrapper.java
labs/jbosstm/trunk/ArjunaJTA/tsmx/build.xml
labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/ManagedSynchronizationImple.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTSToolInitializer.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/FactoryContactItemWrapper.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ExtendedResourceRecordViewer.java
Removed:
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionWrapper.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/gandiva/inventory/StaticInventory.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreBrowserPlugin.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreCellRenderer.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/PluginClassloader.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/EntityViewerRepository.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/frames/BrowserFrame.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StatePanel.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/ObjectStoreRootProvider.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/providers/DefaultRootProvider.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/StateViewersRepository.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionViewer.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionWrapper.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/FailedViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/HeuristicViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PendingViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PreparedViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/ReadOnlyViewEntry.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/AtomicActionListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/FailedListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/HeuristicListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PendingListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PreparedListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/ReadOnlyListNode.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ArjunaToolsFramework.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsClassLoader.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/dialogs/AboutDialog.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/iconpanel/IconImage.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPlugin.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginException.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformation.java
labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformationNotFoundException.java
labs/jbosstm/trunk/ArjunaCore/tsmx/build.xml
labs/jbosstm/trunk/ArjunaCore/tsmx/etc/logo.gif
labs/jbosstm/trunk/ArjunaCore/tsmx/etc/objectstorebrowser/tools.properties
labs/jbosstm/trunk/ArjunaCore/tsmx/etc/toolsframework.xml
labs/jbosstm/trunk/ArjunaJTA/build.xml
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/transaction/Transaction.java
labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ControlWrapper.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java
labs/jbosstm/trunk/ArjunaJTS/jts/idl/arjuna/ArjunaOTS.idl
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceEntityViewer.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceViewDialog.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ResourceRecordViewer.java
labs/jbosstm/trunk/ArjunaJTS/tsmx/build.xml
labs/jbosstm/trunk/build.xml
Log:
Updated sources and build such that a sar version of jbosstm tools is delivered to the install bin directory.
Various fixes including new viewers.
The updates do not address "remote operation"
Resolves issues JBTM-382 and JBTM-366
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -407,7 +407,26 @@
return !problem;
}
- private SortedSet _synchs;
+ public java.util.Map<Uid, String> getSynchronizations()
+ {
+ java.util.Map<Uid, String> synchs = new java.util.HashMap<Uid, String> ();
+
+ synchronized (this) {
+ if (_synchs != null)
+ {
+ for (Object _synch : _synchs)
+ {
+ SynchronizationRecord synch = (SynchronizationRecord) _synch;
+
+ synchs.put(synch.get_uid(), synch.toString());
+ }
+ }
+ }
+
+ return synchs;
+ }
+
+ private SortedSet _synchs;
private SynchronizationRecord _currentRecord; // the most recently processed Synchronization.
private Throwable _deferredThrowable;
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/gandiva/inventory/StaticInventory.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/gandiva/inventory/StaticInventory.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/gandiva/inventory/StaticInventory.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -285,7 +285,9 @@
{
Class c = Thread.currentThread().getContextClassLoader().loadClass(className);
Object o = c.newInstance();
- }
+ if (o instanceof InventoryElement)
+ Inventory.inventory().addToList((InventoryElement) o);
+ }
catch (Exception ex)
{
ex.printStackTrace();
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/IToolInitializer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/IToolInitializer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/IToolInitializer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser;
+
+import com.arjuna.ats.tools.toolsframework.plugin.ToolPlugin;
+
+/**
+ * Abstract the differences between initializing the JTS and JTA versions of the tool
+ */
+public interface IToolInitializer
+{
+ void initialize(ToolPlugin plugin);
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreBrowserPlugin.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreBrowserPlugin.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreBrowserPlugin.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
- * (C) 2005-2006,
+ * (C) 2005-2008,
* @author JBoss Inc.
*/
/*
@@ -37,6 +37,7 @@
import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.StateViewersRepository;
import com.arjuna.ats.tools.objectstorebrowser.rootprovider.*;
+import com.arjuna.ats.tools.objectstorebrowser.rootprovider.providers.DefaultRootProvider;
import com.arjuna.ats.tools.objectstorebrowser.entityviewer.EntityViewerRepository;
import javax.swing.*;
@@ -47,13 +48,16 @@
import java.awt.event.ActionEvent;
import java.util.Properties;
import java.io.File;
+import java.beans.PropertyVetoException;
public class ObjectStoreBrowserPlugin extends ToolPlugin implements ActionListener
{
private final static String BROWSE_OBJECT_STORE_MENU_ITEM = "Open Object Store Browser";
private final static String PLUGIN_NAME = "ObjectStoreBrowser";
- private final static String ROOT_PROVIDER_PROPERTY = "com.arjuna.mwtools.objectstorebrowser.rootprovider";
+ private final static String ROOT_PROVIDER_PROPERTY = "com.arjuna.mwtools.objectstorebrowser.rootprovider"; // see tools.properties
+ private final static String INITIALIZER_PROPERTY = "com.arjuna.mwtools.objectstorebrowser.initializer"; // see tools.properties
+ private final static String ALT_INITIALIZER_PROPERTY = "com.arjuna.mwtools.objectstorebrowser.altinitializer"; // see tools.properties
private final static String PLUGINS_DIRECTORY = "plugins";
private static boolean _browserOpen = false;
@@ -62,14 +66,17 @@
private BrowserFrame _browser = null;
private JMenuItem _menuItem = null;
- /**
+ /**
* Initialise the plugin, many activities should be performed during this method:-
*
* + Add menus to the menu bar,
*/
public void initialise(Properties props) throws ToolPluginException
{
- /** Create menu bar **/
+ if (getToolsFramework().getToolsDir() == null)
+ throw new ToolPluginException("ToolsFramework installation does not have a tools direcory");
+
+ /** Create menu bar **/
_menuItem = new JMenuItem( BROWSE_OBJECT_STORE_MENU_ITEM );
_menuItem.setMnemonic(KeyEvent.VK_B);
_menuItem.addActionListener(this);
@@ -77,15 +84,12 @@
this.getFileMenu().add(_menuItem);
- /** Initialise the state viewers repository **/
- StateViewersRepository.initialiseRepository(new File(ArjunaToolsFramework.getLibDirectory(), PLUGINS_DIRECTORY));
- EntityViewerRepository.initialiseRepository(props);
- StateViewersRepository.setDefaultStateViewer(new DefaultStateViewer());
-
-
/** Setup the roots provider **/
String rootProviderClass = props.getProperty(ROOT_PROVIDER_PROPERTY);
+ /*
+ * initialise the root provider before the plugins in case a plugin needs to update the root provider
+ */
if ( rootProviderClass != null )
{
try
@@ -97,9 +101,42 @@
throw new ToolPluginException("Failed to create object store root provider plugin:"+e);
}
}
- }
+ else
+ {
+ _rootProvider = new DefaultRootProvider();
+ }
- /**
+ if (!initialize(props, INITIALIZER_PROPERTY) && !initialize(props, ALT_INITIALIZER_PROPERTY))
+ throw new ToolPluginException("Cannot locate plugin initializer for plugin " + getClass().getName());
+
+ /** Initialise the state viewers repository **/
+ StateViewersRepository.initialiseRepository(new File(getToolsFramework().getToolsDir().getFile(), PLUGINS_DIRECTORY));
+ EntityViewerRepository.initialiseRepository(props);
+
+ StateViewersRepository.setDefaultStateViewer(new DefaultStateViewer());
+ }
+
+ private boolean initialize(Properties props, String propName)
+ {
+ String cName = props.getProperty(propName);
+
+ if (cName != null)
+ {
+ try
+ {
+ ((IToolInitializer)Class.forName(cName).newInstance()).initialize(this);
+ return true;
+ }
+ catch (Exception e)
+ {
+ System.out.println("Information: unable to locate initializer class " + e.getMessage());
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e)
@@ -125,7 +162,7 @@
_browser.setFrameIcon(getIcon16());
_browserOpen = true;
- _browser.addInternalFrameListener(new InternalFrameAdapter()
+ _browser.addInternalFrameListener(new InternalFrameAdapter()
{
/**
* Invoked when an internal frame has been closed.
@@ -141,7 +178,8 @@
/** Add new frame to desktop **/
this.getDesktop().add( _browser );
- }
+ this.getDesktop().getDesktopManager().maximizeFrame(_browser);
+ }
}
public static boolean isBrowserOpen()
@@ -175,7 +213,11 @@
*/
public void dispose() throws ToolPluginException
{
- }
+ /*
+ StateViewersRepository.disposeRepository();
+ EntityViewerRepository.disposeRepository();
+ */
+ }
/**
* Called by the framework when the user selects Settings from the menu.
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreCellRenderer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreCellRenderer.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/ObjectStoreCellRenderer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -33,6 +33,7 @@
import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.toolsframework.images.ImageCommon;
import com.arjuna.ats.arjuna.objectstore.ObjectStore;
import com.arjuna.ats.arjuna.state.InputObjectState;
@@ -49,9 +50,14 @@
private final static String EMPTY_CONTAINER_ICON_FILENAME = "objectstore-empty.gif";
private final static String LIST_ICON_FILENAME = "objectstore-list.gif";
- private static ImageIcon _emptyContainerIcon = new ImageIcon(ClassLoader.getSystemResource( EMPTY_CONTAINER_ICON_FILENAME ));
+ /*
+ private static ImageIcon _emptyContainerIcon = new ImageIcon(ClassLoader.getSystemResource( EMPTY_CONTAINER_ICON_FILENAME ));
private static ImageIcon _listIcon = new ImageIcon(ClassLoader.getSystemResource( LIST_ICON_FILENAME ));
- /**
+ */
+ private static ImageIcon _emptyContainerIcon = ImageCommon.getImageIcon(EMPTY_CONTAINER_ICON_FILENAME);
+ private static ImageIcon _listIcon = ImageCommon.getImageIcon(LIST_ICON_FILENAME);
+
+ /**
* Configures the renderer based on the passed in components.
* The value is set from messaging the tree with
* <code>convertValueToText</code>, which ultimately invokes
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/PluginClassloader.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/PluginClassloader.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/PluginClassloader.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -132,7 +132,7 @@
}
catch (Exception e)
{
- System.err.println("Could not instantiate the class '"+obj+"'");
+ System.err.println("Could not instantiate the class '"+obj+"' - " + e.getMessage());
}
}
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/TransactionLister.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/TransactionLister.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/TransactionLister.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+import javax.transaction.Transaction;
+import java.util.Map;
+
+/**
+ * Abstract the mechanism used to discover which transactions are currently in existence
+ */
+public interface TransactionLister
+{
+ Map<Uid, Transaction> getTransactions();
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/UidConverter.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/UidConverter.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/UidConverter.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+import javax.transaction.xa.Xid;
+
+public interface UidConverter
+{
+ Uid toUid(Xid xid);
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/EntityViewerRepository.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/EntityViewerRepository.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/EntityViewerRepository.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
- * (C) 2005-2006,
+ * (C) 2005-2008,
* @author JBoss Inc.
*/
package com.arjuna.ats.tools.objectstorebrowser.entityviewer;
@@ -23,6 +23,8 @@
import java.util.Properties;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
/*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
@@ -39,11 +41,11 @@
{
private final static String VIEWER_PROPERTY_PREFIX = "com.arjuna.mwtools.objectstorebrowser.entityviewers.";
- private static Hashtable _viewers = new Hashtable();
+ private static ConcurrentMap _viewers = new ConcurrentHashMap();
public static void registerEntityViewer(String type, EntityViewerInterface entityViewer)
{
- _viewers.put(type, entityViewer);
+ _viewers.putIfAbsent(type, entityViewer);
}
public static EntityViewerInterface getEntityViewer(String type)
@@ -74,7 +76,8 @@
}
catch (Exception e)
{
- throw new ExceptionInInitializerError("Failed to create instance of '"+viewerClassname+"' entity viewer: "+e);
+ System.out.println("Warning: Failed to create instance of '"+viewerClassname+"' entity viewer: " + e.getMessage());
+// throw new ExceptionInInitializerError("Failed to create instance of '"+viewerClassname+"' entity viewer: "+e);
}
}
}
@@ -84,4 +87,9 @@
throw new ExceptionInInitializerError("Failed to initiate object state viewers: "+e);
}
}
+
+ public static void disposeRepository()
+ {
+ _viewers.clear();
+ }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/AbstractResourceActionHandle.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/AbstractResourceActionHandle.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/AbstractResourceActionHandle.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,51 @@
+package com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008,
+ * @author JBoss Inc.
+ */
+
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+
+/**
+ * Simple wrapper for a BasicAction, AbstractRecord pair
+ */
+public class AbstractResourceActionHandle
+{
+ private BasicAction action;
+ private AbstractRecord res;
+
+ public AbstractResourceActionHandle(BasicAction action, AbstractRecord res)
+ {
+ this.action = action;
+ this.res = res;
+ }
+
+ public BasicAction getAction()
+ {
+ return action;
+ }
+
+ public AbstractRecord getAbstractRecord()
+ {
+ return res;
+ }
+
+}
+
Copied: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java (from rev 20579, labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource;
+
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+
+public class ResourceActionHandle extends AbstractResourceActionHandle
+{
+ public ResourceActionHandle(BasicAction action, AbstractRecord res)
+ {
+ super(action, res);
+ }
+
+ public RecoveryAbstractRecord getAbstractRecord()
+ {
+ return (RecoveryAbstractRecord) super.getAbstractRecord();
+ }
+
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/frames/BrowserFrame.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/frames/BrowserFrame.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/frames/BrowserFrame.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -34,6 +34,7 @@
import com.arjuna.ats.tools.objectstorebrowser.ObjectStoreCellRenderer;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.*;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.StateViewersRepository;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.IUidCollection;
import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
@@ -69,8 +70,9 @@
private JSplitPane _splitPane = null;
private IconPanel _objectView = null;
private JComboBox _rootCombo = null;
+ private JLabel _statusBar = new JLabel();
- public BrowserFrame()
+ public BrowserFrame()
{
super(FRAME_TITLE, true, true, true, true);
@@ -88,12 +90,8 @@
/** Create root pulldown **/
_rootCombo = new JComboBox(ObjectStoreBrowserPlugin.getRootProvider().getRoots());
_rootCombo.addActionListener(this);
+ _rootCombo.setEnabled(_rootCombo.getItemCount() != 0);
- if ( _rootCombo.getItemCount() == 0 )
- {
- _rootCombo.setEnabled(false);
- }
-
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
@@ -101,12 +99,17 @@
gbl.addLayoutComponent(_rootCombo,gbc);
treePanel.add(_rootCombo);
+ JComponent sp = getSearchPanel();
+ gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 0;
+ gbl.addLayoutComponent(sp,gbc);
+ treePanel.add(sp);
+
ObjectStoreRootProvider provider = ObjectStoreBrowserPlugin.getRootProvider();
/** Create object store **/
if ( provider == null || provider.getRoots().isEmpty() )
{
- JOptionPane.showMessageDialog(this, "No object store roots found, object store is empty", "Warning", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(this, "No object store roots found, object store is empty", "Error", JOptionPane.WARNING_MESSAGE);
dispose();
}
else
@@ -121,7 +124,7 @@
_tree.addTreeWillExpandListener(this);
_tree.setCellRenderer(new ObjectStoreCellRenderer());
gbc.gridx = 0;
- gbc.gridy = 1;
+ gbc.gridy = 2;
gbc.fill = GridBagConstraints.BOTH;
gbc.weighty = 1;
gbc.weightx = 1;
@@ -146,15 +149,169 @@
this.getContentPane().add(_splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treePanel, rightHandSplitPlane));
_splitPane.setDividerSize(3);
+ // and finally a status bar
+ _statusBar.setBorder(new javax.swing.border.EtchedBorder());
+ this.getContentPane().add(_statusBar, BorderLayout.SOUTH);
+ _stateViewer.setStatusBar(_statusBar);
+
show();
}
}
- private final static DefaultMutableTreeNode getChildWithName(DefaultMutableTreeNode currentNode, String name)
+ /**
+ * Create an edit box for automatically navigating to a particular tree node
+ *
+ * @return a component containing the search box and its label
+ */
+ private JComponent getSearchPanel()
+ {
+ Box box = new Box(BoxLayout.X_AXIS);
+
+ box.add(new JLabel("Uid: "));
+ JTextField searchBox = new JTextField(20);
+
+ searchBox.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ // locate a node starting from the currently selected node
+ TreePath currentSelection = getSelectedPath();
+ DefaultMutableTreeNode node = locateNode(currentSelection, e.getActionCommand());
+
+ if (node != null)
+ {
+ TreePath path = new TreePath(node.getPath());
+
+ _tree.expandPath(path);
+ _tree.setSelectionPath(path);
+ _tree.scrollPathToVisible(path);
+ expandTree(_tree, node);
+ }
+ }
+ });
+ box.add(searchBox);
+ box.setToolTipText("Enter a uid to search for");
+
+ return box;
+ }
+
+ /**
+ * Return the currently selected node. If none is selected then
+ * make the root node the currently selected node.
+ *
+ * @return the current selected node
+ */
+ private TreePath getSelectedPath()
+ {
+ TreePath currentSelection = _tree.getSelectionPath();
+
+ if (currentSelection == null)
+ {
+ TreePath path = new TreePath(_treeModel.getRoot());
+
+ _tree.setSelectionPath(path);
+ return path;
+ }
+
+ return currentSelection;
+ }
+
+ private void expandTree(JTree tree, DefaultMutableTreeNode start)
+ {
+ for (Enumeration e = start.children(); e.hasMoreElements();)
+ {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
+
+ if (!node.isLeaf())
+ {
+ tree.expandPath(new TreePath(node.getPath()));
+ expandTree(tree, node);
+ }
+ }
+ }
+
+ /**
+ * Convert a tree path to an object store path
+ *
+ * @param path the tree path
+ * @return the corresponding object store path
+ */
+ private String getPathName(TreePath path)
+ {
+ String pathName = "";
+
+ // Skip the root node as it is not part of the underlying object store tree
+ for (int i = 1; i < path.getPathCount(); i++)
+ pathName += ((DefaultMutableTreeNode) path.getPathComponent(i)).getUserObject().toString() + GROUP_DELIMITER;
+
+ return pathName;
+ }
+
+ /**
+ * Locate a node and simultaneously update each node in the path to the target node.
+ *
+ * @param path where to start the search from
+ * @param name the name of the node to look for
+ * @return the first node with the given name or null if not found under path
+ */
+ private DefaultMutableTreeNode locateNode(TreePath path, String name)
+ {
+ DefaultMutableTreeNode node = findNode((DefaultMutableTreeNode) path.getLastPathComponent(), name);
+
+ if (node != null)
+ return node;
+
+ // not found so try updating the tree and then search again
+ String pathName = getPathName(path);
+
+ node = (DefaultMutableTreeNode)path.getLastPathComponent();
+ updateTreeNode(node, pathName);
+
+ // if the node contains a collection of ids ...
+ if (node instanceof IUidCollection && ((IUidCollection) node).contains(name))
+ return node;
+
+ for (Enumeration e = node.children(); e.hasMoreElements();)
+ {
+ DefaultMutableTreeNode child = (DefaultMutableTreeNode) e.nextElement();
+
+ path = new TreePath(child.getPath());
+ node = locateNode(path, name);
+
+ if (node != null)
+ return node;
+ }
+
+ return null; // not found
+ }
+
+ /**
+ * Locate a node by name
+ *
+ * @param node the node from which to start the search
+ * @param name the name of the node to search for
+ * @return null if no matching node can be found
+ */
+ private DefaultMutableTreeNode findNode(DefaultMutableTreeNode node, String name)
+ {
+ if (node.getUserObject().toString().equals(name))
+ return node;
+
+ for (int i = 0; i < node.getChildCount(); i++)
+ {
+ DefaultMutableTreeNode child = findNode((DefaultMutableTreeNode) node.getChildAt(i), name);
+
+ if (child != null)
+ return child;
+ }
+
+ return null;
+ }
+
+ private static DefaultMutableTreeNode getChildWithName(DefaultMutableTreeNode currentNode, String name)
{
- for (int count=0;count<currentNode.getChildCount();count++)
+ for (int count=0;count<currentNode.getChildCount();count++)
{
- String currentName = (String)((DefaultMutableTreeNode)currentNode.getChildAt(count)).getUserObject();
+ String currentName = ((DefaultMutableTreeNode)currentNode.getChildAt(count)).getUserObject().toString();
if ( name.equals(currentName) )
{
@@ -165,15 +322,29 @@
return null;
}
+ /**
+ * Triggered when the object store root combo is changed
+ *
+ * @param e the triggering action containing the name of the target store root
+ */
public void actionPerformed(ActionEvent e)
{
String commandAction = e.getActionCommand();
if ( commandAction != null )
{
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
String objectStoreRoot = (String)_rootCombo.getSelectedItem();
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ _stateViewer.clear();
+ _stateViewer.setVisible(false);
_objectStore = new ObjectStore(new com.arjuna.ats.arjuna.gandiva.ClassName(objectStoreRoot));
_treeModel.setRoot(createTree());
+
+ Thread.currentThread().setContextClassLoader(loader);
+
}
}
@@ -187,7 +358,7 @@
if (_objectStore.allTypes(types))
{
- String theName = null;
+ String theName;
try
{
@@ -203,7 +374,7 @@
{
SubTreeNode childNode;
DefaultMutableTreeNode currentNode = rootNode;
- String parseName = new String(theName);
+ String parseName = theName;
if ( parseName.indexOf(GROUP_DELIMITER) != -1 )
{
@@ -239,7 +410,7 @@
}
catch (Exception e)
{
- JOptionPane.showMessageDialog(this, "An error occurred while creating the object browser tree");
+ _stateViewer.reportError("An error occurred while creating the object browser tree");
System.err.println("Caught unexpected exception: " + e);
e.printStackTrace(System.err);
}
@@ -265,13 +436,13 @@
public void valueChanged(TreeSelectionEvent e)
{
TreePath selectedPath = e.getPath();
- String theName = "";
+ String theName = getPathName(selectedPath);
- for (int count=1;count<selectedPath.getPathCount();count++)
- {
- theName += ((String)((DefaultMutableTreeNode)selectedPath.getPathComponent(count)).getUserObject()) + GROUP_DELIMITER;
- }
+ _stateViewer.clearStatus();
+ if (e.getNewLeadSelectionPath() == null)
+ return; // the whole tree is going to change so bail out early
+
try
{
DefaultMutableTreeNode node = (DefaultMutableTreeNode)e.getPath().getLastPathComponent();
@@ -298,16 +469,13 @@
private void updateTreePath(TreePath path)
{
- String pathPrefix = "";
+ String pathPrefix = getPathName(path);
DefaultMutableTreeNode lastNode = (DefaultMutableTreeNode)path.getLastPathComponent();
- // Skip the root node as it is not part of the underlying object store tree
- for (int count=1;count<path.getPathCount();count++)
- {
- pathPrefix += (String)((DefaultMutableTreeNode)path.getPathComponent(count)).getUserObject() + GROUP_DELIMITER;
- }
updateTreeNode(lastNode, pathPrefix);
+ _stateViewer.setVisible(false);
+
if ( lastNode instanceof ListNode )
{
if ( ((ListNode)lastNode).getListNodeListener() != null )
@@ -332,7 +500,7 @@
}
catch (ObjectStoreException e)
{
- JOptionPane.showMessageDialog(this, "An error occurred while creating the state viewer");
+ _stateViewer.reportError("An error occurred while creating the state viewer");
e.printStackTrace(System.err);
}
}
@@ -429,7 +597,7 @@
{
UidNode uidNode;
- if ( getChildWithName(node, theName) == null )
+ if ( getChildWithName(node, theUid.stringForm()) == null )
{
_treeModel.insertNodeInto(uidNode = new UidNode(theUid.toString(), theUid, theName), node, _treeModel.getChildCount(node));
uidNode.setIconPanelEntry(new ObjectViewEntry(theName, theUid.toString(), _objectStore.currentState(theUid, theName), uidNode));
@@ -466,14 +634,22 @@
}
}
-
+ /**
+ * Initialize the object view panel in response to the user selected a new tree node
+ * each view panel entry should have already been initialized during the call to
+ * updateTreePath (provided the clicked node is of type UidNode and there is a viewer
+ * registered against the object store type - NB viewers are defined in the jar manifest
+ * for the tool).
+ *
+ * @param theName the object store path name (aka type) of the selected node
+ * @param parentNode the selected tree node
+ */
private void setupObjectViewPanel(String theName, DefaultMutableTreeNode parentNode)
{
- if ( theName.length() > 0 )
+ if ( theName.length() > 0 )
{
/** Reset the icons **/
_objectView.resetIcons();
-
/** Add the icons for each node in the tree **/
for (int count=0;count<_treeModel.getChildCount(parentNode);count++)
{
@@ -500,20 +676,22 @@
{
if ( _objectView.getSelectedEntry() == null )
{
- _stateViewer.removeAll();
- validate();
- repaint();
+ _stateViewer.setVisible(false);
+// _stateViewer.removeAll();
+// validate();
+// repaint();
}
if ( selected )
{
- // Do nothing
+ _stateViewer.setVisible(true);
+ // Do nothing
}
}
catch (Exception e)
{
e.printStackTrace(System.err);
- JOptionPane.showMessageDialog(this, "An error occurred while creating the state viewer");
+ _stateViewer.reportError("An error occurred while creating the state viewer");
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StatePanel.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StatePanel.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StatePanel.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -36,19 +36,36 @@
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
+import java.util.Map;
+import java.util.HashMap;
public class StatePanel extends JPanel implements ActionListener
{
private final static String TYPE_LABEL_TEXT = "Type:";
private final static String INFO_LABEL_TEXT = "Information:";
- private final static String DETAILS_BUTTON_TEXT = "details";
+
+ public final static String DETAILS_BUTTON_TEXT = "details";
+ public final static String FORGET_BUTTON_TEXT = "forget";
+ public final static String COMMIT_BUTTON_TEXT = "commit";
+ public final static String ROLLBACK_BUTTON_TEXT = "rollback";
+ private final static Map<String, String> BUTTONS;
+
+ static {
+ BUTTONS = new HashMap<String, String> ();
+
+ BUTTONS.put(DETAILS_BUTTON_TEXT, "Show more information");
+ BUTTONS.put(FORGET_BUTTON_TEXT, "Forget this item");
+ BUTTONS.put(COMMIT_BUTTON_TEXT, "Commit the item");
+ BUTTONS.put(ROLLBACK_BUTTON_TEXT, "Rollback the item");
+ }
+
private JLabel _type;
private JLabel _info;
+ private JLabel _statusBar;
private DefaultTableModel _tableModel;
- private JTable _table;
- private JButton _detailsButton;
- private DetailsButtonListener _detailsListener;
+ private StateTable _table;
+ private Map<String, JButton> _buttons = new HashMap<String, JButton>();
public StatePanel()
{
@@ -93,7 +110,7 @@
JPanel panel = new JPanel();
panel.setBorder(javax.swing.border.LineBorder.createBlackLineBorder());
- _table = new JTable(_tableModel = new DefaultTableModel(0,2));
+ _table = new StateTable(_tableModel = new DefaultTableModel(0,2));
panel.setLayout(new BorderLayout());
panel.add(BorderLayout.CENTER, _table);
gbc.gridy++;
@@ -103,15 +120,68 @@
gbl.addLayoutComponent(panel, gbc);
add(panel);
- _detailsButton = new JButton(DETAILS_BUTTON_TEXT);
+ JPanel buttonPanel = new JPanel();
+
+ for (Map.Entry<String, String> e : BUTTONS.entrySet())
+ buttonPanel.add(newButton(e.getKey(), e.getValue(), false, this));
+
+ gbc.fill = GridBagConstraints.NONE;
gbc.gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbl.addLayoutComponent(_detailsButton, gbc);
- _detailsButton.addActionListener(this);
- _detailsButton.setEnabled(false);
- add(_detailsButton);
+ gbl.addLayoutComponent(buttonPanel, gbc);
+ add(buttonPanel);
}
+ /**
+ * Create a new button. Note this does not add the button to the panel which
+ * is the callers responsibility
+ *
+ * @param text button text
+ * @param tooltip button tooltip
+ * @param enable if true the button is enabled and made visible
+ * @param listener
+ * @return the newly added button
+ */
+ private JButton newButton(String text, String tooltip, boolean enable, ActionListener listener)
+ {
+ JButton button = new JButton(text);
+
+ button.setToolTipText(tooltip);
+ _buttons.put(text, button);
+ enableButtons(enable, listener, text);
+
+ return button;
+ }
+
+ /**
+ * Initialise a collection of buttons. Any existing listeners will be removed.
+ *
+ * @param enable if true enable the button and make it visible
+ * @param listener the action
+ * @param buttons button (these must correspond to a previously registered button)
+ */
+ public void enableButtons(boolean enable, ActionListener listener, String ... buttons)
+ {
+ for (String name : buttons)
+ {
+ JButton button = _buttons.get(name);
+
+ if (button != null)
+ {
+ for (ActionListener l : button.getActionListeners())
+ button.removeActionListener(l);
+
+ button.addActionListener(listener);
+ button.setEnabled(enable);
+ button.setVisible(enable);
+ }
+ }
+ }
+
+ public void enableButton(String buttonName, ActionListener listener)
+ {
+ enableButtons(true, listener, buttonName);
+ }
+
public void setType(String type)
{
_type.setText(type);
@@ -128,18 +198,34 @@
_table.invalidate();
}
- public void enableDetailsButton(DetailsButtonListener listener)
+ /**
+ * Add headers for the table in the state panel
+ * @param name first column
+ * @param value second column
+ */
+ public void setTableHeader(String name, String value)
{
- _detailsButton.setEnabled(true);
- _detailsListener = listener;
+ _table.shadeHeaders(true);
+ _tableModel.insertRow(0, new String[] { name, value });
}
+ /**
+ * Size the columns to accomodate the data (ie shrink to largest data size or expand
+ * to largest data size up to a maximum)
+ */
+ public void updateColumnSizes()
+ {
+ _table.updateColumnSizes();
+ }
+
public void clear()
{
_type.setText("");
_info.setText("");
- _detailsListener = null;
- _detailsButton.setEnabled(false);
+ _table.shadeHeaders(false);
+ enableButtons(false, null, _buttons.keySet().toArray(new String[_buttons.size()]));
+ clearStatus();
+
while ( _table.getRowCount() > 0 )
{
_tableModel.removeRow(0);
@@ -148,11 +234,50 @@
public void actionPerformed(ActionEvent e)
{
- String actionCommand = e.getActionCommand();
+ }
- if ( actionCommand != null && actionCommand.equals(DETAILS_BUTTON_TEXT) )
+ public void setStatusBar(JLabel statusBar)
+ {
+ this._statusBar = statusBar;
+ }
+
+ public void reportStatus(String message)
+ {
+ if (_statusBar != null)
+ _statusBar.setText(message);
+ }
+
+ public void reportError(String message)
+ {
+ reportStatus(message);
+ }
+
+ public int reportStatus(String message, int severity)
+ {
+ switch (severity)
{
- _detailsListener.detailsButtonPressed();
+ case JOptionPane.ERROR_MESSAGE:
+ JOptionPane.showMessageDialog(this, message, "Error", severity);
+ break;
+ case JOptionPane.INFORMATION_MESSAGE:
+ JOptionPane.showMessageDialog(this, message, "Information", severity);
+ break;
+ case JOptionPane.WARNING_MESSAGE:
+ JOptionPane.showMessageDialog(this, message, "Warning", severity);
+ break;
+ case JOptionPane.QUESTION_MESSAGE:
+ return JOptionPane.showConfirmDialog(this, message);
+ case JOptionPane.PLAIN_MESSAGE:
+ //FALLTHRU
+ default:
+ break;
}
+
+ return JOptionPane.OK_OPTION;
}
+
+ public void clearStatus()
+ {
+ reportStatus("");
+ }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StateTable.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StateTable.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/panels/StateTable.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.panels;
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableModel;
+import javax.swing.table.TableColumnModel;
+import java.awt.*;
+
+/**
+ * JTable for displaying name value pairs.
+ */
+public class StateTable extends JTable
+{
+ boolean shadeHeaders = false;
+
+ public StateTable(DefaultTableModel defaultTableModel)
+ {
+ super(defaultTableModel);
+ }
+
+ /**
+ * Add a header and tooltips for the table.
+ */
+ public Component prepareRenderer(TableCellRenderer renderer,
+ int rowIndex, int vColIndex)
+ {
+ Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
+
+ if (c instanceof JComponent) {
+ JComponent jc = (JComponent) c;
+ jc.setToolTipText((String) getValueAt(rowIndex, vColIndex));
+
+ if (shadeHeaders && rowIndex == 0)
+ jc.setBackground(Color.LIGHT_GRAY);
+ else
+ jc.setBackground(Color.WHITE);
+ }
+
+ return c;
+ }
+
+ /**
+ * Update the column widths to accomodate the data in the cells
+ * (this will either shrink or expand the column depending
+ * upon the with of the text in the cells)
+ */
+ public void updateColumnSizes()
+ {
+ TableModel model = getModel();
+ TableColumnModel colModel = getColumnModel();
+ FontMetrics metrics = getGraphics().getFontMetrics();
+ int[] maxWidths = new int[model.getColumnCount()];
+
+ // find the maximum width needed for each column
+ for (int i = 0; i < model.getColumnCount(); i++)
+ {
+ for (int j = 0; j < model.getRowCount(); j++)
+ {
+ int width = metrics.stringWidth((String) model.getValueAt(j, i));
+
+ if (maxWidths[i] < width)
+ maxWidths[i] = width;
+ }
+ }
+
+ for (int i = 0; i < maxWidths.length; i++)
+ colModel.getColumn(i).setPreferredWidth(maxWidths[i]);
+ }
+
+ /**
+ * Set a flag to decide whether the first table row should be shaded.
+ *
+ * @param shadeHeaders if true the first row will be shaded
+ */
+ void shadeHeaders(boolean shadeHeaders)
+ {
+ this.shadeHeaders = shadeHeaders;
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/ObjectStoreRootProvider.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/ObjectStoreRootProvider.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/ObjectStoreRootProvider.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -48,4 +48,5 @@
* @return
*/
public Vector getRoots();
+ void addRoot(String name);
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxInputObjectState.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxInputObjectState.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxInputObjectState.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.rootprovider;
+
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.arjuna.common.Uid;
+
+/**
+ * Wrapper for entries representing transactions read from an object store
+ */
+public class TxInputObjectState extends InputObjectState
+{
+ Object realObject;
+
+ public TxInputObjectState(InputObjectState copyFrom)
+ {
+ super(copyFrom);
+ }
+
+ public TxInputObjectState(OutputObjectState copyFrom)
+ {
+ super(copyFrom);
+ }
+
+ public TxInputObjectState(Uid newUid, String tName, byte[] buff)
+ {
+ super(newUid, tName, buff);
+ }
+
+ public Object getRealObject()
+ {
+ return realObject;
+ }
+
+ public void setRealObject(Object realObject)
+ {
+ this.realObject = realObject;
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/providers/DefaultRootProvider.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/providers/DefaultRootProvider.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/providers/DefaultRootProvider.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -39,11 +39,11 @@
public class DefaultRootProvider implements ObjectStoreRootProvider
{
- public Vector getRoots()
+ Vector roots = new Vector();
+
+ public DefaultRootProvider()
{
File objectStoreRoot = new File(arjPropertyManager.getPropertyManager().getProperty(Environment.OBJECTSTORE_DIR,"."));
- Vector roots = new Vector();
-
File[] files = objectStoreRoot.listFiles();
if ( files != null )
@@ -56,7 +56,15 @@
}
}
}
+ }
+ public Vector getRoots()
+ {
return roots;
}
+
+ public void addRoot(String name)
+ {
+ roots.add(name);
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/StateViewersRepository.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/StateViewersRepository.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/StateViewersRepository.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -33,6 +33,8 @@
import com.arjuna.ats.tools.objectstorebrowser.PluginClassloader;
import java.util.Hashtable;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.io.File;
/**
@@ -45,17 +47,18 @@
{
private final static String STATE_VIEWER_JAR_PREFIX = "osbv-";
private final static String JAR_MANIFEST_SECTION_NAME = "arjuna-tools-objectstorebrowser";
+ private final static String DEFAULT_ABSTRACT_RECORD_VIEWER = "com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord.AbstractRecordViewer";
-
/** Store objectTypeName to stateViewer mappings **/
- private static Hashtable _stateViewers = new Hashtable();
- private static Hashtable _abstractRecordStateViewers = new Hashtable();
+ private static ConcurrentMap _stateViewers = new ConcurrentHashMap();
+ private static ConcurrentMap _abstractRecordStateViewers = new ConcurrentHashMap();
private static StateViewerInterface _defaultStateViewer = null;
public static void registerStateViewer(String objectTypeName, StateViewerInterface stateViewer) throws ViewerAlreadyRegisteredException
{
-
+ _stateViewers.putIfAbsent( objectTypeName, stateViewer );
/** If stateviewer already registered then throw an exception **/
+ /*
if ( !_stateViewers.containsKey(objectTypeName) )
{
_stateViewers.put( objectTypeName, stateViewer );
@@ -64,11 +67,14 @@
{
throw new ViewerAlreadyRegisteredException("A viewer is already registered for object type '"+objectTypeName+"'");
}
+ */
}
public static void registerAbstractRecordStateViewer(String type, AbstractRecordStateViewerInterface stateViewer) throws ViewerAlreadyRegisteredException
{
+ _abstractRecordStateViewers.putIfAbsent(type,stateViewer);
/** If the state viewer is already registered then throw an exception **/
+ /*
if ( !_abstractRecordStateViewers.containsKey(type) )
{
_abstractRecordStateViewers.put( type, stateViewer );
@@ -77,6 +83,7 @@
{
throw new ViewerAlreadyRegisteredException("A viewer is already registered for object type '"+type+"'");
}
+ */
}
public static void setDefaultStateViewer(StateViewerInterface svi)
@@ -88,14 +95,28 @@
{
StateViewerInterface svi = (StateViewerInterface)_stateViewers.get(objectTypeName);
- /** If the object type is not registered then return the default svi **/
- return ( svi == null ) ? _defaultStateViewer : svi;
+ /** If the object type is not registered then look for a more generic viewer **/
+ if (svi == null)
+ {
+ // determine where the last component starts (assumes objectTypeName != null)
+ int i = objectTypeName.substring(0, objectTypeName.length() - 1).lastIndexOf('/');
+
+ if (i == -1)
+ return _defaultStateViewer; // no more components so return the default viewer
+ else
+ return lookupStateViewer(objectTypeName.substring(0, i + 1));
+ }
+ else
+ return svi;
}
public static AbstractRecordStateViewerInterface lookupAbstractRecordStateViewer(String type)
{
AbstractRecordStateViewerInterface svi = (AbstractRecordStateViewerInterface)_abstractRecordStateViewers.get(type);
+ if (svi == null)
+ return (AbstractRecordStateViewerInterface)_abstractRecordStateViewers.get(DEFAULT_ABSTRACT_RECORD_VIEWER);
+
return svi;
}
@@ -136,4 +157,10 @@
throw new ExceptionInInitializerError("Failed to initiate object state viewers: "+e);
}
}
+
+ public static void disposeRepository()
+ {
+ _stateViewers.clear();
+ _abstractRecordStateViewers.clear();
+ }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/ArjunaTransactionWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/ArjunaTransactionWrapper.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/ArjunaTransactionWrapper.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.gandiva.ObjectName;
+
+import java.util.Collection;
+import java.util.Collections;
+
+public class ArjunaTransactionWrapper extends BasicAction implements BasicActionInfo
+{
+ private String type;
+
+ public ArjunaTransactionWrapper(Uid objUid, ObjectName objectName, String type)
+ {
+ super(objUid, ObjectType.ANDPERSISTENT, objectName);
+ this.type = type;
+ }
+
+ /**
+ * Overloads StateManager.type()
+ */
+ public String type()
+ {
+ return type; //ArjunaTransactionImple.typeName();
+ }
+
+ public RecordList getFailedList()
+ {
+ return failedList;
+ }
+
+ public RecordList getHeuristicList()
+ {
+ return heuristicList;
+ }
+
+ public RecordList getPendingList()
+ {
+ return pendingList;
+ }
+
+ public RecordList getPreparedList()
+ {
+ return preparedList;
+ }
+
+ public RecordList getReadOnlyList()
+ {
+ return readonlyList;
+ }
+
+ public UidInfo getUidInfo()
+ {
+ return new UidInfo(get_uid(), getClass().getName() + "@" + Integer.toHexString(hashCode()));
+ }
+
+ public int getTxTimeout()
+ {
+ return -1;
+ }
+
+ /**
+ * Return the Arjuna concept of the transaction status
+ * (as opposed to javax transaction Status
+ * @see javax.transaction.Status
+ * @return
+ */
+ public int getStatus()
+ {
+ return super.status();
+ }
+
+ public Collection<SynchronizationInfo> getSynchronizationInfo()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public Collection<XAResourceInfo> getResources()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public void remove() throws ObjectStoreException
+ {
+ if (!getStore().remove_committed(getSavingUid(), type()))
+ throw new ObjectStoreException();
+ }
+
+ public boolean isLive()
+ {
+ return false;
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/BasicActionInfo.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/BasicActionInfo.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/BasicActionInfo.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+
+import java.util.Collection;
+
+/**
+ * Interface to abstract the differences between JTA and JTS
+ * actions.
+ */
+public interface BasicActionInfo
+{
+ RecordList getFailedList();
+ RecordList getHeuristicList();
+ RecordList getPendingList();
+ RecordList getPreparedList();
+ RecordList getReadOnlyList();
+ UidInfo getUidInfo();
+ int getTxTimeout();
+ int getStatus();
+ Collection<SynchronizationInfo> getSynchronizationInfo();
+ Collection<XAResourceInfo> getResources();
+ boolean activate();
+ boolean deactivate();
+ Uid get_uid();
+ String type();
+ void remove() throws ObjectStoreException;
+ boolean isLive();
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationInfo.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationInfo.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationInfo.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+public class SynchronizationInfo extends UidInfo
+{
+ public SynchronizationInfo(Uid uid, String instanceName)
+ {
+ super(uid, instanceName);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+
+/**
+ * A node representing a synchronisation that has been registered with a transaction
+ */
+public class SynchronizationListNode extends ListNode implements ListNodeListener, IconSelectionListener
+{
+ public SynchronizationListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ /**
+ ** Called when the list node is expanded
+ ** @param node the selected node
+ **/
+ public void listExpanded(ListNode node)
+ {
+ super.listExpanded(node);
+
+ ArjunaTransactionWrapper aaw = (ArjunaTransactionWrapper) this.getAssObject();
+ int i = 0;
+
+ for (SynchronizationInfo si : aaw.getSynchronizationInfo())
+ {
+ ListEntryNode entryNode = new ListEntryNode("[" + i + "] " + si.getInstanceName(), si, "synchronisation");
+ ObjectStoreViewEntry icon = new ObjectStoreViewEntry(aaw.type(), entryNode.getUserObject().toString(), entryNode);
+
+ node.createEntry(entryNode);
+ entryNode.setIconPanelEntry(icon);
+ icon.addSelectionListener(this);
+
+ i += 1;
+ }
+ }
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
+ SynchronizationInfo si = (SynchronizationInfo) node.getAssociatedObject();
+ StatePanel panel = BrowserFrame.getStatePanel();
+
+ panel.clear();
+ panel.setType("Synchronization");
+ panel.setInfo(si.getInstanceName());
+
+ panel.setData("Creation Time", UidInfo.formatTime(si.getCreationTime()));
+ panel.setData("Age (seconds)", String.valueOf(si.getAge()));
+
+ panel.updateColumnSizes();
+ panel.repaint();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/SynchronizationViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons.AtomicTransactionViewEntry;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+
+import java.util.Collection;
+
+public class SynchronizationViewEntry extends AtomicTransactionViewEntry //ListViewEntry implements IconSelectionListener
+{
+ public SynchronizationViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+ }
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ StatePanel panel = BrowserFrame.getStatePanel();
+ final SynchronizationListNode node = (SynchronizationListNode) getNode();
+ ArjunaTransactionWrapper aaw = (ArjunaTransactionWrapper) node.getAssObject();
+ Collection<SynchronizationInfo> c = aaw.getSynchronizationInfo();
+
+ panel.clear();
+ panel.setType(getTypeName());
+ panel.setInfo(c.size() + " entries");
+ panel.setTableHeader("Uid", "Instance Name");
+
+ for (SynchronizationInfo si : c)
+ panel.setData(si.getUid().stringForm(), si.getInstanceName());
+
+ if (c.size() != 0)
+ {
+ enableDetailsButton(panel, node);
+ panel.updateColumnSizes();
+ }
+
+ panel.repaint();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
+import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+
+import javax.swing.*;
+import javax.swing.tree.TreePath;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class TxInfoNode extends ListNode implements ListNodeListener, IconSelectionListener
+{
+ public TxInfoNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ public void listExpanded(ListNode node)
+ {
+ super.listExpanded(node);
+
+ BasicActionInfo aaw = getAction();
+ ListEntryNode entryNode = new ListEntryNode(aaw.get_uid(), aaw, getType());
+ ObjectStoreViewEntry icon = new ObjectStoreViewEntry(aaw.type(), entryNode.getUserObject().toString(), entryNode);
+
+ node.createEntry(entryNode);
+ entryNode.setIconPanelEntry(icon);
+ icon.addSelectionListener(this);
+ }
+
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+
+ StatePanel panel = BrowserFrame.getStatePanel();
+
+ updatePanel(panel);
+ }
+
+ public void updatePanel(StatePanel panel)
+ {
+ BasicActionInfo aaw = getAction();
+ UidInfo uidInfo = aaw.getUidInfo();
+
+ panel.clear();
+ panel.setType(aaw.type());
+ panel.setInfo(aaw.get_uid().stringForm());
+
+ panel.setData("Creation Time", UidInfo.formatTime(uidInfo.getCreationTime()));
+ panel.setData("Age (seconds)", String.valueOf(uidInfo.getAge()));
+ panel.setData("Status", jtaStatusToString(aaw.getStatus()));
+ panel.setData("Timeout", String.valueOf(aaw.getTxTimeout()));
+
+ panel.updateColumnSizes();
+
+ if (!isLive())
+ enableDetails(panel);
+
+ panel.repaint();
+ }
+
+ public BasicActionInfo getAction()
+ {
+ return (BasicActionInfo) getAssObject();
+ }
+
+ private void enableDetails(final StatePanel panel)
+ {
+ panel.enableButton(StatePanel.FORGET_BUTTON_TEXT, new ActionListener() {
+ public void actionPerformed(ActionEvent ae)
+ {
+ String cmd = ae.getActionCommand();
+
+ if (cmd != null)
+ {
+ int res = JOptionPane.showConfirmDialog(panel, "This operation will permanently remove the transaction. Do you wish to continue?");
+
+ if (res == JOptionPane.YES_OPTION)
+ {
+ try
+ {
+ getAction().remove();
+
+ // the node should no longer exist so collapse the tree up to its parent.
+ if (getParent().getParent() != null)
+ {
+ TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(getParent().getParent()));
+ BrowserFrame.getTree().collapsePath(path);
+ BrowserFrame.getTree().setSelectionPath(path);
+ BrowserFrame.getTree().scrollPathToVisible(path);
+ }
+ }
+ catch (ObjectStoreException e)
+ {
+ panel.reportStatus("Forget failed: " + e.getMessage());
+ }
+ }
+ }
+ }
+ });
+ }
+
+ // copied form JTAHelper (which is not in ArjunaCore
+ public static String jtaStatusToString (int status)
+ {
+ switch (status)
+ {
+ case javax.transaction.Status.STATUS_ACTIVE:
+ return "javax.transaction.Status.STATUS_ACTIVE";
+ case javax.transaction.Status.STATUS_COMMITTED:
+ return "javax.transaction.Status.STATUS_COMMITTED";
+ case javax.transaction.Status.STATUS_MARKED_ROLLBACK:
+ return "javax.transaction.Status.STATUS_MARKED_ROLLBACK";
+ case javax.transaction.Status.STATUS_NO_TRANSACTION:
+ return "javax.transaction.Status.STATUS_NO_TRANSACTION";
+ case javax.transaction.Status.STATUS_PREPARED:
+ return "javax.transaction.Status.STATUS_PREPARED";
+ case javax.transaction.Status.STATUS_ROLLEDBACK:
+ return "javax.transaction.Status.STATUS_ROLLEDBACK";
+ case javax.transaction.Status.STATUS_UNKNOWN:
+ default:
+ return "javax.transaction.Status.STATUS_UNKNOWN";
+ }
+ }
+
+ public boolean isLive()
+ {
+ return ((BasicActionInfo) getAssObject()).isLive();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/TxInfoViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+
+public class TxInfoViewEntry extends ListViewEntry implements IconSelectionListener
+{
+ public TxInfoViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+
+ addSelectionListener(this);
+ }
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ TxInfoNode node = (TxInfoNode) getNode();
+
+ node.updatePanel(BrowserFrame.getStatePanel());
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/UidInfo.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/UidInfo.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/UidInfo.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.state.OutputBuffer;
+import com.arjuna.ats.arjuna.state.InputBuffer;
+import com.arjuna.ats.tools.objectstorebrowser.UidConverter;
+
+import javax.transaction.xa.Xid;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.io.IOException;
+
+/**
+ * Base class for representing common state relevant to Uid's and Xid's
+ */
+public class UidInfo
+{
+ private static DateFormat formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
+ private static UidConverter uidConverter;
+
+ public static void setUidConverter(UidConverter uidConverter)
+ {
+ UidInfo.uidConverter = uidConverter;
+ }
+
+ private Uid uid;
+ private String instanceName;
+ private Long creationTime;
+
+ public UidInfo(Uid uid, String instanceName)
+ {
+ this.uid = uid;
+ this.instanceName = instanceName;
+ }
+
+ public Uid getUid()
+ {
+ return uid;
+ }
+
+ public String getInstanceName()
+ {
+ return instanceName;
+ }
+
+ public long getCreationTime()
+ {
+ if (creationTime == null)
+ creationTime = getCreationTime(uid);
+
+ return creationTime;
+ }
+
+ public long getAge()
+ {
+ return (getCreationTime() < 0 ? -1 : (System.currentTimeMillis() / 1000) - getCreationTime());
+ }
+
+ // static utility methods
+ public static String formatTime(long seconds)
+ {
+ return seconds < 0 ? "" : formatter.format(new Date(seconds * 1000L));
+ }
+
+ public static Uid toUid(Xid xid)
+ {
+ return uidConverter.toUid(xid);
+ }
+
+ public static long getCreationTime(Xid xid)
+ {
+ return getCreationTime(toUid(xid));
+ }
+
+ public static long getCreationTime(Uid uid)
+ {
+ if (uid != null)
+ {
+ try
+ {
+ OutputBuffer outBuf = new OutputBuffer();
+ InputBuffer inBuf;
+
+ uid.pack(outBuf);
+ inBuf = new InputBuffer(outBuf.buffer());
+
+ //host = inet4AddressToString(inBuf.unpackInt());
+ inBuf.unpackInt();
+ inBuf.unpackInt(); // process
+
+ return inBuf.unpackInt();
+// int other = inBuf.unpackInt();
+ }
+ catch (IOException e)
+ {
+ }
+ }
+
+ return -1;
+ }
+
+ private static String inet4AddressToString(int ip)
+ {
+ StringBuffer sb = new StringBuffer(15);
+
+ for (int shift=24; shift > 0; shift -= 8)
+ {
+ sb.append( Integer.toString((ip >>> shift) & 0xff)).append('.');
+ }
+
+ return sb.append( Integer.toString(ip & 0xff)).toString();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceInfo.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceInfo.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceInfo.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+
+public class XAResourceInfo extends UidInfo
+{
+ private String txState;
+ private String className;
+ private String eisProductName;
+ private String eisProductVersion;
+ private Xid xid;
+ private int timeout;
+
+ public XAResourceInfo(XAResource xares, Xid xid, String txState)
+ {
+ super(toUid(xid), xares.toString());
+
+ this.txState = txState;
+ this.xid = xid;
+ className = xares.getClass().getName();
+// if (xares instanceof org.jboss.jca.spi.xa.XAResourceWrapper)
+ eisProductName = callMethod(xares, "getEISProductName");
+ eisProductVersion = callMethod(xares, "getEISProductVersion");
+
+ try
+ {
+ timeout = xares.getTransactionTimeout();
+ }
+ catch (XAException e)
+ {
+ System.out.println(e.getMessage());
+ timeout = -1;
+ }
+ }
+
+ private String callMethod(Object object, String mName)
+ {
+ try
+ {
+ return (String) object.getClass().getMethod(mName).invoke(object);
+ }
+ catch (NoSuchMethodException e)
+ {
+ // ignore
+ }
+ catch (Exception e)
+ {
+ System.out.println(e);
+ }
+
+ return "";
+ }
+
+ public String getTxState()
+ {
+ return txState;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public String getEisProductName()
+ {
+ return eisProductName;
+ }
+
+ public String getEisProductVersion()
+ {
+ return eisProductVersion;
+ }
+
+ public String getXid()
+ {
+ return xid == null ? "null" : xid.toString();
+ }
+
+ public Object getTimeout()
+ {
+ return timeout;
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.AtomicActionListNode;
+import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+import java.util.Collection;
+
+public class XAResourceListNode extends ListNode implements ListNodeListener, IconSelectionListener
+{
+ public XAResourceListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ public void listExpanded(ListNode node)
+ {
+ super.listExpanded(node);
+
+ ArjunaTransactionWrapper aaw = (ArjunaTransactionWrapper) this.getAssObject();
+ Collection<XAResourceInfo> resources = aaw.getResources();
+ int i = 0;
+
+ for (XAResourceInfo res : resources)
+ {
+ ListEntryNode entryNode = new ListEntryNode("[" + i++ + "] "+ res.getInstanceName(), res, "XA resource");
+ ObjectStoreViewEntry icon = new ObjectStoreViewEntry(aaw.type(), entryNode.getUserObject().toString(), entryNode);
+
+ node.createEntry(entryNode);
+ entryNode.setIconPanelEntry(icon);
+ icon.addSelectionListener(this);
+ }
+ }
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
+ XAResourceInfo xares = (XAResourceInfo)node.getAssociatedObject();
+ StatePanel panel = BrowserFrame.getStatePanel();
+
+ panel.clear();
+ panel.setType("XAResource");
+ panel.setInfo(xares.getInstanceName());
+
+ panel.setData("Creation Time", UidInfo.formatTime(xares.getCreationTime()));
+ panel.setData("Age (seconds)", String.valueOf(xares.getAge()));
+ panel.setData("Instance Name", xares.getInstanceName());
+ panel.setData("Product Name", xares.getEisProductName());
+ panel.setData("Product Version", xares.getEisProductVersion());
+ panel.setData("Tx State", xares.getTxState());
+ panel.setData("Xid", xares.getXid());
+ panel.setData("Timeout", String.valueOf(xares.getTimeout()));
+
+ panel.updateColumnSizes();
+ panel.repaint();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/XAResourceViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons.AtomicTransactionViewEntry;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+
+import java.util.Collection;
+
+public class XAResourceViewEntry extends AtomicTransactionViewEntry
+{
+ public XAResourceViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+
+ addSelectionListener(this);
+ }
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ StatePanel panel = BrowserFrame.getStatePanel();
+ XAResourceListNode node = (XAResourceListNode) getNode();
+ ArjunaTransactionWrapper aaw = (ArjunaTransactionWrapper) node.getAssObject();
+ Collection<XAResourceInfo> c = aaw.getResources();
+
+ panel.clear();
+ panel.setType(getTypeName());
+ panel.setInfo(c.size()+" entries");
+ panel.setTableHeader("Product Name", "Instance Name");
+
+ for (XAResourceInfo xares : c)
+ panel.setData(xares.getEisProductName(), xares.getInstanceName());
+
+ if (c.size() != 0)
+ {
+ enableDetailsButton(panel, node);
+ panel.updateColumnSizes();
+ }
+
+ panel.repaint();
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionViewer.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -35,15 +35,20 @@
import com.arjuna.ats.tools.objectstorebrowser.treenodes.*;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.*;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons.*;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.TxInfoNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.TxInfoViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.ArjunaTransactionWrapper;
import com.arjuna.ats.tools.objectstorebrowser.panels.*;
import com.arjuna.ats.arjuna.objectstore.ObjectStore;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
import com.arjuna.ats.arjuna.common.Uid;
import com.arjuna.ats.arjuna.coordinator.RecordList;
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
import com.arjuna.ats.arjuna.ObjectType;
import javax.swing.tree.*;
+import javax.swing.*;
public class AtomicActionViewer implements StateViewerInterface
{
@@ -63,12 +68,19 @@
{
Uid theUid = uidNode.getUid();
AtomicActionWrapper aaw = new AtomicActionWrapper(theUid);
- aaw.restore_state(os.read_committed(theUid, type), ObjectType.ANDPERSISTENT);
+ if (!activate(aaw))
+ infoPanel.reportStatus("Unable to activate " + theUid);
+
manipulator.clearEntries();
ListNode node;
SubTreeViewEntry entry;
+
+ node = new TxInfoNode("Tx Info", aaw, type);
+ entry = new TxInfoViewEntry(type, "Info", node);
+ addNode(manipulator, node, entry, "Basic Information");
+
manipulator.createEntry(node = new PreparedListNode("Prepared List", aaw, type));
node.setIconPanelEntry(entry = new PreparedViewEntry(type, "Prepared List", node));
entry.setToolTipText(getListSize(aaw.getPreparedList())+" entries");
@@ -95,6 +107,34 @@
node.add(new DefaultMutableTreeNode(""));
}
+ protected void addNode(ObjectStoreBrowserTreeManipulationInterface manipulator,
+ ListNode node, SubTreeViewEntry entry,
+ String tooltip)
+ {
+ manipulator.createEntry(node);
+ node.setIconPanelEntry(entry);
+ entry.setToolTipText(tooltip);
+ node.add(new DefaultMutableTreeNode(""));
+ }
+
+ protected boolean activate(BasicAction action)
+ {
+ return action.activate();
+/*
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ try
+ {
+ return action.activate();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(loader);
+ }
+ */
+ }
/**
* Get the type this state viewer is intended to be registered against.
* @return
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionWrapper.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/AtomicActionWrapper.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -22,8 +22,16 @@
import com.arjuna.ats.arjuna.coordinator.RecordList;
import com.arjuna.ats.arjuna.AtomicAction;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.XAResourceInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.UidInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.SynchronizationInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import java.util.Collection;
+import java.util.Collections;
+
/*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
*
@@ -35,7 +43,7 @@
* $Id: AtomicActionWrapper.java 2342 2006-03-30 13:06:17Z $
*/
-public class AtomicActionWrapper extends AtomicAction
+public class AtomicActionWrapper extends AtomicAction implements BasicActionInfo
{
public AtomicActionWrapper(Uid objUid)
{
@@ -66,4 +74,46 @@
{
return readonlyList;
}
+
+ public UidInfo getUidInfo()
+ {
+ return new UidInfo(get_uid(), getClass().getName() + "@" + Integer.toHexString(hashCode()));
+ }
+
+ public int getTxTimeout()
+ {
+ return getTimeout();
+ }
+
+ /**
+ * Return the Arjuna concept of the transaction status
+ * (as opposed to
+ * @see javax.transaction.Status
+ * @return
+ */
+ public int getStatus()
+ {
+ return super.status();
+ }
+
+ public Collection<SynchronizationInfo> getSynchronizationInfo()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public Collection<XAResourceInfo> getResources()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public void remove() throws ObjectStoreException
+ {
+ if (!getStore().remove_committed(getSavingUid(), type()))
+ throw new ObjectStoreException();
+ }
+
+ public boolean isLive()
+ {
+ return false;
+ }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/AtomicTransactionViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/AtomicTransactionViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/AtomicTransactionViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons;
+
+import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeNode;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class AtomicTransactionViewEntry extends ListViewEntry implements IconSelectionListener
+{
+ public AtomicTransactionViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+
+ addSelectionListener(this);
+ }
+
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ StatePanel panel = BrowserFrame.getStatePanel();
+ final ListNode node = (ListNode) getNode();
+ BasicActionInfo ba = (BasicActionInfo) node.getAssObject();
+ RecordList list = getList(ba);
+
+ panel.clear();
+ panel.setType(getTypeName());
+ panel.setInfo(list.size()+" entries");
+
+ updatePanelData(panel, ba);
+
+ if (list.size() != 0)
+ enableDetailsButton(panel, node);
+
+ panel.repaint();
+ }
+
+ protected void enableDetailsButton(StatePanel panel, final TreeNode node)
+ {
+ panel.enableButton(StatePanel.DETAILS_BUTTON_TEXT, new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
+ BrowserFrame.getTree().expandPath(path);
+ BrowserFrame.getTree().setSelectionPath(path);
+ BrowserFrame.getTree().scrollPathToVisible(path);
+ }
+ });
+ }
+
+ protected void updatePanelData(StatePanel panel, BasicActionInfo wrapper)
+ {
+ }
+
+ protected RecordList getList(BasicActionInfo wrapper)
+ {
+ return emptyList;
+ }
+
+ RecordList emptyList = new RecordList();
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/FailedViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/FailedViewEntry.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/FailedViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -20,18 +20,10 @@
*/
package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.panels.DetailsButtonAdapter;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.FailedListNode;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
-import javax.swing.tree.TreePath;
-
/*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
*
@@ -43,37 +35,15 @@
* $Id: FailedViewEntry.java 2342 2006-03-30 13:06:17Z $
*/
-public class FailedViewEntry extends ListViewEntry implements IconSelectionListener
+public class FailedViewEntry extends AtomicTransactionViewEntry
{
public FailedViewEntry(String tn, String label, ObjectStoreBrowserNode node)
{
super(tn, label, node);
-
- addSelectionListener(this);
}
- /**
- * Called when this entry is selected
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
+ protected RecordList getList(BasicActionInfo wrapper)
{
- /** Populate panel with details of this list **/
- StatePanel panel = BrowserFrame.getStatePanel();
- final FailedListNode node = (FailedListNode)getNode();
- AtomicActionWrapper aaw = (AtomicActionWrapper)node.getAssObject();
- panel.clear();
- panel.setType(getTypeName());
- panel.setInfo(aaw.getFailedList().size()+" entries");
- panel.enableDetailsButton(new DetailsButtonAdapter() {
- public void detailsButtonPressed()
- {
- TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
- BrowserFrame.getTree().expandPath(path);
- BrowserFrame.getTree().setSelectionPath(path);
- }
- });
- panel.repaint();
+ return wrapper.getFailedList();
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/HeuristicViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/HeuristicViewEntry.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/HeuristicViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,48 +31,20 @@
* $Id: HeuristicViewEntry.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.panels.*;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
-import com.arjuna.ats.tools.objectstorebrowser.frames.*;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.*;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
-import javax.swing.tree.*;
-
-public class HeuristicViewEntry extends ListViewEntry implements IconSelectionListener
+public class HeuristicViewEntry extends AtomicTransactionViewEntry
{
public HeuristicViewEntry(String tn, String label, ObjectStoreBrowserNode node)
{
super(tn, label, node);
-
- addSelectionListener(this);
}
- /**
- * Called when this entry is selected
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
+ protected RecordList getList(BasicActionInfo wrapper)
{
- /** Populate panel with details of this list **/
- StatePanel panel = BrowserFrame.getStatePanel();
- final HeuristicListNode node = (HeuristicListNode)getNode();
- AtomicActionWrapper aaw = (AtomicActionWrapper)node.getAssObject();
- panel.clear();
- panel.setType(getTypeName());
- panel.setInfo(aaw.getHeuristicList().size()+" entries");
- panel.enableDetailsButton(new DetailsButtonAdapter() {
- public void detailsButtonPressed()
- {
- TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
- BrowserFrame.getTree().expandPath(path);
- BrowserFrame.getTree().setSelectionPath(path);
- }
- });
- panel.repaint();
+ return wrapper.getHeuristicList();
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PendingViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PendingViewEntry.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PendingViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -20,18 +20,10 @@
*/
package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.panels.DetailsButtonAdapter;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.PendingListNode;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
-import javax.swing.tree.TreePath;
-
/*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
*
@@ -42,37 +34,15 @@
*
* $Id: PendingViewEntry.java 2342 2006-03-30 13:06:17Z $
*/
-public class PendingViewEntry extends ListViewEntry implements IconSelectionListener
+public class PendingViewEntry extends AtomicTransactionViewEntry
{
public PendingViewEntry(String tn, String label, ObjectStoreBrowserNode node)
{
super(tn, label, node);
-
- addSelectionListener(this);
}
- /**
- * Called when this entry is selected
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
+ protected RecordList getList(BasicActionInfo wrapper)
{
- /** Populate panel with details of this list **/
- StatePanel panel = BrowserFrame.getStatePanel();
- final PendingListNode node = (PendingListNode)getNode();
- AtomicActionWrapper aaw = (AtomicActionWrapper)node.getAssObject();
- panel.clear();
- panel.setType(getTypeName());
- panel.setInfo(aaw.getPendingList().size()+" entries");
- panel.enableDetailsButton(new DetailsButtonAdapter() {
- public void detailsButtonPressed()
- {
- TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
- BrowserFrame.getTree().expandPath(path);
- BrowserFrame.getTree().setSelectionPath(path);
- }
- });
- panel.repaint();
+ return wrapper.getPendingList();
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PreparedViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PreparedViewEntry.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/PreparedViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -20,18 +20,12 @@
*/
package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.panels.DetailsButtonAdapter;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.PreparedListNode;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
-import javax.swing.tree.TreePath;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
/*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
*
@@ -42,37 +36,15 @@
*
* $Id: PreparedViewEntry.java 2342 2006-03-30 13:06:17Z $
*/
-public class PreparedViewEntry extends ListViewEntry implements IconSelectionListener
+public class PreparedViewEntry extends AtomicTransactionViewEntry
{
public PreparedViewEntry(String tn, String label, ObjectStoreBrowserNode node)
{
super(tn, label, node);
-
- addSelectionListener(this);
}
- /**
- * Called when this entry is selected
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
+ protected RecordList getList(BasicActionInfo wrapper)
{
- /** Populate panel with details of this list **/
- StatePanel panel = BrowserFrame.getStatePanel();
- final PreparedListNode node = (PreparedListNode)getNode();
- AtomicActionWrapper aaw = (AtomicActionWrapper)node.getAssObject();
- panel.clear();
- panel.setType(getTypeName());
- panel.setInfo(aaw.getPreparedList().size()+" entries");
- panel.enableDetailsButton(new DetailsButtonAdapter() {
- public void detailsButtonPressed()
- {
- TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
- BrowserFrame.getTree().expandPath(path);
- BrowserFrame.getTree().setSelectionPath(path);
- }
- });
- panel.repaint();
+ return wrapper.getPreparedList();
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/ReadOnlyViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/ReadOnlyViewEntry.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/icons/ReadOnlyViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -20,18 +20,10 @@
*/
package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ListViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.panels.DetailsButtonAdapter;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.nodes.ReadOnlyListNode;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
-import javax.swing.tree.TreePath;
-
/*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
*
@@ -43,37 +35,15 @@
* $Id: ReadOnlyViewEntry.java 2342 2006-03-30 13:06:17Z $
*/
-public class ReadOnlyViewEntry extends ListViewEntry implements IconSelectionListener
+public class ReadOnlyViewEntry extends AtomicTransactionViewEntry
{
public ReadOnlyViewEntry(String tn, String label, ObjectStoreBrowserNode node)
{
super(tn, label, node);
-
- addSelectionListener(this);
}
- /**
- * Called when this entry is selected
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
+ protected RecordList getList(BasicActionInfo wrapper)
{
- /** Populate panel with details of this list **/
- StatePanel panel = BrowserFrame.getStatePanel();
- final ReadOnlyListNode node = (ReadOnlyListNode)getNode();
- AtomicActionWrapper aaw = (AtomicActionWrapper)node.getAssObject();
- panel.clear();
- panel.setType(getTypeName());
- panel.setInfo(aaw.getReadOnlyList().size()+" entries");
- panel.enableDetailsButton(new DetailsButtonAdapter() {
- public void detailsButtonPressed()
- {
- TreePath path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
- BrowserFrame.getTree().expandPath(path);
- BrowserFrame.getTree().setSelectionPath(path);
- }
- });
- panel.repaint();
+ return wrapper.getReadOnlyList();
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/AtomicActionListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/AtomicActionListNode.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/AtomicActionListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -32,22 +32,38 @@
*/
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.IUidCollection;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.StateViewersRepository;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.AbstractRecordStateViewerInterface;
import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.common.Uid;
-public abstract class AtomicActionListNode extends ListNode
+public abstract class AtomicActionListNode extends ListNode implements IUidCollection, ListNodeListener, IconSelectionListener
{
+ private AtomicActionWrapper wrapper;
+
public AtomicActionListNode(Object userObject, Object assObject, String type)
{
super(userObject, assObject, type);
+
+ wrapper = (AtomicActionWrapper) assObject;
}
+ protected BasicActionInfo getAction()
+ {
+ return wrapper; //or (BasicActionInfo) this.getAssObject();
+ }
+
protected void invokeStateViewer(AbstractRecord record, AtomicActionWrapper aaw, IconPanelEntry entry)
{
AbstractRecordStateViewerInterface svi = StateViewersRepository.lookupAbstractRecordStateViewer(record.type());
@@ -68,4 +84,100 @@
System.out.println("Viewer not registered for "+record.type());
}
}
+
+ public boolean remove(Uid uid)
+ {
+ AbstractRecord rec = getList().peekFront();
+
+ while (rec != null)
+ {
+ if (rec.order().equals(uid))
+ return getList().remove(rec);
+
+ rec = getList().peekNext(rec);
+ }
+
+ return false;
+ }
+
+ public boolean contains(Uid uid)
+ {
+ AbstractRecord rec = getList().peekFront();
+
+ while (rec != null)
+ {
+ if (rec.order().equals(uid))
+ return true;
+
+ rec = getList().peekNext(rec);
+ }
+
+ return false;
+ }
+
+ public boolean contains(String uid)
+ {
+ AbstractRecord rec = getList().peekFront();
+
+ while (rec != null)
+ {
+ if (rec.order().stringForm().equals(uid))
+ return true;
+
+ rec = getList().peekNext(rec);
+ }
+
+ return false;
+ }
+
+ /**
+ * Called when the list node is expanded
+ * @param node
+ */
+ public void listExpanded(ListNode node)
+ {
+ super.listExpanded(node);
+
+ AbstractRecord current = getList().peekFront();
+ int count = 1;
+
+ while ( current != null )
+ {
+ ListEntryNode entryNode;
+ ObjectStoreViewEntry icon;
+
+ node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
+ entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(wrapper.type(), (String)entryNode.getUserObject(), entryNode));
+ icon.addSelectionListener(this);
+ current = getList().peekNext(current);
+ count++;
+ }
+ }
+
+ /**
+ * Called when one of the list entries is selected.
+ *
+ * @param icon
+ * @param selected
+ */
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ /** Get node and the associated AbstractRecord **/
+ ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
+ AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
+ StatePanel panel = BrowserFrame.getStatePanel();
+
+ panel.clear();
+ panel.setType(record.type());
+
+ updatePanelData(panel, record);
+
+ invokeStateViewer(record, wrapper, icon);
+
+ panel.repaint();
+ }
+
+ protected void updatePanelData(StatePanel panel, AbstractRecord record)
+ {
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/FailedListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/FailedListNode.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/FailedListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,62 +31,17 @@
* $Id: FailedListNode.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
-public class FailedListNode extends AtomicActionListNode implements ListNodeListener, IconSelectionListener
+public class FailedListNode extends AtomicActionListNode
{
public FailedListNode(Object userObject, Object assObject, String type)
{
super(userObject, assObject, type);
}
- /**
- * Called when the list node is expanded
- * @param node
- */
- public void listExpanded(ListNode node)
+ public RecordList getList()
{
- super.listExpanded(node);
-
- AtomicActionWrapper aaw = (AtomicActionWrapper)this.getAssObject();
- AbstractRecord current = aaw.getFailedList().peekFront();
- int count = 1;
- while ( current != null )
- {
- ListEntryNode entryNode;
- ObjectStoreViewEntry icon;
- node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
- entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(aaw.type(), (String)entryNode.getUserObject(), entryNode));
- icon.addSelectionListener(this);
- current = aaw.getFailedList().peekNext(current);
- count++;
- }
+ return getAction().getFailedList();
}
-
- /**
- * Called when one of the list entries is selected.
- *
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
- {
- /** Get node and the associated AbstractRecord **/
- ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
- AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
- StatePanel panel = BrowserFrame.getStatePanel();
- panel.clear();
- panel.setType(record.type());
- invokeStateViewer(record, (AtomicActionWrapper)this.getAssObject(), icon);
- panel.repaint();
- }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/HeuristicListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/HeuristicListNode.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/HeuristicListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,67 +31,29 @@
* $Id: HeuristicListNode.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.*;
-import com.arjuna.ats.tools.objectstorebrowser.frames.*;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
import com.arjuna.ats.tools.objectstorebrowser.panels.*;
-import com.arjuna.ats.tools.toolsframework.iconpanel.*;
import com.arjuna.ats.arjuna.coordinator.*;
-public class HeuristicListNode extends AtomicActionListNode implements ListNodeListener, IconSelectionListener
+public class HeuristicListNode extends AtomicActionListNode
{
public HeuristicListNode(Object userObject, Object assObject, String type)
{
super(userObject, assObject, type);
}
- /**
- * Called when the list node is expanded
- * @param node
- */
- public void listExpanded(ListNode node)
+ public RecordList getList()
{
- super.listExpanded(node);
-
- AtomicActionWrapper aaw = (AtomicActionWrapper)this.getAssObject();
- AbstractRecord current = aaw.getHeuristicList().peekFront();
- int count = 1;
- while ( current != null )
- {
- ListEntryNode entryNode;
- ObjectStoreViewEntry icon;
- node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
- entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(aaw.type(), (String)entryNode.getUserObject(), entryNode));
- icon.addSelectionListener(this);
- current = aaw.getHeuristicList().peekNext(current);
- count++;
- }
+ return getAction().getHeuristicList();
}
- /**
- * Called when one of the list entries is selected.
- *
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
+ protected void updatePanelData(StatePanel panel, AbstractRecord record)
{
- /** Get node and the associated AbstractRecord **/
- ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
- AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
- StatePanel panel = BrowserFrame.getStatePanel();
- panel.clear();
- panel.setType(record.type());
-
if ( record.value() instanceof HeuristicInformation )
{
HeuristicInformation heuristicInfo = (HeuristicInformation)record.value();
+
panel.setData("Heuristic Type", TwoPhaseOutcome.stringForm(heuristicInfo.getHeuristicType()));
}
-
- invokeStateViewer(record, (AtomicActionWrapper)this.getAssObject(), icon);
-
- panel.repaint();
}
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PendingListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PendingListNode.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PendingListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,16 +31,9 @@
* $Id: PendingListNode.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
public class PendingListNode extends AtomicActionListNode implements ListNodeListener, IconSelectionListener
{
@@ -49,46 +42,8 @@
super(userObject, assObject, type);
}
- /**
- * Called when the list node is expanded
- * @param node
- */
- public void listExpanded(ListNode node)
+ public RecordList getList()
{
- super.listExpanded(node);
-
- AtomicActionWrapper aaw = (AtomicActionWrapper)this.getAssObject();
- AbstractRecord current = aaw.getPendingList().peekFront();
- int count = 1;
- while ( current != null )
- {
- ListEntryNode entryNode;
- ObjectStoreViewEntry icon;
- node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
- entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(aaw.type(), (String)entryNode.getUserObject(), entryNode));
- icon.addSelectionListener(this);
- current = aaw.getPendingList().peekNext(current);
- count++;
- }
+ return getAction().getPendingList();
}
-
- /**
- * Called when one of the list entries is selected.
- *
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
- {
- /** Get node and the associated AbstractRecord **/
- ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
- AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
- StatePanel panel = BrowserFrame.getStatePanel();
- panel.clear();
- panel.setType(record.type());
-
- invokeStateViewer(record, (AtomicActionWrapper)this.getAssObject(), icon);
-
- panel.repaint();
- }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PreparedListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PreparedListNode.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/PreparedListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,16 +31,9 @@
* $Id: PreparedListNode.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
public class PreparedListNode extends AtomicActionListNode implements ListNodeListener, IconSelectionListener
{
@@ -49,46 +42,8 @@
super(userObject, assObject, type);
}
- /**
- * Called when the list node is expanded
- * @param node
- */
- public void listExpanded(ListNode node)
+ public RecordList getList()
{
- super.listExpanded(node);
-
- AtomicActionWrapper aaw = (AtomicActionWrapper)this.getAssObject();
- AbstractRecord current = aaw.getPreparedList().peekFront();
- int count = 1;
- while ( current != null )
- {
- ListEntryNode entryNode;
- ObjectStoreViewEntry icon;
- node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
- entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(aaw.type(), (String)entryNode.getUserObject(), entryNode));
- icon.addSelectionListener(this);
- current = aaw.getPreparedList().peekNext(current);
- count++;
- }
+ return getAction().getPreparedList();
}
-
- /**
- * Called when one of the list entries is selected.
- *
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
- {
- /** Get node and the associated AbstractRecord **/
- ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
- AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
- StatePanel panel = BrowserFrame.getStatePanel();
- panel.clear();
- panel.setType(record.type());
-
- invokeStateViewer(record, (AtomicActionWrapper)this.getAssObject(), icon);
-
- panel.repaint();
- }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/ReadOnlyListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/ReadOnlyListNode.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/nodes/ReadOnlyListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,16 +31,9 @@
* $Id: ReadOnlyListNode.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionWrapper;
-import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
-import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
-import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
public class ReadOnlyListNode extends AtomicActionListNode implements ListNodeListener, IconSelectionListener
{
@@ -49,46 +42,8 @@
super(userObject, assObject, type);
}
- /**
- * Called when the list node is expanded
- * @param node
- */
- public void listExpanded(ListNode node)
+ public RecordList getList()
{
- super.listExpanded(node);
-
- AtomicActionWrapper aaw = (AtomicActionWrapper)this.getAssObject();
- AbstractRecord current = aaw.getReadOnlyList().peekFront();
- int count = 1;
- while ( current != null )
- {
- ListEntryNode entryNode;
- ObjectStoreViewEntry icon;
- node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
- entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(aaw.type(), (String)entryNode.getUserObject(), entryNode));
- icon.addSelectionListener(this);
- current = aaw.getReadOnlyList().peekNext(current);
- count++;
- }
+ return getAction().getReadOnlyList();
}
-
- /**
- * Called when one of the list entries is selected.
- *
- * @param icon
- * @param selected
- */
- public void iconSelected(IconPanelEntry icon, boolean selected)
- {
- /** Get node and the associated AbstractRecord **/
- ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
- AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
- StatePanel panel = BrowserFrame.getStatePanel();
- panel.clear();
- panel.setType(record.type());
-
- invokeStateViewer(record, (AtomicActionWrapper)this.getAssObject(), icon);
-
- panel.repaint();
- }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/treenodes/IUidCollection.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/treenodes/IUidCollection.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/treenodes/IUidCollection.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.treenodes;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+/**
+ * RecordList wrapper
+ */
+public interface IUidCollection
+{
+ boolean contains(Uid uid);
+ boolean contains(String uid);
+ boolean remove(Uid uid);
+ RecordList getList();
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ArjunaToolsFramework.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ArjunaToolsFramework.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ArjunaToolsFramework.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -35,7 +35,6 @@
import com.arjuna.ats.tools.toolsframework.plugin.ToolPluginInformation;
import com.arjuna.ats.tools.toolsframework.dialogs.AboutDialog;
import com.arjuna.ats.tools.toolsframework.dialogs.SettingsDialog;
-import com.arjuna.ats.arjuna.common.arjPropertyManager;
import javax.swing.*;
import javax.swing.event.MenuListener;
@@ -44,14 +43,16 @@
import java.util.Properties;
import java.util.ArrayList;
import java.awt.event.*;
-import java.awt.*;
import java.io.InputStream;
-import java.io.File;
import java.beans.PropertyVetoException;
+import java.net.URL;
import org.w3c.dom.*;
-public class ArjunaToolsFramework extends JFrame implements ActionListener, MenuListener
+/**
+ * Top level frame for running jbosstm tools
+ */
+public class ArjunaToolsFramework extends JFrame implements ActionListener, MenuListener, ToolsFramework
{
private final static String CONFIGURATION_FILENAME = "toolsframework.xml";
@@ -59,7 +60,7 @@
private final static String TITLE_NODE = "title";
private final static String FRAME_PROPERTIES_NODE = "frame-properties";
private final static String PLUGIN_CONFIGURATIONS_NODE = "plugins";
- private final static String PROPERTIES_CONFIGURATION_NODE = "properties";
+ private final static String PROPERTIES_CONFIGURATION_NODE = "properties";
private final static String PROPERTY_CONFIGURATION_NODE = "property";
private final static String PROPERTY_NAME_ATTRIBUTE = "name";
@@ -68,9 +69,7 @@
private final static String WIDTH_ATTRIBUTE = "width";
private final static String HEIGHT_ATTRIBUTE = "height";
- private final static String DEFAULT_LIB_DIRECTORY = "lib";
-
- private final static String FILE_MENU = "File";
+ private final static String FILE_MENU = "File";
private final static String SETTINGS_MENU_ITEM = "Settings";
private final static String EXIT_MENU_ITEM = "Exit";
@@ -85,24 +84,26 @@
private final static float CASCADE_WINDOW_PERCENTAGE = 0.75f;
private final static int CASCADE_WINDOW_INCREMENT = 25;
- private static File _libDirectory = new File(System.getProperty("com.arjuna.mw.ArjunaToolsFramework.lib", DEFAULT_LIB_DIRECTORY));
-
- public static File getLibDirectory()
- {
- return _libDirectory;
- }
-
private ToolsClassLoader _classLoader = null;
private ArrayList _plugins = new ArrayList();
private JDesktopPane _desktop = null;
private JMenuBar _menuBar = null;
private boolean _hasSettings = false;
private boolean _disposed = false;
+ private boolean _isEmbedded = false;
public ArjunaToolsFramework()
{
+ this(false);
+ }
+
+ public ArjunaToolsFramework(boolean isEmbedded)
+ {
+ /** Is the application embedded? **/
+ _isEmbedded = isEmbedded;
+
/** Create tools classloader **/
- _classLoader = new ToolsClassLoader(_libDirectory);
+ _classLoader = new ToolsClassLoader();
/** Create JMenuBar **/
this.setJMenuBar(_menuBar = createBasicMenuBar());
@@ -140,12 +141,12 @@
public void windowClosing(WindowEvent e)
{
disposePlugins();
- System.exit(0);
+ exitApplication(0);
}
});
/** Display the frame **/
- show();
+ setVisible(true);
/** Show the about dialog and allow to automatically close **/
new AboutDialog(this, true);
@@ -172,6 +173,14 @@
}
}
+ public synchronized void exitApplication(int status)
+ {
+ if (!_isEmbedded)
+ {
+ System.exit(status);
+ }
+ }
+
private JMenuBar createBasicMenuBar()
{
JMenuBar menubar = new JMenuBar();
@@ -383,7 +392,7 @@
if (configStream == null)
{
System.err.println("Cannot find the configuration file '" + CONFIGURATION_FILENAME + "' in the tests/config directory");
- System.exit(1);
+ exitApplication(1);
}
/** Parse the configuration document **/
@@ -415,7 +424,7 @@
}
}
- /** Retrieve the plugin configuration nodes **/
+ /** Retrieve the plugin configuration nodes **/
Node pluginConfigs = getChildNode(configRoot, PLUGIN_CONFIGURATIONS_NODE);
/** Retrieve the tool plugin information classes for the JARs in the tool lib directory **/
@@ -428,9 +437,10 @@
for (int classnameCount=0;classnameCount<pluginClassname.length;classnameCount++)
{
/** Instantiate plugin and add to list **/
- _plugins.add(plugin = (ToolPlugin) _classLoader.loadClass(pluginClassname[classnameCount]).newInstance());
-
- /** Call initialisers **/
+ plugin = (ToolPlugin) _classLoader.loadClass(pluginClassname[classnameCount]).newInstance();
+ plugin.setToolsFramework(this);
+
+ /** Call initialisers **/
plugin.initialisePlugin(_menuBar, _desktop, plugins[pluginCount].getIcon16(), plugins[pluginCount].getIcon32());
/** Retrieve the tool properties and then override any locally defined properties **/
@@ -442,9 +452,18 @@
toolProps.putAll( localProps );
}
- plugin.initialise( toolProps );
-
- /** See if this plugin has a settings panel, if it does ensure we enable all setting functionality **/
+ try
+ {
+ plugin.initialise( toolProps );
+ _plugins.add(plugin);
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ System.err.println("Error initialising plugin " + plugin.getName());
+ }
+
+ /** See if this plugin has a settings panel, if it does ensure we enable all setting functionality **/
if ( plugin.createSettingsPanel() != null )
{
_hasSettings = true;
@@ -521,4 +540,9 @@
{
new ArjunaToolsFramework();
}
+
+ public URL getToolsDir()
+ {
+ return _classLoader.getToolsDir();
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsClassLoader.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsClassLoader.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsClassLoader.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -35,89 +35,222 @@
import java.net.URLClassLoader;
import java.net.URL;
+import java.net.MalformedURLException;
import java.io.File;
import java.io.FilenameFilter;
-import java.io.InputStream;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Collection;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
-public class ToolsClassLoader implements FilenameFilter
+/**
+ * Tool specific class loader that knows how to load classes from a tool plugin
+ * distributed as a sar or as a directory hierarchy
+ */
+public class ToolsClassLoader extends URLClassLoader implements FilenameFilter
{
private final static String JAR_FILENAME_SUFFIX = ".jar";
+ private final static String JBOSS_TMP_DIR_PROP = "jboss.server.temp.dir";
+ private final static String TMP_DIR = "jboss_tools_tmp";
+ private final static String TOOLS_DIR = "tools/";
+ private final static String DEFAULT_LIB_DIRECTORY = "tools";
- private URLClassLoader _urlLoader;
- private ArrayList _toolJars = new ArrayList();
+ private URLClassLoader _urlLoader;
+ private ArrayList<ToolPluginInformation> _toolJars = new ArrayList<ToolPluginInformation> ();
+ private URL toolsDir;
- /**
+ public ToolsClassLoader(URL[] urls)
+ {
+ super(urls, Thread.currentThread().getContextClassLoader());
+
+ init();
+ }
+
+ public ToolsClassLoader()
+ {
+ this(new URL[0]);
+ }
+
+ private void init()
+ {
+ String libDir = System.getProperty("com.arjuna.mw.ArjunaToolsFramework.lib");
+ String sarPath;
+
+ if (libDir != null)
+ {
+ processDir(libDir);
+ }
+ else if ((sarPath = getSarPath()) != null)
+ {
+ processSar(sarPath);
+ }
+ else
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(DEFAULT_LIB_DIRECTORY);
+
+ if (url != null && new File(url.getFile()).exists())
+ processDir(url.getFile());
+ else
+ throw new RuntimeException("Unable to locate any TM tools");
+ }
+
+ _urlLoader = this;
+ }
+
+ private void processSar(String sarFileName)
+ {
+ try {
+ ZipFile zf = new ZipFile(sarFileName);
+ Enumeration<? extends ZipEntry> entries = zf.entries();
+ String tmpDir = getTmpDir();
+ Collection<URL> urls = new ArrayList<URL> ();
+
+ while (entries.hasMoreElements())
+ {
+ ZipEntry ze = entries.nextElement();
+ String fname = tmpDir + '/' + ze.getName();
+
+ if (ze.isDirectory())
+ {
+ new File(fname).mkdirs();
+ }
+ else
+ {
+ File f = ToolPluginInformation.externalizeFile(fname, zf.getInputStream(ze));
+
+ if (accept(ze.getName()))
+ addURL(ToolPluginInformation.getToolPluginInformation(_toolJars, f));
+// urls.add(ToolPluginInformation.getToolPluginInformation(_toolJars, f));
+ }
+ }
+
+ addURL(new File(getTmpDir()).toURL());
+// urls.add(new File(getTmpDir()).toURL());
+ toolsDir = new File(getTmpDir() + DEFAULT_LIB_DIRECTORY).toURL();
+
+// setClassLoader(urls, getTmpDir() + DEFAULT_LIB_DIRECTORY);
+
+ zf.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException("Unable to unpack tools sar: " + e.getMessage());
+ }
+ }
+
+ /**
+ * @message com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidjar Error reading tool jar: {0}
+ * @param toolsDirectory
+ */
+ private void processDir(String toolsDirectory)
+ {
+ File toolsLibDirectory = new File(toolsDirectory);
+
+ if (!toolsLibDirectory.isDirectory())
+ return;
+
+ /** Find all JAR files that contain a META-INF/tools.properties **/
+ Collection<URL> urls = new ArrayList<URL> ();
+
+ for (File jar : toolsLibDirectory.listFiles(this))
+ {
+ try
+ {
+ addURL(ToolPluginInformation.getToolPluginInformation(_toolJars, jar));
+// urls.add(ToolPluginInformation.getToolPluginInformation(_toolJars, jar));
+ }
+ catch (IOException e)
+ {
+ if ( tsmxLogger.loggerI18N.isErrorEnabled() )
+ tsmxLogger.loggerI18N.error("com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidjar", new Object[] {e.getMessage()});
+
+ if ( tsmxLogger.loggerI18N.isDebugEnabled())
+ tsmxLogger.loggerI18N.debug("com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidjar", e);
+ }
+ }
+
+ try
+ {
+ addURL(toolsLibDirectory.toURL());
+// urls.add(toolsLibDirectory.toURL());
+ toolsDir = toolsLibDirectory.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+// return setClassLoader(urls, toolsLibDirectory.getAbsolutePath());
+ }
+
+ /**
* @message com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidurl The URL is invalid: {0}
* @param toolsLibDirectory
*/
- public ToolsClassLoader(File toolsLibDirectory)
- {
- /** Find all JAR files than contain a META-INF/tools.properties **/
- File[] jarFiles = toolsLibDirectory.listFiles(this);
+ private boolean setClassLoader(Collection<URL> urls, String toolsLibDirectory)
+ {
+ // method 1 works
+ URL[] xurls = new URL[ _toolJars.size() + 1 ];
- if ( jarFiles != null )
- {
- for (int count=0;count<jarFiles.length;count++)
- {
- try
- {
- ToolPluginInformation toolInfo = ToolPluginInformation.getToolPluginInformation(jarFiles[count]);
+ for (int count=0;count<_toolJars.size();count++) {
+ ToolPluginInformation info = _toolJars.get(count);
+ try {
+ xurls[count] = info.getFileURL();
+ } catch (Exception e) {
+ }
+ }
- /** Only add the tool info if the JAR is a tool JAR **/
- if ( toolInfo != null )
- {
- _toolJars.add( toolInfo );
- }
- }
- catch (Exception e)
- {
- // Ignore as JAR may not be a tool
- }
- }
- }
+ try
+ {
+ toolsDir = new File(toolsLibDirectory).toURL();
- URL[] urls = new URL[ _toolJars.size() + 1 ];
+ _urlLoader = new URLClassLoader(xurls);
+ if (toolsDir != null)
+ return true;
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace();
+ return false;
+ }
- for (int count=0;count<_toolJars.size();count++)
- {
- ToolPluginInformation info = ((ToolPluginInformation)_toolJars.get(count));
- try
- {
- urls[count] = info.getFilename().toURL();
- }
- catch (Exception e)
- {
- if ( tsmxLogger.loggerI18N.isErrorEnabled() )
- {
- tsmxLogger.loggerI18N.error("com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidurl", new Object[] { info.getFilename() } );
- }
- }
- }
- try
- {
- urls[_toolJars.size()] = toolsLibDirectory.toURL();
- }
- catch (Exception e)
- {
- if ( tsmxLogger.loggerI18N.isErrorEnabled() )
- {
- tsmxLogger.loggerI18N.error("com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidurl", new Object[] { toolsLibDirectory.toString() } );
- }
- }
- _urlLoader = new URLClassLoader(urls);
- }
+ // method 2 doesn't
+ URL[] urla = urls.toArray(new URL[urls.size() + 1]);
- public ToolPluginInformation[] getToolsInformation()
+ try
+ {
+ // make sure the toolsDir has trailing slash for the benefit of the class loader
+ toolsDir = new File(toolsLibDirectory).toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ if ( tsmxLogger.loggerI18N.isErrorEnabled() )
+ tsmxLogger.loggerI18N.error("com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidurl", new Object[] { toolsLibDirectory } );
+
+ if ( tsmxLogger.loggerI18N.isDebugEnabled())
+ tsmxLogger.loggerI18N.debug("com.arjuna.ats.tools.toolsframework.ToolsClassLoader.invalidurl", e);
+
+ return false;
+ }
+
+ urla[urls.size()] = toolsDir;
+
+ _urlLoader = URLClassLoader.newInstance(urls.toArray(new URL[urla.length]),
+ Thread.currentThread().getContextClassLoader());
+
+ return true;
+ }
+
+ public ToolPluginInformation[] getToolsInformation()
{
- ToolPluginInformation[] tools = new ToolPluginInformation[_toolJars.size()];
- _toolJars.toArray(tools);
-
- return tools;
+ return _toolJars.toArray(new ToolPluginInformation[_toolJars.size()]);
}
-
+/*
public URL getResource(String name)
{
return _urlLoader.getResource(name);
@@ -132,7 +265,7 @@
{
return _urlLoader.loadClass(name);
}
-
+*/
/**
* Tests if a specified file should be included in a file list.
*
@@ -145,4 +278,45 @@
{
return name.endsWith(JAR_FILENAME_SUFFIX);
}
+
+ private boolean accept(String name)
+ {
+ if (!name.endsWith(JAR_FILENAME_SUFFIX))
+ return false;
+
+ if (name.indexOf('/') == -1)
+ return true; // jar in the top level directory
+
+ if (name.startsWith(TOOLS_DIR) && name.indexOf('/', TOOLS_DIR.length()) == -1)
+ return true; // jar in the tools direcory
+
+ return false;
+ }
+
+ private String getTmpDir()
+ {
+ String tmpDir = System.getProperty(JBOSS_TMP_DIR_PROP);
+
+ if (tmpDir == null)
+ tmpDir = TMP_DIR;
+ else
+ tmpDir += "/" + TMP_DIR;
+
+ return (tmpDir.endsWith("/") ? tmpDir : tmpDir + '/');
+ }
+
+ private String getSarPath()
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(DEFAULT_LIB_DIRECTORY);
+ String tDir = url.getFile();
+ int ti = tDir.indexOf('/' + DEFAULT_LIB_DIRECTORY);
+ String sarPath = ti != -1 ? tDir.substring(0, ti) : null;
+
+ return (sarPath != null && new File(sarPath).exists() ? sarPath : null);
+ }
+
+ public URL getToolsDir()
+ {
+ return toolsDir;
+ }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsFramework.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsFramework.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/ToolsFramework.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.toolsframework;
+
+import java.net.URL;
+
+public interface ToolsFramework
+{
+ URL getToolsDir();
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/dialogs/AboutDialog.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/dialogs/AboutDialog.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/dialogs/AboutDialog.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
- * (C) 2005-2006,
+ * (C) 2005-2008,
* @author JBoss Inc.
*/
/*
@@ -31,6 +31,7 @@
package com.arjuna.ats.tools.toolsframework.dialogs;
import com.sun.image.codec.jpeg.JPEGCodec;
+import com.arjuna.ats.tools.toolsframework.images.ImageCommon;
import javax.swing.*;
import java.awt.*;
@@ -118,10 +119,14 @@
private Image createLogo() throws java.io.IOException
{
- URL imageUrl = ClassLoader.getSystemResource(LOGO_FILENAME);
+ /*
+ URL imageUrl = ClassLoader.getSystemResource(LOGO_FILENAME);
Image img = getToolkit().getImage(imageUrl);
- MediaTracker mt = new MediaTracker(this);
+ */
+ Image img = ImageCommon.getImage(LOGO_FILENAME);
+ MediaTracker mt = new MediaTracker(this);
+
mt.addImage(img, 0);
try
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/iconpanel/IconImage.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/iconpanel/IconImage.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/iconpanel/IconImage.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -30,6 +30,8 @@
*/
package com.arjuna.ats.tools.toolsframework.iconpanel;
+import com.arjuna.ats.tools.toolsframework.images.ImageCommon;
+
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
@@ -39,34 +41,35 @@
public class IconImage extends JComponent
{
- private Image _iconImageSelected;
- private Image _iconImageOver;
- private Image _iconImageUnselected;
- private boolean _selected = false;
- private boolean _over = false;
+ private Image _iconImageSelected;
+ private Image _iconImageOver;
+ private Image _iconImageUnselected;
+ private boolean _selected = false;
+ private boolean _over = false;
- public IconImage(String iconFilename)
- {
- this.setBackground(Color.white);
+ public IconImage(String iconFilename)
+ {
+ this.setBackground(Color.white);
- setImage(iconFilename);
- }
+ setImage(iconFilename);
+ }
- public void setImage(Image img)
- {
- _iconImageSelected = img;
- _iconImageOver = _iconImageSelected;
- _iconImageUnselected = getUnselectedImage(_iconImageSelected);
- setPreferredSize(new Dimension(_iconImageSelected.getWidth(this), _iconImageSelected.getHeight(this)));
- }
+ public void setImage(Image img)
+ {
+ _iconImageSelected = img;
+ _iconImageOver = _iconImageSelected;
+ _iconImageUnselected = getUnselectedImage(_iconImageSelected);
+ setPreferredSize(new Dimension(_iconImageSelected.getWidth(this), _iconImageSelected.getHeight(this)));
+ }
- public void setImage(String iconFilename)
- {
- try
- {
- MediaTracker mt = new MediaTracker(this);
+ public void setImage(String iconFilename)
+ {
+ try
+ {
+ MediaTracker mt = new MediaTracker(this);
- URL imageURL = ClassLoader.getSystemResource(iconFilename);
+ /*
+ URL imageURL = ClassLoader.getSystemResource(iconFilename);
if ( imageURL != null )
{
@@ -79,92 +82,102 @@
_iconImageOver = _iconImageSelected;
_iconImageUnselected = getUnselectedImage(_iconImageSelected);
}
- }
- catch (InterruptedException e)
- {
- // Ignore
- }
+ */
- setPreferredSize(new Dimension(_iconImageSelected.getWidth(this), _iconImageSelected.getHeight(this)));
- }
+ _iconImageSelected = ImageCommon.getImage(iconFilename);
+
+ mt.addImage(_iconImageSelected, 0);
- /**
- * Create selected image which is grayscale.
- * @param img
- * @return
- */
- private Image getUnselectedImage(Image img)
- {
- BufferedImage bi = new BufferedImage(img.getWidth(this), img.getHeight(this), BufferedImage.TYPE_INT_ARGB);
- bi.getGraphics().drawImage(img, 0, 0, this);
+ mt.waitForAll();
- for (int y=0;y<bi.getHeight();y++)
- {
- for (int x=0;x<bi.getWidth();x++)
- {
- int rgb = bi.getRGB(x,y);
+ _iconImageOver = _iconImageSelected;
+ _iconImageUnselected = getUnselectedImage(_iconImageSelected);
+ }
+ catch (InterruptedException e)
+ {
+ // Ignore
+ }
- int s = (rgb >> 24) & 0xFF;
- int red = (rgb >> 16) & 0xFF;
- int green = (rgb >> 8) & 0xFF;
- int blue = (rgb >> 8) & 0xFF;
- int l = (int) ( ( (float)( red + green + blue ) / 768 ) * 255 );
+ setPreferredSize(new Dimension(_iconImageSelected.getWidth(this), _iconImageSelected.getHeight(this)));
+ }
- rgb = (s << 24) | (l << 16) | ( l << 8 ) | ( l);
+ /**
+ * Create selected image which is grayscale.
+ * @param img
+ * @return
+ */
+ private Image getUnselectedImage(Image img)
+ {
+ BufferedImage bi = new BufferedImage(img.getWidth(this), img.getHeight(this), BufferedImage.TYPE_INT_ARGB);
+ bi.getGraphics().drawImage(img, 0, 0, this);
- bi.setRGB(x,y,rgb);
- }
- }
+ for (int y=0;y<bi.getHeight();y++)
+ {
+ for (int x=0;x<bi.getWidth();x++)
+ {
+ int rgb = bi.getRGB(x,y);
- return bi;
- }
+ int s = (rgb >> 24) & 0xFF;
+ int red = (rgb >> 16) & 0xFF;
+ int green = (rgb >> 8) & 0xFF;
+ int blue = (rgb >> 8) & 0xFF;
+ int l = (int) ( ( (float)( red + green + blue ) / 768 ) * 255 );
- public boolean isSelected()
- {
- return _selected;
- }
+ rgb = (s << 24) | (l << 16) | ( l << 8 ) | ( l);
- public void setSelected(boolean selected)
- {
- _selected = selected;
- }
+ bi.setRGB(x,y,rgb);
+ }
+ }
- public void setOver(boolean over)
- {
- _over = over;
+ return bi;
+ }
- repaint();
- }
+ public boolean isSelected()
+ {
+ return _selected;
+ }
- public boolean isOver()
- {
- return _over;
- }
+ public void setSelected(boolean selected)
+ {
+ _selected = selected;
+ }
- public void paintComponent(Graphics g)
- {
- if ( _iconImageSelected != null )
- {
- if (_selected)
- {
- g.drawImage( _iconImageSelected, (getWidth() / 2) - (_iconImageSelected.getWidth(this) / 2), (getHeight() / 2) - (_iconImageSelected.getHeight(this) / 2), this);
- }
- else
- {
- if ( _over )
- {
- g.drawImage( _iconImageOver, (getWidth() / 2) - (_iconImageOver.getWidth(this) / 2), (getHeight() / 2) - (_iconImageOver.getHeight(this) / 2), this);
- }
- else
- {
- g.drawImage( _iconImageUnselected, (getWidth() / 2) - (_iconImageUnselected.getWidth(this) / 2), (getHeight() / 2) - (_iconImageUnselected.getHeight(this) / 2), this);
- }
- }
- }
- }
+ public void setOver(boolean over)
+ {
+ _over = over;
- public Image getImage()
- {
- return _iconImageSelected;
- }
+ repaint();
+ }
+
+ public boolean isOver()
+ {
+ return _over;
+ }
+
+ public void paintComponent(Graphics g)
+ {
+ if ( _iconImageSelected != null )
+ {
+ if (_selected)
+ {
+ g.drawImage( _iconImageSelected, (getWidth() / 2) - (_iconImageSelected.getWidth(this) / 2), (getHeight() / 2) - (_iconImageSelected.getHeight(this) / 2), this);
+ }
+ else
+ {
+ if ( _over )
+ {
+ g.drawImage( _iconImageOver, (getWidth() / 2) - (_iconImageOver.getWidth(this) / 2), (getHeight() / 2) - (_iconImageOver.getHeight(this) / 2), this);
+ }
+ else
+ {
+ g.drawImage( _iconImageUnselected, (getWidth() / 2) - (_iconImageUnselected.getWidth(this) / 2), (getHeight() / 2) - (_iconImageUnselected.getHeight(this) / 2), this);
+ }
+ }
+ }
+ }
+
+ public Image getImage()
+ {
+ return _iconImageSelected;
+ }
}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/images/ImageCommon.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/images/ImageCommon.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/images/ImageCommon.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.toolsframework.images;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Class with static methods for retrieving image and imageicon objects. Resources
+ * must be placed in the same directory as the class.
+ *
+ */
+public class ImageCommon
+{
+ public static synchronized Image getImage(String imageFileName)
+ {
+ return new ImageIcon(ImageCommon.class.getResource(imageFileName)).getImage();
+ }
+
+ public static synchronized ImageIcon getImageIcon(String imageIconFileName)
+ {
+ return new ImageIcon(ImageCommon.class.getResource(imageIconFileName));
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPlugin.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPlugin.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPlugin.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,6 +31,7 @@
package com.arjuna.ats.tools.toolsframework.plugin;
import com.arjuna.ats.tools.toolsframework.panels.ATFSettingsPanel;
+import com.arjuna.ats.tools.toolsframework.ToolsFramework;
import javax.swing.*;
import java.util.Properties;
@@ -41,8 +42,9 @@
private JDesktopPane _desktop = null;
private Icon _icon16 = null;
private Icon _icon32 = null;
+ private ToolsFramework toolsFramework;
- public final void initialisePlugin(JMenuBar menubar, JDesktopPane desktop, String icon16, String icon32)
+ public final void initialisePlugin(JMenuBar menubar, JDesktopPane desktop, String icon16, String icon32)
{
_menubar = menubar;
_desktop = desktop;
@@ -141,4 +143,13 @@
return getMenu(_menubar, "File");
}
+ public final void setToolsFramework(ToolsFramework toolsFramework)
+ {
+ this.toolsFramework = toolsFramework;
+ }
+
+ public ToolsFramework getToolsFramework()
+ {
+ return toolsFramework;
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginException.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginException.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginException.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -48,4 +48,14 @@
public ToolPluginException()
{
}
+
+ /**
+ * Constructs an <code>Exception</code> with the specified detail message and cause
+ * @param msg detail message
+ * @param cause the cause of the exception
+ */
+ public ToolPluginException(String msg, Throwable cause)
+ {
+ super(msg, cause);
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformation.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformation.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformation.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -30,14 +30,12 @@
*/
package com.arjuna.ats.tools.toolsframework.plugin;
-import java.io.File;
-import java.io.FileNotFoundException;
+import java.io.*;
import java.util.jar.JarFile;
import java.util.jar.JarEntry;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.net.URL;
public class ToolPluginInformation
{
@@ -48,11 +46,11 @@
private String[] _classnames = null;
private Properties _properties = null;
- private File _filename = null;
+ private URL _fileURL = null;
private String _icon16 = null;
private String _icon32 = null;
- private ToolPluginInformation(File filename, Properties toolInfo)
+ private ToolPluginInformation(URL fileURL, Properties toolInfo)
{
/** Parse the ; delimited classname list **/
ArrayList classnames = new ArrayList();
@@ -81,7 +79,7 @@
props.remove( TOOL_CLASSNAME_PROPERTY_NAME );
_properties = props;
- _filename = filename;
+ _fileURL = fileURL;
}
/**
@@ -124,25 +122,23 @@
* Get the name of the tool's JAR file.
* @return
*/
- public final File getFilename()
+ public final URL getFileURL()
{
- return _filename;
+ return _fileURL;
}
/**
* Searches the given JAR file for the tools information file and creates a tool plugin information
* wrapper for it.
*
- * @param filename The JAR file to search.
- * @return The ToolPluginInformation wrapper for that tool JAR file.
- * @throws java.io.IOException
- * @throws ToolPluginInformationNotFoundException
+ * @param plugins collection for returning the desired plugin wrapper for the tool jar file
+ * @param jar The JAR file to search.
+ * @return the url of the JAR file.
+ * @throws IOException
*/
- public static ToolPluginInformation getToolPluginInformation(File filename) throws java.io.IOException, ToolPluginInformationNotFoundException
+ public static URL getToolPluginInformation(Collection<ToolPluginInformation> plugins, File jar) throws IOException
{
- try
- {
- JarFile jFile = new JarFile(filename);
+ JarFile jFile = new JarFile(jar);
Enumeration entries = jFile.entries();
@@ -154,18 +150,60 @@
{
Properties toolProps = new Properties();
toolProps.load( jFile.getInputStream(entry) );
- return new ToolPluginInformation(filename, toolProps);
+ plugins.add(new ToolPluginInformation(jar.toURL(), toolProps));
+
+ break;
}
}
jFile.close();
- }
- catch (FileNotFoundException e)
- {
- throw new ToolPluginInformationNotFoundException("Tool plugin information not found in '"+filename+"'");
- }
- /** We have not found the tools information file **/
- return null;
+ return jar.toURL();
}
+
+ public static URL toPlugin(Collection<ToolPluginInformation> plugins, String tmpDir, InputStream is, ZipEntry ze) throws IOException
+ {
+ return getToolPluginInformation(plugins, externalizeFile(tmpDir, is, ze)); // TODO clean up when done
+ }
+
+ public static File externalizeFile(String fname, InputStream is) throws IOException
+ {
+ File f = new File(fname);
+ OutputStream out = new FileOutputStream(f);
+ byte[] buf = new byte[1024];
+ int len;
+
+ while ((len = is.read(buf)) > 0)
+ out.write(buf, 0, len);
+
+ out.close();
+
+ return f;
+ }
+
+ public static File externalizeFile(String tmpDir, InputStream is, ZipEntry ze) throws IOException
+ {
+ File f = new File(tmpDir + ze.getName());
+
+ if (f.isFile())
+ {
+ File d = f.getParentFile();
+
+ if (d != null)
+ f.mkdirs();
+
+ OutputStream out = new FileOutputStream(f);
+ byte[] buf = new byte[1024];
+ int len;
+
+ while ((len = is.read(buf)) > 0)
+ out.write(buf, 0, len);
+
+ out.close();
+ }
+ else
+ f.mkdirs();
+
+ return f;
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformationNotFoundException.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformationNotFoundException.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/bin/com/arjuna/ats/tools/toolsframework/plugin/ToolPluginInformationNotFoundException.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -30,23 +30,19 @@
*/
package com.arjuna.ats.tools.toolsframework.plugin;
-public class ToolPluginInformationNotFoundException extends Exception
+public class ToolPluginInformationNotFoundException extends ToolPluginException
{
- /**
- * Constructs an <code>Exception</code> with no specified detail message.
- */
- public ToolPluginInformationNotFoundException()
- {
- super();
- }
+ public ToolPluginInformationNotFoundException(String msg)
+ {
+ super(msg);
+ }
- /**
- * Constructs an <code>Exception</code> with the specified detail message.
- *
- * @param s the detail message.
- */
- public ToolPluginInformationNotFoundException(String s)
- {
- super(s);
- }
+ public ToolPluginInformationNotFoundException()
+ {
+ }
+
+ public ToolPluginInformationNotFoundException(String msg, Throwable cause)
+ {
+ super(msg, cause);
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/build.xml 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/build.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -125,7 +125,9 @@
<target name="com.arjuna.mw.ts.tsmx.build" depends="com.arjuna.mw.ts.tsmx.jar, com.arjuna.mwlabs.ts.tsmx.utilities.jar, com.arjuna.mwlabs.ts.tsmx.tests.jar"/>
<!-- Compilation targets -->
- <target name="com.arjuna.mw.ts.tsmx.compile" depends="com.arjuna.mwlabs.ts.tsmx.init, com.arjuna.mwlabs.ts.tsmx.compile"/>
+ <target name="com.arjuna.mw.ts.tsmx.compile" depends="com.arjuna.mwlabs.ts.tsmx.init, com.arjuna.mwlabs.ts.tsmx.compile">
+ <ant dir="sar" target="compile"/>
+ </target>
<target name="com.arjuna.mwlabs.ts.tsmx.compile" depends="com.arjuna.mwlabs.ts.tsmx.init,com.arjuna.mwlabs.ts.tsmx.generateresourcebundle">
@@ -189,6 +191,9 @@
<classpath>
<path path="${build.classpath}"/>
<path path="${com.arjuna.mwlabs.ts.tsmx.dest}"/>
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.jar.ext}">
+ <include name="**/*.jar"/>
+ </fileset>
<path location="${com.arjuna.mwlabs.ts.tsmx.jar.ext}/jfreechart-1.0.2.jar"/>
<path location="${com.arjuna.mwlabs.ts.tsmx.jar.ext}/jcommon-1.0.5.jar"/>
</classpath>
@@ -204,9 +209,15 @@
<mkdir dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/bin/tools"/>
<mkdir dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/bin/tools/plugins"/>
+ <copy todir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}/com/arjuna/ats/tools/toolsframework/images">
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.etc}" includes="*.gif"/>
+ </copy>
+
<jar jarfile="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/bin/${com.arjuna.mwlabs.ts.modulename}-tools.jar">
- <fileset dir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}" includes="com/arjuna/ats/tools/toolsframework/**/*.class"/>
- <fileset dir="${com.arjuna.mwlabs.ts.tsmx.etc}" includes="**/**.gif"/>
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}">
+ <include name="com/arjuna/ats/tools/toolsframework/**/*.class"/>
+ <include name="com/arjuna/ats/tools/toolsframework/**/*.gif"/>
+ </fileset>
</jar>
<jar jarfile="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/bin/tools/${com.arjuna.mwlabs.ts.modulename}-jmxbrowser.jar">
@@ -236,6 +247,10 @@
<attribute name="plugin-classname-1" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionViewer"/>
<attribute name="plugin-classname-3" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.ArjunaTransactionViewer"/>
<attribute name="plugin-classname-2" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord.ResourceRecordViewer"/>
+ <attribute name="plugin-classname-4" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord.XAResourceRecordViewer"/>
+ <attribute name="plugin-classname-5" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord.AbstractRecordViewer"/>
+ <attribute name="plugin-classname-6" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord.ExtendedResourceRecordViewer"/>
+ <attribute name="plugin-classname-7" value="com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.InFlightTransactionViewer"/>
</section>
</manifest>
</jar>
@@ -312,15 +327,20 @@
<fileset dir="${com.arjuna.mwlabs.ts.tsmx.jar.ext}" includes="*.jar"/>
</copy>
<copy todir="${com.hp.mwlabs.installationdirectory}/bin/">
- <fileset dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/bin" includes="tsmx-tools.jar"/>
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/bin" includes="tsmx-tools.jar,jbossts-tools.sar"/>
</copy>
</target>
+ <target name="install_jboss_tools">
+ <ant dir="sar" target="build-sar"/>
+ </target>
+
<!-- Clean targets -->
<target name="com.arjuna.mw.ts.tsmx.clean">
<echo message="Cleaning module"/>
+ <ant dir="sar" target="clean"/>
<delete dir="${com.arjuna.mwlabs.ts.tsmx.destroot}"/>
<delete dir="${com.arjuna.mwlabs.ts.tsmx.tests.dest}"/>
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/etc/logo.gif
===================================================================
(Binary files differ)
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/etc/objectstorebrowser/tools.properties
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/etc/objectstorebrowser/tools.properties 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/etc/objectstorebrowser/tools.properties 2008-07-28 17:23:01 UTC (rev 21258)
@@ -25,4 +25,6 @@
# Tool Properties
com.arjuna.mwtools.objectstorebrowser.rootprovider=com.arjuna.ats.tools.objectstorebrowser.rootprovider.providers.DefaultRootProvider
-com.arjuna.mwtools.objectstorebrowser.entityviewers.com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource.ResourceActionHandle=com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource.ResourceEntityViewer
+com.arjuna.mwtools.objectstorebrowser.initializer=com.arjuna.ats.tools.objectstorebrowser.JTSToolInitializer
+com.arjuna.mwtools.objectstorebrowser.altinitializer=com.arjuna.ats.tools.objectstorebrowser.JTAToolInitializer
+com.arjuna.mwtools.objectstorebrowser.entityviewers.com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource.ResourceActionHandle=com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource.ResourceEntityViewer
\ No newline at end of file
Modified: labs/jbosstm/trunk/ArjunaCore/tsmx/etc/toolsframework.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/etc/toolsframework.xml 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/etc/toolsframework.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -28,4 +28,7 @@
<plugins/>
+ <tools>
+ <jar name="tsmx-objectstorebrowser.jar"/>
+ </tools>
</tools-framework>
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/sar/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/sar/build.xml (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/sar/build.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,99 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ as indicated by the @author tags.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ 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,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2008,
+ @author JBoss Inc.
+-->
+
+<project name="embedded-tools" default="build-sar" basedir=".">
+
+ <!-- You should modify the next two lines -->
+ <property environment="env"/>
+ <property name="jboss.as.home" value="${env.JBOSS_HOME}"/>
+
+ <!-- You should not need to modify anything below this point -->
+ <property name="jboss.ts" value="../../.."/>
+ <property name="jboss.ts.tools" value="${jboss.ts}/install/bin"/>
+ <available property="bin.present" file="${jboss.ts.tools}" type="dir"/>
+
+ <property name="jboss.as.profile" value="default"/>
+ <property name="jboss.server" value="${jboss.as.home}/server/${jboss.as.profile}"/>
+ <property name="build.dir" value="build"/>
+ <property name="jboss.ts.tools.install.dir" value="${build.dir}/mbean"/>
+ <property name="src.dir" value="src"/>
+ <property name="resources.dir" value="resources"/>
+
+ <!-- Compile with debugging? -->
+ <condition property="com.arjuna.mwlabs.debug" value="no">
+ <equals arg1="${com.arjuna.mw.debug}" arg2="no"/>
+ </condition>
+ <property name="com.arjuna.mwlabs.debug" value="yes"/>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="init" depends="clean">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.dir}/classes"/>
+ <mkdir dir="${build.dir}/mbean"/>
+ <mkdir dir="${build.dir}/apps"/>
+ </target>
+
+ <path id="classpath">
+ <fileset dir="${jboss.as.home}/client" includes="jboss-system-jmx-client.jar"/>
+ <fileset dir="${jboss.as.home}/lib" includes="jboss-system.jar"/>
+ <fileset dir="${jboss.ts.tools}" includes="tsmx-tools.jar"/>
+ <fileset dir="${jboss.ts.tools}/tools" includes="tsmx-objectstorebrowser.jar"/>
+ <fileset dir="${jboss.ts.tools}/tools/plugins" includes="osbv-defaults.jar"/>
+ </path>
+
+ <target name="compile" depends="init" description="compile the source" if="bin.present">
+ <mkdir dir="${build.dir}"/>
+ <javac destdir="${build.dir}/classes" classpathref="classpath"
+ debug="${com.arjuna.mwlabs.debug}">
+ <src path="${src.dir}"/>
+ </javac>
+ </target>
+
+ <target name="build-jar" depends="compile" description="build the jar file" if="bin.present">
+ <jar destfile="${build.dir}/apps/embedded-tools.jar">
+ <fileset dir="${build.dir}/classes" includes="**/*.class"/>
+ </jar>
+ </target>
+
+ <target name="build-sar" depends="build-jar" description="build the mbean" if="bin.present">
+ <jar destfile="${jboss.ts.tools.install.dir}/jbossts-tools.sar">
+ <manifest>
+ <attribute name="Class-Path" value="tsmx-tools.jar tools/tsmx-objectstorebrowser.jar"/>
+ </manifest>
+ <fileset dir="${resources.dir}">
+ <include name="META-INF/jboss-service.xml"/>
+ </fileset>
+ <fileset dir="${build.dir}/apps" includes="embedded-tools.jar"/>
+ <fileset dir="${jboss.ts.tools}/tools">
+ <include name="toolsframework.xml"/>
+ </fileset>
+ <fileset dir="${jboss.ts.tools}">
+ <include name="tsmx-tools.jar"/>
+ <include name="**/tsmx-objectstorebrowser.jar"/>
+ <include name="**/osbv-defaults.jar"/>
+ </fileset>
+ </jar>
+ </target>
+
+</project>
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/sar/resources/META-INF/jboss-service.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/sar/resources/META-INF/jboss-service.xml (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/sar/resources/META-INF/jboss-service.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ as indicated by the @author tags.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ 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,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2008,
+ @author JBoss Inc.
+-->
+
+<server>
+
+ <mbean name="jboss.tm:service=EmbeddedTools" code="org.jboss.jbosstm.tools.mbean.EmbeddedTools"/>
+
+</server>
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/embedded/EmbeddedToolsFramework.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/embedded/EmbeddedToolsFramework.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/embedded/EmbeddedToolsFramework.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbosstm.tools.embedded;
+
+import com.arjuna.ats.tools.toolsframework.ArjunaToolsFramework;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Applet for running the jbosstm tools framework (used when launching
+ * the tools from within an AS)
+ *
+ */
+public class EmbeddedToolsFramework extends JApplet
+{
+ public EmbeddedToolsFramework() throws HeadlessException
+ {
+ new ArjunaToolsFramework(true);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedTools.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedTools.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedTools.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbosstm.tools.mbean;
+
+import org.jboss.jbosstm.tools.embedded.EmbeddedToolsFramework;
+
+/**
+ * Service mbean implementation for starting jbosstm tools via a service archive
+ *
+ */
+public class EmbeddedTools implements EmbeddedToolsMBean
+{
+ public void startEmbeddedTools()
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ new EmbeddedToolsFramework();
+ }
+ }
+ .start();
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public int getState() {
+ return 0;
+ }
+
+ public String getStateString()
+ {
+ return null;
+ }
+
+ public void jbossInternalLifecycle(String string) throws Exception
+ {
+
+ }
+
+ public void create() throws Exception
+ {
+ }
+
+ public void start() throws Exception
+ {
+ }
+
+ public void stop()
+ {
+ }
+
+ public void destroy()
+ {
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedToolsMBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedToolsMBean.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/sar/src/org/jboss/jbosstm/tools/mbean/EmbeddedToolsMBean.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbosstm.tools.mbean;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * Service mbean interface for starting jbosstm tools via a service archive
+ *
+ */
+public interface EmbeddedToolsMBean extends ServiceMBean
+{
+ void startEmbeddedTools();
+}
Modified: labs/jbosstm/trunk/ArjunaJTA/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/build.xml 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTA/build.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -150,12 +150,14 @@
<target name="com.hp.mw.ts.product.compile"
depends="com.hp.mwlabs.ts.product.init,
com.hp.mwlabs.ts.product.jta.compile,
- com.hp.mwlabs.ts.product.jdbc.compile"/>
+ com.hp.mwlabs.ts.product.jdbc.compile,
+ com.hp.mwlabs.ts.product.tsmx.compile"/>
<target name="com.hp.mw.ts.product.jar"
depends="com.hp.mwlabs.ts.product.init,
com.hp.mwlabs.ts.product.jta.jar,
com.hp.mwlabs.ts.product.jdbc.jar,
+ com.hp.mwlabs.ts.product.tsmx.jar,
com.hp.mw.ts.product.tests.dojar,
com.hp.mw.ts.product.dojar"/>
@@ -233,6 +235,7 @@
depends="com.hp.mwlabs.ts.product.init,
com.hp.mwlabs.ts.product.jta.install,
com.hp.mwlabs.ts.product.jdbc.install,
+ com.hp.mwlabs.ts.product.tsmx.install,
com.hp.mw.ts.product.dojar"
if="com.hp.mwlabs.ts.build.jta">
@@ -273,7 +276,8 @@
<target name="com.hp.mw.ts.product.clean"
depends="com.hp.mwlabs.ts.product.jta.clean,
- com.hp.mwlabs.ts.product.jdbc.clean">
+ com.hp.mwlabs.ts.product.jdbc.clean,
+ com.hp.mwlabs.ts.product.tsmx.clean">
<delete dir="${com.hp.mwlabs.ts.product.jar.dest}" quiet="true"/>
<delete dir="${com.hp.mwlabs.ts.product.htdocs.dest}" quiet="true"/>
@@ -289,6 +293,10 @@
<ant dir="jdbc" />
</target>
+ <target name="com.hp.mwlabs.ts.product.tsmx.compile">
+ <ant dir="tsmx" target="compile"/>
+ </target>
+
<target name="com.hp.mwlabs.ts.product.jta.jar">
<ant dir="jta" target="com.hp.mw.ts.jta.build" />
</target>
@@ -297,6 +305,10 @@
<ant dir="jdbc" target="com.hp.mw.ts.jdbc.jar" />
</target>
+ <target name="com.hp.mwlabs.ts.product.tsmx.jar">
+ <ant dir="tsmx" target="jar" />
+ </target>
+
<target name="com.hp.mwlabs.ts.product.jta.install">
<ant dir="jta" target="com.hp.mw.ts.jta.install"/>
</target>
@@ -305,6 +317,10 @@
<ant dir="jdbc" target="com.hp.mw.ts.jdbc.install"/>
</target>
+ <target name="com.hp.mwlabs.ts.product.tsmx.install">
+ <ant dir="tsmx" target="install"/>
+ </target>
+
<target name="com.hp.mwlabs.ts.product.jta.clean">
<ant dir="jta" target="com.hp.mw.ts.jta.clean" />
</target>
@@ -313,6 +329,10 @@
<ant dir="jdbc" target="com.hp.mw.ts.jdbc.clean" />
</target>
+ <target name="com.hp.mwlabs.ts.product.tsmx.clean">
+ <ant dir="tsmx" target="clean" />
+ </target>
+
<!-- Short target names -->
<target name="build" depends="com.hp.mw.ts.product.build"/>
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1853,8 +1853,31 @@
return XA_TRANSACTION_TIMEOUT_ENABLED;
}
- protected com.arjuna.ats.arjuna.AtomicAction _theTransaction;
+ public static Map<Uid, javax.transaction.Transaction> getTransactions()
+ {
+ return Collections.unmodifiableMap(_transactions);
+ }
+ public Map<XAResource, TxInfo> getResources()
+ {
+ return Collections.unmodifiableMap(_resources);
+ }
+
+ public int getTimeout()
+ {
+ return _theTransaction.getTimeout();
+ }
+
+ public java.util.Map<Uid, String> getSynchronizations()
+ {
+ if (_theTransaction != null)
+ return _theTransaction.getSynchronizations();
+
+ return Collections.EMPTY_MAP;
+ }
+
+ protected com.arjuna.ats.arjuna.AtomicAction _theTransaction;
+
private Hashtable _resources;
private Hashtable _duplicateResources;
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/transaction/Transaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/transaction/Transaction.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/transaction/Transaction.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,11 +31,15 @@
package com.arjuna.ats.jta.transaction;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.internal.jta.xa.TxInfo;
+
import javax.transaction.xa.*;
import javax.transaction.RollbackException;
import java.lang.IllegalStateException;
+import java.util.Map;
/*
* Extended methods.
@@ -55,4 +59,8 @@
public Object getTxLocalResource(Object key);
public void putTxLocalResource(Object key, Object value);
public boolean isAlive();
+
+ Map<Uid, String> getSynchronizations();
+ Map<XAResource, TxInfo> getResources();
+ int getTimeout();
}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTAToolInitializer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTAToolInitializer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTAToolInitializer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser;
+
+import com.arjuna.ats.tools.objectstorebrowser.rootprovider.InFlightTransactionPseudoStore;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.UidInfo;
+import com.arjuna.ats.tools.toolsframework.plugin.ToolPlugin;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.internal.arjuna.utils.XATxConverter;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple;
+import com.arjuna.ats.jta.xa.XidImple;
+
+import javax.transaction.xa.Xid;
+import javax.transaction.Transaction;
+import java.util.Map;
+
+public class JTAToolInitializer implements IToolInitializer
+{
+ public void initialize(ToolPlugin plugin)
+ {
+ com.arjuna.ats.internal.jta.Implementations.initialise(); // needed for XAResourceRecord
+
+ InFlightTransactionPseudoStore.setTransactionLister(new TransactionLister(){
+ public Map<Uid, Transaction> getTransactions()
+ {
+ return TransactionImple.getTransactions();
+ }
+ });
+
+ UidInfo.setUidConverter(new UidConverter() {
+
+ public Uid toUid(Xid xid)
+ {
+ if (xid instanceof XidImple)
+ return XATxConverter.getUid(((XidImple) xid).getXID());
+
+ return null;
+ }
+ });
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/InFlightTransactionPseudoStore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/InFlightTransactionPseudoStore.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/InFlightTransactionPseudoStore.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,224 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.rootprovider;
+
+import com.arjuna.ats.arjuna.objectstore.ObjectStoreImple;
+import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.gandiva.inventory.InventoryElement;
+import com.arjuna.ats.arjuna.gandiva.ClassName;
+import com.arjuna.ats.arjuna.gandiva.ObjectName;
+import com.arjuna.ats.tools.objectstorebrowser.TransactionLister;
+
+import java.util.Set;
+import java.io.IOException;
+
+/**
+ * ObjectStore facade for objtaining a list of live transactions. The facade is required
+ * since the browser frame
+ * @see com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame
+ * will only display object store entries.
+ */
+public class InFlightTransactionPseudoStore extends ObjectStoreImple implements InventoryElement
+{
+ public static final String STORE_NAME = "InFlightTransactionPseudoStore";
+ private static final String TX_TYPE = "Transaction";
+ private static final String TX_TYPE_WS = "Transaction/";
+ private static TransactionLister transactionLister;
+
+ /**
+ * Abstract the mechanism used to discover which transactions are currently in existence
+ *
+ * @param transactionLister an interface that knows how to discover running transactions
+ */
+ public static void setTransactionLister(TransactionLister transactionLister)
+ {
+ InFlightTransactionPseudoStore.transactionLister = transactionLister;
+ }
+
+ public int typeIs()
+ {
+ return ObjectStoreType.USER_DEF_0;
+ }
+
+ /*
+ * allObjUids - Given a type name, return an ObjectState that contains all
+ * of the uids of objects of that type.
+ */
+ public boolean allObjUids(String typeName, InputObjectState buff, int m) throws ObjectStoreException
+ {
+ OutputObjectState store = new OutputObjectState();
+
+ if (typeName.endsWith(TX_TYPE_WS) || typeName.endsWith(TX_TYPE))
+ {
+ try
+ {
+// Set<Uid> uids = TransactionImple.getTransactions().keySet();
+ Set<Uid> uids = transactionLister.getTransactions().keySet();
+
+ for (Uid uid : uids)
+ uid.pack(store);
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+ }
+
+ try
+ {
+ Uid.nullUid().pack(store);
+ }
+ catch (IOException e)
+ {
+ throw new ObjectStoreException("allObjUids - could not pack end of list Uid.");
+ }
+
+ buff.setBuffer(store.buffer());
+
+ return true;
+ }
+
+ public boolean allTypes(InputObjectState buff) throws ObjectStoreException
+ {
+ try
+ {
+ OutputObjectState store = new OutputObjectState();
+ store.packString("Transaction");
+ store.packString("");
+
+ buff.setBuffer(store.buffer());
+
+ return true;
+ }
+ catch (IOException e)
+ {
+ throw new ObjectStoreException(tsLogger.arjLoggerI18N.getString("com.arjuna.ats.internal.arjuna.objectstore.packProblem"));
+ }
+ }
+
+ public int currentState(Uid u, String tn) throws ObjectStoreException
+ {
+ return ObjectStore.OS_UNCOMMITTED;
+ }
+
+ public String getStoreName()
+ {
+ return STORE_NAME;
+ }
+
+ public boolean commit_state(Uid u, String tn) throws ObjectStoreException
+ {
+ return false;
+ }
+
+ public boolean hide_state(Uid u, String tn) throws ObjectStoreException
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean reveal_state(Uid u, String tn) throws ObjectStoreException
+ {
+ return false;
+ }
+
+ public InputObjectState read_committed(Uid u, String tn) throws ObjectStoreException
+ {
+ TxInputObjectState ios = new TxInputObjectState(u, tn, new byte[0]);
+
+ ios.setRealObject(transactionLister.getTransactions().get(u));
+
+ return ios;
+ }
+
+ public InputObjectState read_uncommitted(Uid u, String tn) throws ObjectStoreException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean remove_committed(Uid u, String tn) throws ObjectStoreException
+ {
+ return false;
+ }
+
+ public boolean remove_uncommitted(Uid u, String tn) throws ObjectStoreException
+ {
+ return false;
+ }
+
+ public boolean write_committed(Uid u, String tn, OutputObjectState buff) throws ObjectStoreException
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean write_uncommitted(Uid u, String tn, OutputObjectState buff) throws ObjectStoreException
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ protected boolean supressEntry(String name)
+ {
+ return false;
+ }
+
+ // InventoryElement implementation
+ public synchronized Object createVoid ()
+ {
+ return new InFlightTransactionPseudoStore();
+ }
+
+ public synchronized Object createResources (Object[] param)
+ {
+ return createVoid();
+ }
+
+ public synchronized Object createClassName (ClassName className)
+ {
+ return null;
+ }
+
+ public synchronized Object createObjectName (ObjectName objectName)
+ {
+ return createVoid();
+ }
+
+ public synchronized Object createClassNameResources (ClassName className, Object[] resources)
+ {
+ return null;
+ }
+
+ public synchronized Object createObjectNameResources (ObjectName objectName, Object[] resources)
+ {
+ return null;
+ }
+
+ public ClassName className ()
+ {
+ return className;
+ }
+
+ private ClassName className = new ClassName(this.getClass().getSimpleName());
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxTester.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxTester.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/rootprovider/TxTester.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.rootprovider;
+
+import javax.transaction.*;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+import java.io.Serializable;
+
+public class TxTester
+{
+ static DummyTx[] ta = new DummyTx[2];
+
+ public void createTransactions()
+ {
+ boolean endTx = false;
+
+ for (int i = 0; i < ta.length; i++)
+ {
+ try
+ {
+ if (ta[i] == null || ta[i].terminateTxIfNotActive())
+ ta[i] = newTx(endTx);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (endTx)
+ ta[i] = null;
+ }
+ }
+ }
+
+ private DummyTx newTx(boolean commit)
+ {
+ DummyTx t = new DummyTx();
+
+ t.commit = commit;
+ t.start();
+ return t;
+ }
+
+ private class DummyTx extends Thread
+ {
+ UserTransaction ut;
+ Transaction tx;
+ boolean commit;
+
+ private Synchronization getSynchronization() throws SystemException, RollbackException
+ {
+ return new Synchronization() {
+ public void beforeCompletion()
+ {
+ System.out.println("Before completion");
+ }
+
+ public void afterCompletion(int i)
+ {
+ System.out.println("After completion");
+ }
+ };
+ }
+
+ public int getStatus()
+ {
+ try
+ {
+ return ut.getStatus();
+ }
+ catch (SystemException e)
+ {
+ System.out.println(e.getMessage());
+ return Status.STATUS_UNKNOWN;
+ }
+ }
+
+ public boolean terminateTxIfNotActive()
+ {
+ if (getStatus() != Status.STATUS_ACTIVE && getStatus() != Status.STATUS_NO_TRANSACTION)
+ {
+ try
+ {
+ ut.rollback();
+ }
+ catch (Throwable e)
+ {
+ System.out.println(e.getMessage());
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public void run()
+ {
+// Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ ut = com.arjuna.ats.jta.UserTransaction.userTransaction();
+
+ try{
+ ut.setTransactionTimeout(3000);
+ ut.begin();
+ tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ tx.registerSynchronization(getSynchronization());
+ tx.registerSynchronization(getSynchronization());
+ tx.enlistResource(new DummyXAResource(false));
+ tx.enlistResource(new DummyXAResource(true));
+ tx.enlistResource(new DummyXAResource(true));
+
+ if (commit)
+ ut.commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/InFlightTransactionViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/InFlightTransactionViewer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/InFlightTransactionViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionViewer;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.LiveAtomicActionWrapper;
+import com.arjuna.ats.tools.objectstorebrowser.ObjectStoreBrowserTreeManipulationInterface;
+import com.arjuna.ats.tools.objectstorebrowser.ObjectStoreBrowserPlugin;
+import com.arjuna.ats.tools.objectstorebrowser.rootprovider.TxInputObjectState;
+import com.arjuna.ats.tools.objectstorebrowser.rootprovider.InFlightTransactionPseudoStore;
+import com.arjuna.ats.tools.objectstorebrowser.rootprovider.TxTester;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.panels.SubTreeViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.UidNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.toolsframework.plugin.ToolPluginException;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.common.Environment;
+import com.arjuna.ats.arjuna.gandiva.ObjectName;
+import com.arjuna.ats.arjuna.gandiva.inventory.Inventory;
+import com.arjuna.ats.arjuna.ArjunaNames;
+import com.arjuna.ats.jta.transaction.Transaction;
+
+/**
+ * Viewer for inspecting running transaction within the object browser
+ */
+public class InFlightTransactionViewer extends AtomicActionViewer
+{
+ private static final String STORE_KEY = com.arjuna.ats.arjuna.common.Environment.STATIC_INVENTORY_IMPLE + '.' + InFlightTransactionPseudoStore.STORE_NAME;
+ private static final String STORE_VAL = "com.arjuna.ats.tools.objectstorebrowser.rootprovider.InFlightTransactionPseudoStore";
+
+ public InFlightTransactionViewer() throws ToolPluginException
+ {
+ //arjPropertyManager.propertyManager.setProperty(STORE_KEY, STORE_VAL);
+ Inventory.inventory().addToList(new InFlightTransactionPseudoStore());
+
+ if (ObjectStoreBrowserPlugin.getRootProvider() == null)
+ throw new ToolPluginException("No object store provider has been configured");
+
+ ObjectStoreBrowserPlugin.getRootProvider().addRoot(InFlightTransactionPseudoStore.STORE_NAME);
+
+// new TxTester().createTransactions();
+ }
+
+ public void uidNodeExpanded(ObjectStore os,
+ String type,
+ ObjectStoreBrowserTreeManipulationInterface manipulator,
+ UidNode uidNode,
+ StatePanel infoPanel) throws ObjectStoreException
+ {
+ if (!InFlightTransactionPseudoStore.STORE_NAME.equals(os.getStoreName()))
+ return; // called with the wrong store name
+
+ Uid theUid = uidNode.getUid();
+ Transaction delegate = null;
+ Object ios = os.read_committed(theUid, type);
+
+ if (ios instanceof TxInputObjectState)
+ delegate = (Transaction)((TxInputObjectState)ios).getRealObject();
+
+ LiveAtomicActionWrapper aaw = new LiveAtomicActionWrapper(delegate, theUid, getObjectName(os), type);
+ manipulator.clearEntries();
+
+ ListNode node;
+ SubTreeViewEntry entry;
+
+ node = new TxInfoNode("Tx Info", aaw, type);
+ entry = new TxInfoViewEntry(type, "Info", node);
+ addNode(manipulator, node, entry, "Basic Information");
+
+ node = new SynchronizationListNode("Synchronisations", aaw, type);
+ entry = new SynchronizationViewEntry(type + "Synchronisation", "Synchronisations", node);
+ addNode(manipulator, node, entry, aaw.getSynchronizationInfo().size() + " synchronizations");
+
+ node = new XAResourceListNode("XA Resources", aaw, type);
+ entry = new XAResourceViewEntry(type + "XAResource", "XA Resources", node);
+ addNode(manipulator, node, entry, aaw.getResources().size() + " resources");
+
+ }
+
+ // show current state of tx, synchronisations, XA resources
+ public String getType()
+ {
+ return "/Transaction/";
+ }
+
+ private ObjectName getObjectName(ObjectStore os) //XXX
+ {
+ ObjectName name = new ObjectName("PNS:");
+
+ try
+ {
+ name.setClassNameAttribute(Environment.OBJECTSTORE_TYPE, os.className());
+ name.setStringAttribute(ArjunaNames.StateManager_objectStoreRoot(), os.storeRoot());
+ }
+ catch (java.io.IOException e)
+ {
+ // Ignore
+ }
+
+ return name;
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/AbstractRecordViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/AbstractRecordViewer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/AbstractRecordViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,267 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord;
+
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.AbstractRecordStateViewerInterface;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.UidInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.IUidCollection;
+import com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord;
+
+import javax.swing.*;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Default viewer for abstract records
+ */
+public class AbstractRecordViewer implements AbstractRecordStateViewerInterface
+{
+ protected enum RecoveryOp {
+ NO_OP, COMMIT_OP, ABORT_OP, FORGET_OP
+ }
+
+ private XAResource xares;
+ private XAResourceRecord xaresrec;
+ private BasicActionInfo actionInfo;
+ private AbstractRecord record;
+ private StringBuilder msgBuf = new StringBuilder();
+
+ protected void updateTableData(AbstractRecord record, StatePanel statePanel)
+ {
+ UidInfo uidInfo = new UidInfo(record.order(), record.getClass().getName() + "@" + Integer.toHexString(record.hashCode()));
+
+ statePanel.setData("Creation Time", UidInfo.formatTime(uidInfo.getCreationTime()));
+ statePanel.setData("Age (seconds)", String.valueOf(uidInfo.getAge()));
+
+ statePanel.setData("Record Type", record.className().stringForm());
+ statePanel.setData("Type", record.type());
+ statePanel.setData("Uid", record.order().toString());
+
+ statePanel.updateColumnSizes();
+ statePanel.clearStatus();
+ }
+
+ public void entrySelected(final AbstractRecord record,
+ final BasicAction action,
+ final ObjectStoreViewEntry entry,
+ final StatePanel statePanel) throws ObjectStoreException
+ {
+ updateTableData(record, statePanel);
+
+ initRecord(action, record, entry);
+
+ statePanel.enableButton(StatePanel.FORGET_BUTTON_TEXT, new ActionListener() {
+ public void actionPerformed(ActionEvent ae)
+ {
+ if (startAction(statePanel, entry, "This operation will permanently remove this record."))
+ endAction(statePanel, entry, doForget(), true);
+ }});
+ statePanel.enableButton(StatePanel.COMMIT_BUTTON_TEXT, new ActionListener() {
+ public void actionPerformed(ActionEvent ae)
+ {
+ if (startAction(statePanel, entry, "This operation will attempt to commit this record."))
+ {
+ doCommit();
+ endAction(statePanel, entry, false, false);
+ }
+ }});
+ statePanel.enableButton(StatePanel.ROLLBACK_BUTTON_TEXT, new ActionListener() {
+ public void actionPerformed(ActionEvent ae)
+ {
+ if (startAction(statePanel, entry, "This operation will attempt to rollback this record."))
+ {
+ doRollback();
+ endAction(statePanel, entry, false, false);
+ }
+ }});
+ }
+
+ public AbstractRecord getRecord()
+ {
+ return record;
+ }
+
+ protected void initRecord(BasicAction action, AbstractRecord record, ObjectStoreViewEntry entry)
+ {
+ this.record = record;
+
+ if (action instanceof BasicActionInfo)
+ actionInfo = (BasicActionInfo) action;
+
+ if ((record instanceof RecoveryAbstractRecord))
+ {
+ RecoveryAbstractRecord rrec = (RecoveryAbstractRecord)record;
+ if (rrec.record() instanceof XAResourceRecord)
+ {
+ xaresrec = (XAResourceRecord) rrec.record();
+ xares = (XAResource) xaresrec.value();
+ }
+ }
+ else if ((record instanceof XAResourceRecord))
+ {
+ xaresrec = (XAResourceRecord) record;
+ xares = (XAResource) xaresrec.value();
+ }
+ }
+
+ protected boolean startAction(StatePanel statePanel, ObjectStoreViewEntry entry, String msg)
+ {
+ StringBuilder sb = new StringBuilder("<html><body>")
+ .append(msg).append("<br>")
+ .append("Do you wish to continue?")
+ .append("</body></html>");
+
+ return JOptionPane.showConfirmDialog(statePanel, sb.toString()) == JOptionPane.YES_OPTION;
+ }
+
+ protected void endAction(StatePanel statePanel, ObjectStoreViewEntry entry, boolean success, boolean removeRecord)
+ {
+ if (success)
+ {
+ if (removeRecord && entry.getNode().getParent() instanceof IUidCollection)
+ {
+ ((IUidCollection) entry.getNode().getParent()).remove(record.order());
+ // save the changes
+ if (!actionInfo.deactivate())
+ appendError("Failed to deactivate record");
+ }
+
+ JTree tree = BrowserFrame.getTree();
+ TreePath path = tree.getSelectionPath().getParentPath();
+
+ if (path == null)
+ {
+ TreeNode node = entry.getBrowserNode().getParent().getParent();
+
+ if (node != null)
+ path = new TreePath(BrowserFrame.getTreeModel().getPathToRoot(node));
+ }
+
+ if (path != null)
+ {
+ tree.collapsePath(path);
+ tree.setSelectionPath(path);
+ tree.scrollPathToVisible(path);
+ }
+ }
+
+ reportErrors(statePanel);
+ }
+
+ protected boolean doForget()
+ {
+ try
+ {
+ if (xares != null)
+ xares.forget(xaresrec.getXid());
+
+// if (!actionInfo.deactivate())
+// appendError("Failed to deactivate record");
+// else
+ return true;
+ }
+ catch (XAException e)
+ {
+ appendError("Failed to deactivate record: " + e.getMessage());
+ }
+
+ return false;
+ }
+
+ protected boolean doCommit()
+ {
+ // the user has asked to take control so commit 1PC
+ if (xares != null)
+ {
+ try
+ {
+ xares.commit(xaresrec.getXid(), true);
+ return true;
+ }
+ catch (XAException e)
+ {
+ appendError("Commit error: " + e.getMessage());
+ }
+ }
+
+ return false;
+ }
+
+ protected boolean doRollback()
+ {
+ if (xares != null)
+ {
+ try
+ {
+ xares.rollback(xaresrec.getXid());
+ return true;
+ }
+ catch (XAException e)
+ {
+ appendError("Rollback error: " + e.getMessage());
+ }
+ }
+
+ return false;
+ }
+
+ protected void appendError(String err)
+ {
+ if (msgBuf.length() != 0)
+ msgBuf.append("<br>");
+
+ msgBuf.append(err);
+ }
+
+ protected void clearErrors()
+ {
+ msgBuf.delete(0, msgBuf.length());
+ }
+
+ protected void reportErrors(StatePanel parent)
+ {
+ if (msgBuf.length() != 0)
+ {
+ parent.reportStatus(msgBuf.toString());
+ msgBuf.insert(0, "<html><body>");
+ msgBuf.append("</body></html>");
+ JOptionPane.showMessageDialog(parent, msgBuf.toString());
+ msgBuf.delete(0, msgBuf.length());
+ }
+ }
+
+ public String getType()
+ {
+ return "/StateManager/AbstractRecord/";
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/XAResourceRecordViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/XAResourceRecordViewer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/XAResourceRecordViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord;
+
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.XAResourceInfo;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord;
+import com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord;
+
+import javax.transaction.xa.XAResource;
+
+public class XAResourceRecordViewer extends AbstractRecordViewer
+{
+ protected void updateTableData(AbstractRecord record, StatePanel statePanel)
+ {
+ super.updateTableData(record, statePanel);
+
+ if (record instanceof RecoveryAbstractRecord)
+ {
+ record = ((RecoveryAbstractRecord) record).record();
+ }
+
+ if (record instanceof XAResourceRecord)
+ {
+ XAResourceRecord xarr = (XAResourceRecord) record;
+
+ if (xarr.value() != null)
+ {
+ try
+ {
+ XAResourceInfo xares = new XAResourceInfo((XAResource) xarr.value(), xarr.getXid(), "UNKNOWN");
+
+ statePanel.setData("Product Name", xares.getEisProductName());
+ statePanel.setData("Product Version", xares.getEisProductVersion());
+ statePanel.setData("Tx State", xares.getTxState());
+ statePanel.setData("Xid", xares.getXid());
+ statePanel.setData("Timeout", String.valueOf(xares.getTimeout()));
+ }
+ catch (Exception e)
+ {
+ statePanel.setData("XA Resource Info", xarr.value().toString());
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the type this state viewer is intended to be registered against. Should match up with
+ * the record store typeName()
+ * @return
+ */
+ public String getType()
+ {
+ return XAResourceRecord.typeName(); //"/StateManager/AbstractRecord/XAResourceRecord";
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction;
+
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons.*;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes.*;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.TxInfoNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.TxInfoViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.ArjunaTransactionWrapper;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.AtomicActionViewer;
+import com.arjuna.ats.tools.objectstorebrowser.ObjectStoreBrowserTreeManipulationInterface;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.panels.SubTreeViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.UidNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.common.Environment;
+import com.arjuna.ats.arjuna.gandiva.ObjectName;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+import com.arjuna.ats.arjuna.ArjunaNames;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *
+ * Arjuna Technologies Ltd.
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: ArjunaTransactionViewer.java 2342 2006-03-30 13:06:17Z $
+ */
+
+
+public class ArjunaTransactionViewer extends AtomicActionViewer
+{
+ /**
+ * A uid node of the type this viewer is registered against has been expanded.
+ * @param os
+ * @param type
+ * @param manipulator
+ * @param uidNode
+ * @throws ObjectStoreException
+ */
+ public void uidNodeExpanded(ObjectStore os,
+ String type,
+ ObjectStoreBrowserTreeManipulationInterface manipulator,
+ UidNode uidNode,
+ StatePanel infoPanel) throws ObjectStoreException
+ {
+ Uid theUid = uidNode.getUid();
+ ArjunaTransactionWrapper ba = new ArjunaTransactionWrapper(theUid,getObjectName(os), type);
+ ListNode node;
+ SubTreeViewEntry entry;
+
+ manipulator.clearEntries();
+
+ if ( !activate(ba) )
+ {
+ infoPanel.reportError("Failed to activate transaction");
+
+ node = new TxInfoNode("Tx Info", ba, type);
+ entry = new TxInfoViewEntry(type, "Info", node);
+ addNode(manipulator, node, entry, "Basic Information");
+ }
+ else
+ {
+ node = new TxInfoNode("Tx Info", ba, type);
+ entry = new TxInfoViewEntry(type, "Info", node);
+ addNode(manipulator, node, entry, "Basic Information");
+
+ manipulator.createEntry(node = new PreparedListNode("Prepared List", ba, type));
+ node.setIconPanelEntry(entry = new PreparedViewEntry(type, "Prepared List", node));
+ entry.setToolTipText(getListSize(ba.getPreparedList())+" entries");
+ node.add(new DefaultMutableTreeNode(""));
+
+ manipulator.createEntry(node = new PendingListNode("Pending List", ba, type));
+ node.setIconPanelEntry(entry = new PendingViewEntry(type, "Pending List", node));
+ entry.setToolTipText(getListSize(ba.getPendingList())+" entries");
+ node.add(new DefaultMutableTreeNode(""));
+
+ manipulator.createEntry(node = new HeuristicListNode("Heuristic List", ba, type));
+ node.setIconPanelEntry(entry = new HeuristicViewEntry(type, "Heuristic List", node));
+ entry.setToolTipText(getListSize(ba.getHeuristicList())+" entries");
+ node.add(new DefaultMutableTreeNode(""));
+
+ manipulator.createEntry(node = new FailedListNode("Failed List", ba, type));
+ node.setIconPanelEntry(entry = new FailedViewEntry(type, "Failed List", node));
+ entry.setToolTipText(getListSize(ba.getFailedList())+" entries");
+ node.add(new DefaultMutableTreeNode(""));
+
+ manipulator.createEntry(node = new ReadOnlyListNode("Read-only List", ba, type));
+ node.setIconPanelEntry(entry = new ReadOnlyViewEntry(type, "Read-only List", node));
+ entry.setToolTipText(getListSize(ba.getReadOnlyList())+" entries");
+ node.add(new DefaultMutableTreeNode(""));
+ }
+ }
+
+ private ObjectName getObjectName(ObjectStore os)
+ {
+ ObjectName name = new ObjectName("PNS:");
+
+ try
+ {
+ name.setClassNameAttribute(Environment.OBJECTSTORE_TYPE, os.className());
+ name.setStringAttribute(ArjunaNames.StateManager_objectStoreRoot(), os.storeRoot());
+ }
+ catch (java.io.IOException e)
+ {
+ // Ignore
+ }
+
+ return name;
+ }
+
+ /**
+ * Get the type this state viewer is intended to be registered against.
+ * @return
+ */
+ public String getType()
+ {
+ return "/StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple/";
+ }
+
+ private int getListSize(RecordList list)
+ {
+ return list != null ? list.size() : 0;
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ArjunaTransactionViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ArjunaTransactionViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ArjunaTransactionViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction.icons.AtomicTransactionViewEntry;
+
+public class ArjunaTransactionViewEntry extends AtomicTransactionViewEntry //ListViewEntry implements IconSelectionListener
+{
+ public ArjunaTransactionViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/FailedViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/FailedViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/FailedViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: FailedViewEntry.java 2342 2006-03-30 13:06:17Z $
+ */
+
+public class FailedViewEntry extends ArjunaTransactionViewEntry implements IconSelectionListener
+{
+ public FailedViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+ }
+
+ protected RecordList getList(BasicActionInfo wrapper)
+ {
+ return wrapper.getFailedList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/HeuristicViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/HeuristicViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/HeuristicViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: HeuristicViewEntry.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+public class HeuristicViewEntry extends ArjunaTransactionViewEntry implements IconSelectionListener
+{
+ public HeuristicViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+ }
+
+ protected RecordList getList(BasicActionInfo wrapper)
+ {
+ return wrapper.getHeuristicList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PendingViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PendingViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PendingViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: PendingViewEntry.java 2342 2006-03-30 13:06:17Z $
+ */
+public class PendingViewEntry extends ArjunaTransactionViewEntry implements IconSelectionListener
+{
+ public PendingViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+ }
+
+ protected RecordList getList(BasicActionInfo wrapper)
+ {
+ return wrapper.getPendingList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PreparedViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PreparedViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/PreparedViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: PreparedViewEntry.java 2342 2006-03-30 13:06:17Z $
+ */
+public class PreparedViewEntry extends ArjunaTransactionViewEntry implements IconSelectionListener
+{
+ public PreparedViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+
+ addSelectionListener(this);
+ }
+
+ protected RecordList getList(BasicActionInfo wrapper)
+ {
+ return wrapper.getPreparedList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ReadOnlyViewEntry.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ReadOnlyViewEntry.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/icons/ReadOnlyViewEntry.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons;
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ObjectStoreBrowserNode;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: ReadOnlyViewEntry.java 2342 2006-03-30 13:06:17Z $
+ */
+
+public class ReadOnlyViewEntry extends ArjunaTransactionViewEntry implements IconSelectionListener
+{
+ public ReadOnlyViewEntry(String tn, String label, ObjectStoreBrowserNode node)
+ {
+ super(tn, label, node);
+ }
+
+ protected RecordList getList(BasicActionInfo wrapper)
+ {
+ return wrapper.getReadOnlyList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ArjunaTransactionListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ArjunaTransactionListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ArjunaTransactionListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: ArjunaTransactionListNode.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.IUidCollection;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListEntryNode;
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.StateViewersRepository;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.AbstractRecordStateViewerInterface;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.ArjunaTransactionWrapper;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.tools.objectstorebrowser.frames.BrowserFrame;
+import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconPanelEntry;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.common.Uid;
+
+public abstract class ArjunaTransactionListNode extends ListNode implements IUidCollection, ListNodeListener, IconSelectionListener
+{
+ private BasicActionInfo wrapper;
+
+ public ArjunaTransactionListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ wrapper = (BasicActionInfo) assObject;
+ }
+
+ protected BasicActionInfo getAction()
+ {
+ return wrapper;
+ }
+
+ protected void invokeStateViewer(AbstractRecord record, ArjunaTransactionWrapper atw, IconPanelEntry entry)
+ {
+ AbstractRecordStateViewerInterface svi = StateViewersRepository.lookupAbstractRecordStateViewer(record.type());
+
+ if ( svi != null )
+ {
+ try
+ {
+ svi.entrySelected(record, atw, (ObjectStoreViewEntry)entry, BrowserFrame.getStatePanel());
+ }
+ catch (ObjectStoreException e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
+ else
+ {
+ System.out.println("Viewer not registered for "+record.type());
+ }
+ }
+
+ public boolean remove(Uid uid)
+ {
+ AbstractRecord rec = getList().peekFront();
+
+ while (rec != null)
+ {
+ if (rec.order().equals(uid))
+ return getList().remove(rec);
+
+ rec = getList().peekNext(rec);
+ }
+
+ return false;
+ }
+
+ public boolean contains(Uid uid)
+ {
+ AbstractRecord rec = getList().peekFront();
+
+ while (rec != null)
+ {
+ if (rec.order().equals(uid))
+ return true;
+
+ rec = getList().peekNext(rec);
+ }
+
+ return false;
+ }
+
+ public boolean contains(String uid)
+ {
+ AbstractRecord rec = getList().peekFront();
+
+ while (rec != null)
+ {
+ if (rec.order().stringForm().equals(uid))
+ return true;
+
+ rec = getList().peekNext(rec);
+ }
+
+ return false;
+ }
+
+ /**
+ * Called when the list node is expanded
+ * @param node
+ */
+ public void listExpanded(ListNode node)
+ {
+ super.listExpanded(node);
+
+ AbstractRecord current = getList().peekFront();
+ int count = 1;
+ while ( current != null )
+ {
+ ListEntryNode entryNode;
+ ObjectStoreViewEntry icon;
+ node.createEntry(entryNode = new ListEntryNode("["+count+"] "+current.type(), current, current.type()));
+ entryNode.setIconPanelEntry(icon = new ObjectStoreViewEntry(wrapper.type(), (String)entryNode.getUserObject(), entryNode));
+ icon.addSelectionListener(this);
+ current = getList().peekNext(current);
+ count++;
+ }
+ }
+
+ /**
+ * Called when one of the list entries is selected.
+ *
+ * @param icon
+ * @param selected
+ */
+ public void iconSelected(IconPanelEntry icon, boolean selected)
+ {
+ /** Get node and the associated AbstractRecord **/
+ ListEntryNode node = (ListEntryNode)(((ObjectStoreViewEntry)icon).getNode());
+ AbstractRecord record = (AbstractRecord)node.getAssociatedObject();
+ StatePanel panel = BrowserFrame.getStatePanel();
+
+ panel.clear();
+ panel.setType(record.type());
+
+ updatePanelData(panel, record);
+
+ invokeStateViewer(record, (ArjunaTransactionWrapper) getAssObject(), icon);
+ panel.repaint();
+ }
+
+ protected void updatePanelData(StatePanel panel, AbstractRecord record)
+ {
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/FailedListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/FailedListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/FailedListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *
+ * Arjuna Technologies Ltd.
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: FailedListNode.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+public class FailedListNode extends ArjunaTransactionListNode implements ListNodeListener, IconSelectionListener
+{
+ public FailedListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ public RecordList getList()
+ {
+ return getAction().getFailedList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/HeuristicListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/HeuristicListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/HeuristicListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: HeuristicListNode.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.*;
+import com.arjuna.ats.tools.objectstorebrowser.panels.*;
+import com.arjuna.ats.tools.toolsframework.iconpanel.*;
+
+import com.arjuna.ats.arjuna.coordinator.*;
+
+public class HeuristicListNode extends ArjunaTransactionListNode implements ListNodeListener, IconSelectionListener
+{
+ public HeuristicListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ protected void updatePanelData(StatePanel panel, AbstractRecord record)
+ {
+ if ( record.value() instanceof HeuristicInformation )
+ {
+ HeuristicInformation heuristicInfo = (HeuristicInformation)record.value();
+
+ panel.setData("Heuristic Type", TwoPhaseOutcome.stringForm(heuristicInfo.getHeuristicType()));
+ }
+ }
+
+ public RecordList getList()
+ {
+ return getAction().getHeuristicList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PendingListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PendingListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PendingListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *
+ * Arjuna Technologies Ltd.
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: PendingListNode.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+public class PendingListNode extends ArjunaTransactionListNode implements ListNodeListener, IconSelectionListener
+{
+ public PendingListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ public RecordList getList()
+ {
+ return getAction().getPendingList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PreparedListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PreparedListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/PreparedListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *
+ * Arjuna Technologies Ltd.
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: PreparedListNode.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+public class PreparedListNode extends ArjunaTransactionListNode implements ListNodeListener, IconSelectionListener
+{
+ public PreparedListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ public RecordList getList()
+ {
+ return getAction().getPreparedList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ReadOnlyListNode.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ReadOnlyListNode.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/nodes/ReadOnlyListNode.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *
+ * Arjuna Technologies Ltd.
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: ReadOnlyListNode.java 2342 2006-03-30 13:06:17Z $
+ */
+
+import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNodeListener;
+import com.arjuna.ats.tools.toolsframework.iconpanel.IconSelectionListener;
+import com.arjuna.ats.arjuna.coordinator.RecordList;
+
+public class ReadOnlyListNode extends ArjunaTransactionListNode implements ListNodeListener, IconSelectionListener
+{
+ public ReadOnlyListNode(Object userObject, Object assObject, String type)
+ {
+ super(userObject, assObject, type);
+ }
+
+ public RecordList getList()
+ {
+ return getAction().getReadOnlyList();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/LiveAtomicActionWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/LiveAtomicActionWrapper.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/atomicaction/LiveAtomicActionWrapper.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.atomicaction;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.gandiva.ObjectName;
+import com.arjuna.ats.jta.transaction.Transaction;
+import com.arjuna.ats.internal.jta.xa.TxInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.UidInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.SynchronizationInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.XAResourceInfo;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.ArjunaTransactionWrapper;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.SystemException;
+
+import java.util.Map;
+import java.util.Collection;
+import java.util.ArrayList;
+
+public class LiveAtomicActionWrapper extends ArjunaTransactionWrapper //AtomicActionWrapper
+{
+ private UidInfo uidInfo;
+ private Transaction delegate;
+ private Collection<SynchronizationInfo> synchronizations;
+ private Collection<XAResourceInfo> resources;
+
+ public LiveAtomicActionWrapper(Transaction delegate, Uid objUid, ObjectName objectName, String type)
+ {
+ super(objUid, objectName, type); //XXX
+ uidInfo = new UidInfo(objUid, getClass().getName() + "@" + Integer.toHexString(hashCode()));
+ this.delegate = delegate;
+ }
+
+ public UidInfo getUidInfo()
+ {
+ return uidInfo;
+ }
+
+// public Object getDelegate()
+// {
+// return delegate;
+// }
+
+ public int getTxTimeout()
+ {
+ return delegate == null ? super.getTxTimeout() : delegate.getTimeout();
+ }
+
+ public int getStatus()
+ {
+ try
+ {
+ return delegate == null ? super.getStatus() : delegate.getStatus();
+ }
+ catch (SystemException e)
+ {
+ System.out.println(e.getMessage());
+ return javax.transaction.Status.STATUS_UNKNOWN;
+ }
+ }
+
+ public Collection<SynchronizationInfo> getSynchronizationInfo()
+ {
+ if (delegate == null)
+ return super.getSynchronizationInfo();
+
+ if (synchronizations == null)
+ {
+ synchronizations = new ArrayList<SynchronizationInfo> ();
+
+ for (Map.Entry<Uid, String> me : delegate.getSynchronizations().entrySet())
+ synchronizations.add(new SynchronizationInfo(me.getKey(), me.getValue()));
+ }
+
+ return synchronizations;
+ }
+
+ public Collection<XAResourceInfo> getResources()
+ {
+ if (delegate == null)
+ return super.getResources();
+
+ if (resources == null)
+ {
+ resources = new ArrayList<XAResourceInfo>();
+
+ for (Map.Entry<XAResource, TxInfo> me : delegate.getResources().entrySet())
+ resources.add(new XAResourceInfo(me.getKey(), me.getValue().xid(), txState(me.getValue())));
+ }
+
+ return resources;
+ }
+
+ private String txState(TxInfo info)
+ {
+ switch (info.getState())
+ {
+ case TxInfo.ASSOCIATED: return "TxInfo.ASSOCIATED";
+ case TxInfo.NOT_ASSOCIATED: return "TxInfo.NOT_ASSOCIATED";
+ case TxInfo.ASSOCIATION_SUSPENDED: return "TxInfo.ASSOCIATION_SUSPENDED";
+ case TxInfo.FAILED: return "TxInfo.FAILED";
+ case TxInfo.OPTIMIZED_ROLLBACK: return "TxInfo.OPTIMIZED_ROLLBACK";
+ default:
+ // FALLTHRU
+ case TxInfo.UNKNOWN: return "TxInfo.UNKNOWN";
+ }
+ }
+
+ public boolean isLive()
+ {
+ return true;
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTA/tsmx/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/tsmx/build.xml (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTA/tsmx/build.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,192 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ as indicated by the @author tags.
+ See the copyright.txt in the distribution for a full listing
+ of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU General Public License, v. 2.0.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License,
+ v. 2.0 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+<project name="module-tsmx" default="com.arjuna.mw.ts.tsmx.compile" basedir=".">
+ <!-- class path behaviour -->
+ <property name="build.sysclasspath" value="last"/>
+ <property name="com.hp.mwlabs.classpathbuilderfilename" location="buildsystem.classpath"/>
+
+ <!-- Set module name -->
+ <property name="com.arjuna.mwlabs.ts.modulename" value="tsmx"/>
+ <property name="com.arjuna.arjunacore.tsmx.lib"
+ location="${com.arjuna.arjunacore.dir}/tsmx/lib"/>
+ <property name="com.arjuna.arjunacore.tsmx.tools"
+ location="${com.arjuna.arjunacore.tsmx.lib}/bin/tools"/>
+
+ <!-- Load Build Properties File -->
+ <property file="${com.arjuna.mw.ts.properties}"/>
+
+ <!-- Set internal property defaults -->
+ <!-- Path names -->
+ <property name="com.arjuna.mwlabs.ts.tsmx.destroot" location="build"/>
+ <property name="com.arjuna.mwlabs.ts.tsmx.jar.dest" location="lib"/>
+ <property name="com.arjuna.mwlabs.ts.tsmx.utilities.src" location="bin"/>
+ <property name="com.arjuna.mwlabs.ts.tsmx.utilities.dest" location="${com.arjuna.mwlabs.ts.tsmx.destroot}/bin"/>
+ <property name="com.arjuna.mwlabs.ts.tsmx.tmp" location="${com.arjuna.mwlabs.ts.tsmx.destroot}/tmp"/>
+
+ <!-- Initialisation -->
+ <target name="com.arjuna.mwlabs.ts.tsmx.init">
+ <!-- Define default build properties -->
+ <tstamp>
+ <format property="com.arjuna.mw.date" pattern="yyyy/MMM/dd HH:mm"/>
+ </tstamp>
+
+ <!-- Define classpath builder task -->
+ <taskdef name="classpath-builder" classname="com.hp.mw.buildsystem.ant.ClasspathBuilder" classpath="${com.arjuna.buildsystem.classpath}"/>
+
+ <condition property="com.arjuna.mwlabs.ts.tsmx.utilities.compile">
+ <equals arg1="${com.arjuna.mw.ts.tsmx.utilities.compile}" arg2="yes"/>
+ </condition>
+
+ <condition property="com.arjuna.mwlabs.ts.tsmx.utilities.install">
+ <equals arg1="${com.arjuna.mw.ts.tsmx.utilities.install}" arg2="yes"/>
+ </condition>
+
+ <condition property="com.arjuna.mwlabs.ts.tsmx.utilities.jar">
+ <equals arg1="${com.arjuna.mw.ts.tsmx.utilities.jar}" arg2="yes"/>
+ </condition>
+
+ <property name="com.arjuna.mw.installationdirectory" value="install"/>
+ <property name="com.arjuna.mw.sourceid" value="unknown"/>
+ <property name="com.arjuna.mw.version" value="unknown"/>
+ <property name="com.arjuna.mw.builder" value="JBoss Inc. [${user.name}] (${os.name} ${os.version})"/>
+ <property name="com.arjuna.mw.notes" value=""/>
+ <echo message="Initialising module tsmx"/>
+ <echo message="Source ID = ${com.arjuna.mw.sourceid}"/>
+ <echo message="Version = ${com.arjuna.mw.version}"/>
+ <echo message="Builder = ${com.arjuna.mw.builder}"/>
+ <echo message="Date = ${com.arjuna.mw.date}"/>
+ <echo message="Notes = ${com.arjuna.mw.notes}"/>
+
+ <!-- Installation directory -->
+ <property name="com.arjuna.mwlabs.installationdirectory" location="${com.arjuna.mw.installationdirectory}"/>
+
+ <!-- Compile with debugging? -->
+ <condition property="com.arjuna.mwlabs.debug" value="no">
+ <equals arg1="${com.arjuna.mw.debug}" arg2="no"/>
+ </condition>
+ <property name="com.arjuna.mwlabs.debug" value="yes"/>
+
+ <!-- Compile with deprecation? -->
+ <condition property="com.arjuna.mwlabs.deprecation" value="yes">
+ <equals arg1="${com.arjuna.mw.deprecation}" arg2="yes"/>
+ </condition>
+ <property name="com.arjuna.mwlabs.deprecation" value="no"/>
+
+ <!-- setup classpath -->
+ <property name="com.arjuna.arjunacore.tsmx.dir" location="${com.arjuna.arjunacore.dir}/tsmx"/>
+ <property name="com.arjuna.arjunacore.tsmx.lib.dir" location="${com.arjuna.arjunacore.tsmx.dir}/lib"/>
+ <property name="com.arjuna.arjunacore.tsmx.bin.dir" location="${com.arjuna.arjunacore.tsmx.lib.dir}/bin.tools"/>
+
+ <path id="tsmx.classpath">
+ <fileset dir="${com.arjuna.arjunacore.tsmx.lib.dir}" includes="**/*.jar"/>
+ </path>
+ <property name="tsmx.classpath" refid="tsmx.classpath"/>
+
+ <classpath-builder filename="${com.hp.mwlabs.classpathbuilderfilename}" inproperty="build.classpath"/>
+ </target>
+
+ <target name="com.arjuna.mw.ts.tsmx.compile" depends="com.arjuna.mwlabs.ts.tsmx.utilities.compile"/>
+
+ <target name="com.arjuna.mwlabs.ts.tsmx.utilities.compile" depends="com.arjuna.mwlabs.ts.tsmx.init">
+
+ <echo message="Compiling utilities"/>
+
+ <mkdir dir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}"/>
+
+ <javac
+ srcdir="${com.arjuna.mwlabs.ts.tsmx.utilities.src}"
+ destdir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}"
+ debug="${com.arjuna.mwlabs.debug}"
+ deprecation="${com.arjuna.mwlabs.deprecation}">
+ <classpath>
+ <path path="${build.classpath}"/>
+ <path path="${tsmx.classpath}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="com.arjuna.mw.ts.tsmx.jar" depends="com.arjuna.mwlabs.ts.tsmx.utilities.jar"/>
+
+ <target name="com.arjuna.mwlabs.ts.tsmx.utilities.jar" depends="com.arjuna.mwlabs.ts.tsmx.utilities.compile">
+
+ <echo message="Building utilities jar file"/>
+
+ <mkdir dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}"/>
+ <mkdir dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/plugins"/>
+
+ <property name="objectstorebrowser" value="${com.arjuna.mwlabs.ts.modulename}-objectstorebrowser.jar"/>
+ <delete dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ <mkdir dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ <unzip src="${com.arjuna.arjunacore.tsmx.tools}/${objectstorebrowser}" dest="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+
+ <copy todir="${com.arjuna.mwlabs.ts.tsmx.tmp}" overwrite="true">
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}"
+ includes="com/arjuna/ats/tools/objectstorebrowser/**/*.class"
+ excludes="com/arjuna/ats/tools/toolsframework/**/*.class,com/arjuna/ats/tools/objecstorebrowser/stateviewers/viewers/**/*.class"/>
+ </copy>
+ <zip zipfile="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/${objectstorebrowser}" basedir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+
+ <property name="osbv-default" value="plugins/osbv-defaults.jar"/>
+ <delete dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ <mkdir dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ <unzip src="${com.arjuna.arjunacore.tsmx.tools}/${osbv-default}" dest="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+
+ <copy todir="${com.arjuna.mwlabs.ts.tsmx.tmp}" overwrite="true">
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}"
+ includes="com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/**/*.class"
+ excludes="com/arjuna/ats/tools/toolsframework/**"/>
+ </copy>
+ <zip zipfile="${com.arjuna.mwlabs.ts.tsmx.jar.dest}/${osbv-default}" basedir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ <delete dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ </target>
+
+ <!-- Installation targets -->
+ <target name="com.arjuna.mw.ts.tsmx.install" depends="com.arjuna.mw.ts.tsmx.compile, com.arjuna.mwlabs.ts.tsmx.utilities.install">
+
+ <echo message="Installing module tsmx"/>
+
+ </target>
+
+ <target name="com.arjuna.mwlabs.ts.tsmx.utilities.install" depends="com.arjuna.mwlabs.ts.tsmx.utilities.jar">
+
+ <echo message="Installing utilities"/>
+
+ <mkdir dir="${com.hp.mwlabs.installationdirectory}/bin/tools"/>
+ <copy todir="${com.hp.mwlabs.installationdirectory}/bin/tools">
+ <fileset dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}" includes="**/*.jar"/>
+ </copy>
+ </target>
+
+ <!-- Clean targets -->
+ <target name="com.arjuna.mw.ts.tsmx.clean">
+
+ <echo message="Cleaning module"/>
+ <delete dir="${com.arjuna.mwlabs.ts.tsmx.destroot}"/>
+
+ <delete dir="${com.arjuna.mwlabs.ts.tsmx.jar.dest}"/>
+ </target>
+
+ <!-- Short target names -->
+ <target name="compile" depends="com.arjuna.mw.ts.tsmx.compile"/>
+ <target name="jar" depends="com.arjuna.mw.ts.tsmx.jar"/>
+ <target name="install" depends="com.arjuna.mw.ts.tsmx.install"/>
+ <target name="clean" depends="com.arjuna.mw.ts.tsmx.clean"/>
+</project>
Added: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/ManagedSynchronizationImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/ManagedSynchronizationImple.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/ManagedSynchronizationImple.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.internal.jta.resources.jts.orbspecific;
+
+import com.arjuna.ArjunaOTS.ManagedSynchronizationOperations;
+
+public class ManagedSynchronizationImple extends SynchronizationImple implements ManagedSynchronizationOperations
+{
+ private javax.transaction.Synchronization ptr;
+
+ public ManagedSynchronizationImple(javax.transaction.Synchronization ptr) {
+ super(ptr);
+ this.ptr = ptr;
+ }
+
+ protected org.omg.PortableServer.Servant getPOATie() {
+ return new com.arjuna.ArjunaOTS.ManagedSynchronizationPOATie(this);
+ }
+
+ public String implementationType()
+ {
+ return ptr.getClass().getName();
+ }
+
+ public String instanceName()
+ {
+ return ptr.toString();
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -38,6 +38,7 @@
import com.arjuna.ats.internal.jta.resources.jts.orbspecific.LastResourceRecord;
import com.arjuna.ats.internal.jta.resources.jts.orbspecific.SynchronizationImple;
import com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord;
+import com.arjuna.ats.internal.jta.resources.jts.orbspecific.ManagedSynchronizationImple;
import com.arjuna.ats.jta.resources.LastResourceCommitOptimisation;
import com.arjuna.ats.jta.utils.XAHelper;
@@ -458,7 +459,7 @@
"TransactionImple.registerSynchronization - "
+ jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.nullparam"));
- registerSynchronizationImple(new SynchronizationImple(sync));
+ registerSynchronizationImple(new ManagedSynchronizationImple(sync));
}
// package-private method also for use by
@@ -1826,8 +1827,31 @@
return XA_TRANSACTION_TIMEOUT_ENABLED ;
}
- protected AtomicTransaction _theTransaction;
+ public static Map<Uid, javax.transaction.Transaction> getTransactions()
+ {
+ return Collections.unmodifiableMap(_transactions);
+ }
+ public Map<XAResource, TxInfo> getResources()
+ {
+ return Collections.unmodifiableMap(_resources);
+ }
+
+ public int getTimeout()
+ {
+ return _theTransaction.getTimeout();
+ }
+
+ public java.util.Map<Uid, String> getSynchronizations()
+ {
+ if (_theTransaction != null)
+ return _theTransaction.getControlWrapper().getSynchronizations();
+
+ return Collections.EMPTY_MAP;
+ }
+
+ protected AtomicTransaction _theTransaction;
+
private Hashtable _resources;
private Hashtable _duplicateResources;
private int _suspendCount;
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ControlWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ControlWrapper.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ControlWrapper.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -51,6 +51,7 @@
import org.omg.CORBA.CompletionStatus;
import java.lang.NullPointerException;
+import java.util.Collections;
import org.omg.CosTransactions.SubtransactionsUnavailable;
import org.omg.CosTransactions.NoTransaction;
@@ -444,7 +445,15 @@
}
}
- public final org.omg.CosTransactions.Status get_status ()
+ public java.util.Map<Uid, String> getSynchronizations()
+ {
+ if ( _controlImpl.getImplHandle() == null)
+ return Collections.EMPTY_MAP;
+ else
+ return _controlImpl.getImplHandle().getSynchronizations();
+ }
+
+ public final org.omg.CosTransactions.Status get_status ()
throws SystemException
{
try
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -2412,4 +2412,38 @@
}
}
+ public java.util.Map<Uid, String> getSynchronizations()
+ {
+ if (_synchs != null)
+ {
+ java.util.Map<Uid, String> synchMap = new java.util.HashMap<Uid, String> ();
+ SynchronizationRecord[] synchs = (SynchronizationRecord[]) _synchs.toArray(new SynchronizationRecord[] {});
+
+ for (SynchronizationRecord synch : synchs)
+ {
+ Synchronization c = synch.contents();
+ String cn;
+
+ if (c._is_a(ManagedSynchronizationHelper.id()))
+ {
+ ManagedSynchronization mc = ManagedSynchronizationHelper.narrow(c);
+
+ try {
+ cn = mc.instanceName(); //implementationType() ;
+ } catch (Throwable t) {
+ cn = synch.getClass().getCanonicalName();
+ }
+ }
+ else {
+ cn = synch.getClass().getCanonicalName();
+ }
+
+ synchMap.put(synch.get_uid(), cn);
+ }
+
+ return synchMap;
+ }
+
+ return Collections.EMPTY_MAP;
+ }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/idl/arjuna/ArjunaOTS.idl
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/idl/arjuna/ArjunaOTS.idl 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/idl/arjuna/ArjunaOTS.idl 2008-07-28 17:23:01 UTC (rev 21258)
@@ -148,6 +148,13 @@
interface JTAInterposedSynchronization : CosTransactions::Synchronization
{
};
+
+ // for managing synchronisations via the admin tools
+ interface ManagedSynchronization : CosTransactions::Synchronization
+ {
+ readonly attribute string implementationType;
+ readonly attribute string instanceName;
+ };
};
#endif
Added: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTSToolInitializer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTSToolInitializer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/JTSToolInitializer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser;
+
+import com.arjuna.ats.tools.toolsframework.plugin.ToolPlugin;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.UidInfo;
+import com.arjuna.ats.tools.objectstorebrowser.rootprovider.InFlightTransactionPseudoStore;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.jta.xa.XidImple;
+import com.arjuna.ats.internal.arjuna.utils.XATxConverter;
+import com.arjuna.ats.internal.jta.transaction.jts.TransactionImple;
+
+import javax.transaction.xa.Xid;
+import javax.transaction.Transaction;
+import java.util.Map;
+
+public class JTSToolInitializer implements IToolInitializer
+{
+ public void initialize(ToolPlugin plugin)
+ {
+ com.arjuna.ats.internal.jts.Implementations.initialise();
+ com.arjuna.ats.internal.jta.Implementationsx.initialise(); // needed for XAResourceRecord
+ com.arjuna.ats.internal.jta.Implementations.initialise(); // needed for XAResourceRecord
+
+ InFlightTransactionPseudoStore.setTransactionLister(new TransactionLister(){
+ public Map<Uid, Transaction> getTransactions()
+ {
+ return TransactionImple.getTransactions();
+ }
+ });
+
+ UidInfo.setUidConverter(new UidConverter() {
+
+ public Uid toUid(Xid xid)
+ {
+ if (xid instanceof XidImple)
+ return XATxConverter.getUid(((XidImple) xid).getXID());
+
+ return null;
+ }
+ });
+ }
+}
Deleted: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceActionHandle.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource;
-
-import com.arjuna.ats.arjuna.coordinator.BasicAction;
-import com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord;
-
-public class ResourceActionHandle
-{
- private BasicAction _action;
- private RecoveryAbstractRecord _res;
-
- public ResourceActionHandle(BasicAction action, RecoveryAbstractRecord res)
- {
- _action = action;
- _res = res;
- }
-
- public BasicAction getAction()
- {
- return _action;
- }
-
- public RecoveryAbstractRecord getAbstractRecord()
- {
- return _res;
- }
-
-}
Modified: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceEntityViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceEntityViewer.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceEntityViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -32,7 +32,6 @@
*/
import com.arjuna.ats.tools.objectstorebrowser.entityviewer.EntityViewerInterface;
-import com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource.ResourceViewDialog;
import javax.swing.*;
@@ -53,9 +52,9 @@
*/
public void viewEntity(String type, Object value, JPanel panel)
{
- if ( value instanceof ResourceActionHandle )
+ if ( value instanceof AbstractResourceActionHandle )
{
- ResourceActionHandle rah = (ResourceActionHandle)value;
+ AbstractResourceActionHandle rah = (AbstractResourceActionHandle)value;
new ResourceViewDialog(null, type, rah);
}
Modified: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceViewDialog.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceViewDialog.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/entityviewer/viewers/resource/ResourceViewDialog.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -32,9 +32,15 @@
*/
import com.arjuna.ats.internal.jts.resources.ResourceRecord;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.ArjunaTransactionWrapper;
+import com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord;
+import com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord;
+import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.BasicActionInfo;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord;
import javax.swing.*;
+import javax.transaction.xa.XAResource;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
@@ -46,7 +52,7 @@
private final static String CLOSE_BUTTON_LABEL = "Close";
private final static String FORGET_BUTTON_LABEL = "Forget";
- private ResourceActionHandle _resourceActionHandle;
+ private AbstractResourceActionHandle _resourceActionHandle;
/**
* Creates a non-modal dialog without a title with the
@@ -54,12 +60,10 @@
*
* @param owner the <code>Frame</code> from which the dialog is displayed
*/
- public ResourceViewDialog(Frame owner, String type, ResourceActionHandle rah)
+ public ResourceViewDialog(Frame owner, String type)
{
super(owner, DIALOG_TITLE);
- _resourceActionHandle = rah;
-
/** Create layout manager **/
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
@@ -94,9 +98,15 @@
getContentPane().add(buttonPanel);
pack();
- show();
+ setVisible(true);
}
+ public ResourceViewDialog(Frame owner, String type, AbstractResourceActionHandle rah)
+ {
+ this(owner, type);
+ this._resourceActionHandle = rah;
+ }
+
/**
* Invoked when an action occurs.
*/
@@ -111,20 +121,57 @@
dispose();
}
else
- if ( actionCommand.equals(FORGET_BUTTON_LABEL) )
+ if ( actionCommand.equals(FORGET_BUTTON_LABEL))
{
if ( JOptionPane.showConfirmDialog(this, "Are you sure you wish to do this?") == JOptionPane.YES_OPTION )
{
try
{
/** Call forget on the resource handle **/
- ((ResourceRecord)_resourceActionHandle.getAbstractRecord().record()).resourceHandle().forget();
+ AbstractRecord ar = _resourceActionHandle.getAbstractRecord();
+ if (ar instanceof ResourceRecord)
+ {
+ ((ResourceRecord)ar).resourceHandle().forget();
+ }
+ else if (ar instanceof XAResourceRecord)
+ {
+ XAResourceRecord rc = (XAResourceRecord) ar;
+
+ ((XAResource)rc.value()).forget(rc.getXid());
+ }
+ else if (ar instanceof RecoveryAbstractRecord)
+ {
+ ar = ((RecoveryAbstractRecord) ar).record();
+ ar.forgetHeuristic();
+ }
+ else if (ar instanceof ExtendedResourceRecord)
+ {
+ // call forget on the OTS Resource
+ try
+ {
+ ((ExtendedResourceRecord) ar).resourceHandle().forget();
+ }
+ catch (Exception e1)
+ {
+ int res = JOptionPane.showConfirmDialog(this, "An error occurred during forget: "+e1.getMessage() + ". Do you wish to continue");
+
+ if (res != JOptionPane.YES_OPTION)
+ {
+ e1.printStackTrace();
+ return;
+ }
+ }
+ }
+
/** Remove the abstract record from the heuristic list **/
- ((ArjunaTransactionWrapper)_resourceActionHandle.getAction()).getHeuristicList().remove(_resourceActionHandle.getAbstractRecord().record());
+ BasicAction action = _resourceActionHandle.getAction();
+ if (action instanceof BasicActionInfo)
+ ((BasicActionInfo) action).getHeuristicList().remove(ar);
+
/** Persist state **/
- if ( !_resourceActionHandle.getAction().deactivate() )
+ if ( !action.deactivate() )
{
JOptionPane.showMessageDialog(this, "Failed to persist the action");
}
Added: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/FactoryContactItemWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/FactoryContactItemWrapper.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/FactoryContactItemWrapper.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers;
+
+import com.arjuna.ats.internal.jts.recovery.contact.FactoryContactItem;
+
+//TODO
+public class FactoryContactItemWrapper
+{
+ FactoryContactItem delegate;
+}
Added: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ExtendedResourceRecordViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ExtendedResourceRecordViewer.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ExtendedResourceRecordViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.abstractrecord;
+
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
+import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
+import com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord;
+
+public class ExtendedResourceRecordViewer extends ResourceRecordViewer //AbstractRecordViewer
+{
+ protected void updateTableData(AbstractRecord record, StatePanel statePanel)
+ {
+ super.updateTableData(record, statePanel);
+
+ if (record instanceof ExtendedResourceRecord)
+ {
+ ExtendedResourceRecord xarr = (ExtendedResourceRecord) record;
+
+ if (xarr.value() != null)
+ statePanel.setData("Resource", xarr.value().toString());
+ }
+ }
+
+ public void entrySelected(final AbstractRecord record,
+ final BasicAction action,
+ final ObjectStoreViewEntry entry,
+ final StatePanel statePanel) throws ObjectStoreException
+ {
+ super.entrySelected(record, action, entry, statePanel);
+ }
+
+ /**
+ * Get the type this state viewer is intended to be registered against. Should match up with
+ * the record store type() (shame it's not a static method
+ * @return
+ */
+ public String getType()
+ {
+ return "/StateManager/AbstractRecord/ExtendedResourceRecord";
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ResourceRecordViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ResourceRecordViewer.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/abstractrecord/ResourceRecordViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -31,31 +31,35 @@
* $Id: ResourceRecordViewer.java 2342 2006-03-30 13:06:17Z $
*/
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.AbstractRecordStateViewerInterface;
-import com.arjuna.ats.tools.objectstorebrowser.entityviewer.EntityViewerRepository;
-import com.arjuna.ats.tools.objectstorebrowser.entityviewer.EntityViewerInterface;
-import com.arjuna.ats.tools.objectstorebrowser.entityviewer.viewers.resource.ResourceActionHandle;
import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
import com.arjuna.ats.tools.objectstorebrowser.panels.ObjectStoreViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.panels.DetailsButtonAdapter;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
import com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord;
import com.arjuna.ats.arjuna.coordinator.BasicAction;
+import com.arjuna.ats.arjuna.coordinator.TwoPhaseOutcome;
import com.arjuna.ats.internal.jts.Implementations;
+import com.arjuna.ats.internal.jts.ORBManager;
import com.arjuna.ats.internal.jts.resources.ResourceRecord;
+import com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord;
+import com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.OA;
-import javax.swing.*;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.XAException;
+import org.omg.CosTransactions.HeuristicHazard;
+import org.omg.CosTransactions.HeuristicMixed;
+import org.omg.CosTransactions.HeuristicCommit;
+
/**
* This is a state viewer for a JTS ResourceRecord.
*
* @author Richard A. Begg (richard.begg at arjuna.com)
* @version $Id: ResourceRecordViewer.java 2342 2006-03-30 13:06:17Z $
*/
-public class ResourceRecordViewer implements AbstractRecordStateViewerInterface
+public class ResourceRecordViewer extends AbstractRecordViewer
{
private final static String ORB_NAME = "tools-orb";
@@ -68,11 +72,14 @@
{
try
{
- _orb = ORB.getInstance(ORB_NAME);
- OA oa = OA.getRootOA(_orb);
+ if (!ORBManager.isInitialised())
+ {
+ _orb = ORB.getInstance(ORB_NAME);
+ OA oa = OA.getRootOA(_orb);
- _orb.initORB((String[])null, null);
- oa.initPOA(null);
+ _orb.initORB((String[])null, null);
+ oa.initPOA(null);
+ }
Implementations.initialise();
}
@@ -97,25 +104,191 @@
final ObjectStoreViewEntry entry,
final StatePanel statePanel) throws ObjectStoreException
{
- final RecoveryAbstractRecord rec = ((RecoveryAbstractRecord)record);
+ super.entrySelected(record, action, entry, statePanel);
+ }
- statePanel.enableDetailsButton(new DetailsButtonAdapter() {
- public void detailsButtonPressed()
- {
- EntityViewerInterface evi = EntityViewerRepository.getEntityViewer(ResourceActionHandle.class.getName());
+ protected void initRecord(BasicAction action, AbstractRecord record, ObjectStoreViewEntry entry)
+ {
+ super.initRecord(action, record, entry);
+ }
- if ( evi != null )
- {
- evi.viewEntity(ResourceActionHandle.class.getName(), new ResourceActionHandle(action, rec), statePanel);
- }
- else
- {
- JOptionPane.showMessageDialog(null, "No viewer defined for this entity");
- }
+ protected boolean doOp(ResourceRecord record, RecoveryOp op)
+ {
+ try
+ {
+ switch (op) {
+ case FORGET_OP:
+ record.resourceHandle().forget();
+ break;
+ case COMMIT_OP:
+ // commit 1PC since the user is bypassing the TM
+ record.resourceHandle().commit_one_phase();
+ break;
+ case ABORT_OP:
+ record.resourceHandle().rollback();
+ break;
+ default:
}
- });
+
+ return true;
+ }
+ catch (HeuristicMixed e)
+ {
+ appendError("Heuristic mixed error: " + e.getMessage());
+ }
+ catch (HeuristicHazard e)
+ {
+ appendError("Heuristic hazard error: " + e.getMessage());
+ }
+ catch (HeuristicCommit e)
+ {
+ appendError("Heuristic commit error: " + e.getMessage());
+ }
+ catch (Throwable t)
+ {
+ appendError("Error: " + t.getMessage());
+ }
+
+ return false;
}
+ protected boolean doOp(ExtendedResourceRecord record, RecoveryOp op)
+ {
+ try
+ {
+ switch (op) {
+ case FORGET_OP:
+ record.resourceHandle().forget();
+ break;
+ case COMMIT_OP:
+ record.resourceHandle().commit_one_phase();
+ break;
+ case ABORT_OP:
+ record.resourceHandle().rollback();
+ break;
+ default:
+ }
+
+ return true;
+ }
+ catch (HeuristicMixed e)
+ {
+ appendError("Heuristic mixed error: " + e.getMessage());
+ }
+ catch (HeuristicHazard e)
+ {
+ appendError("Heuristic hazard error: " + e.getMessage());
+ }
+ catch (HeuristicCommit e)
+ {
+ appendError("Heuristic commit error: " + e.getMessage());
+ }
+ catch (Throwable t)
+ {
+ appendError("Error: " + t.getMessage());
+ }
+
+ return false;
+ }
+
+ protected boolean doOp(XAResourceRecord record, RecoveryOp op)
+ {
+ try
+ {
+ switch (op) {
+ case FORGET_OP:
+ ((XAResource)record.value()).forget(record.getXid());
+ break;
+ case COMMIT_OP:
+ ((XAResource)record.value()).commit(record.getXid(), true);
+ break;
+ case ABORT_OP:
+ ((XAResource)record.value()).rollback(record.getXid());
+ break;
+ default:
+ }
+
+ return true;
+ }
+ catch (XAException e)
+ {
+ appendError("XA error: " + e.getMessage());
+ return false;
+ }
+ }
+
+ protected boolean doOp(RecoveryAbstractRecord record, RecoveryOp op)
+ {
+ try
+ {
+ int err;
+
+ switch (op) {
+ case FORGET_OP:
+ if (!record.record().forgetHeuristic())
+ {
+ appendError("Could not forget this record");
+ return false;
+ }
+ return true;
+ case COMMIT_OP:
+ err = record.record().topLevelOnePhaseCommit();
+
+ if (err == TwoPhaseOutcome.FINISH_OK)
+ return true;
+
+ appendError("Commit error: " + TwoPhaseOutcome.stringForm(err));
+ return false;
+ case ABORT_OP:
+ err = record.record().topLevelAbort();
+
+ if (err == TwoPhaseOutcome.FINISH_OK)
+ return true;
+
+ appendError("Commit error: " + TwoPhaseOutcome.stringForm(err));
+ return false;
+ default:
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ appendError("Unable to complete operation: " + e.getMessage());
+ return false;
+ }
+ }
+
+ protected boolean doOp(RecoveryOp op)
+ {
+ if (getRecord() instanceof ResourceRecord)
+ return doOp((ResourceRecord) getRecord(), op);
+ else if (getRecord() instanceof XAResourceRecord)
+ return doOp((XAResourceRecord) getRecord(), op);
+ else if (getRecord() instanceof RecoveryAbstractRecord)
+ return doOp((RecoveryAbstractRecord) getRecord(), op);
+ else if (getRecord() instanceof ExtendedResourceRecord)
+ return doOp((ExtendedResourceRecord) getRecord(), op);
+ else
+ appendError("Unsupported record type: " + getRecord().getClass().getSimpleName());
+
+ return false;
+ }
+
+ protected boolean doForget()
+ {
+ return doOp(RecoveryOp.FORGET_OP);
+ }
+
+ protected boolean doCommit()
+ {
+ return doOp(RecoveryOp.COMMIT_OP);
+ }
+
+ protected boolean doRollback()
+ {
+ return doOp(RecoveryOp.ABORT_OP);
+ }
+
/**
* Get the type this state viewer is intended to be registered against.
* @return
Deleted: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionViewer.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction;
-
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.StateViewerInterface;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.icons.*;
-import com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction.nodes.*;
-import com.arjuna.ats.tools.objectstorebrowser.ObjectStoreBrowserTreeManipulationInterface;
-import com.arjuna.ats.tools.objectstorebrowser.panels.StatePanel;
-import com.arjuna.ats.tools.objectstorebrowser.panels.SubTreeViewEntry;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.UidNode;
-import com.arjuna.ats.tools.objectstorebrowser.treenodes.ListNode;
-import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.common.Environment;
-import com.arjuna.ats.arjuna.gandiva.ObjectName;
-import com.arjuna.ats.arjuna.coordinator.RecordList;
-import com.arjuna.ats.arjuna.coordinator.ActionStatus;
-import com.arjuna.ats.arjuna.ArjunaNames;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.*;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: ArjunaTransactionViewer.java 2342 2006-03-30 13:06:17Z $
- */
-
-
-public class ArjunaTransactionViewer implements StateViewerInterface
-{
- /**
- * A uid node of the type this viewer is registered against has been expanded.
- * @param os
- * @param type
- * @param manipulator
- * @param uidNode
- * @throws ObjectStoreException
- */
- public void uidNodeExpanded(ObjectStore os,
- String type,
- ObjectStoreBrowserTreeManipulationInterface manipulator,
- UidNode uidNode,
- StatePanel infoPanel) throws ObjectStoreException
- {
- Uid theUid = uidNode.getUid();
- ArjunaTransactionWrapper ba = new ArjunaTransactionWrapper(theUid,getObjectName(os));
-
- manipulator.clearEntries();
-
- if ( !ba.activate() )
- {
- JOptionPane.showMessageDialog(null, "Failed to activate transaction", "Error", JOptionPane.ERROR_MESSAGE);
- }
- else
- {
- ListNode node;
- SubTreeViewEntry entry;
- manipulator.createEntry(node = new PreparedListNode("Prepared List", ba, type));
- node.setIconPanelEntry(entry = new PreparedViewEntry(type, "Prepared List", node));
- entry.setToolTipText(getListSize(ba.getPreparedList())+" entries");
- node.add(new DefaultMutableTreeNode(""));
-
- manipulator.createEntry(node = new PendingListNode("Pending List", ba, type));
- node.setIconPanelEntry(entry = new PendingViewEntry(type, "Pending List", node));
- entry.setToolTipText(getListSize(ba.getPendingList())+" entries");
- node.add(new DefaultMutableTreeNode(""));
-
- manipulator.createEntry(node = new HeuristicListNode("Heuristic List", ba, type));
- node.setIconPanelEntry(entry = new HeuristicViewEntry(type, "Heuristic List", node));
- entry.setToolTipText(getListSize(ba.getHeuristicList())+" entries");
- node.add(new DefaultMutableTreeNode(""));
-
- manipulator.createEntry(node = new FailedListNode("Failed List", ba, type));
- node.setIconPanelEntry(entry = new FailedViewEntry(type, "Failed List", node));
- entry.setToolTipText(getListSize(ba.getFailedList())+" entries");
- node.add(new DefaultMutableTreeNode(""));
-
- manipulator.createEntry(node = new ReadOnlyListNode("Read-only List", ba, type));
- node.setIconPanelEntry(entry = new ReadOnlyViewEntry(type, "Read-only List", node));
- entry.setToolTipText(getListSize(ba.getReadOnlyList())+" entries");
- node.add(new DefaultMutableTreeNode(""));
- }
- }
-
- private ObjectName getObjectName(ObjectStore os)
- {
- ObjectName name = new ObjectName("PNS:");
-
- try
- {
- name.setClassNameAttribute(Environment.OBJECTSTORE_TYPE, os.className());
- name.setStringAttribute(ArjunaNames.StateManager_objectStoreRoot(), os.storeRoot());
- }
- catch (java.io.IOException e)
- {
- // Ignore
- }
-
- return name;
- }
-
- /**
- * Get the type this state viewer is intended to be registered against.
- * @return
- */
- public String getType()
- {
- return "/StateManager/BasicAction/ArjunaTransactionImple/";
- }
-
- private int getListSize(RecordList list)
- {
- return list != null ? list.size() : 0;
- }
-}
Deleted: labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionWrapper.java 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/bin/com/arjuna/ats/tools/objectstorebrowser/stateviewers/viewers/arjunatransaction/ArjunaTransactionWrapper.java 2008-07-28 17:23:01 UTC (rev 21258)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package com.arjuna.ats.tools.objectstorebrowser.stateviewers.viewers.arjunatransaction;
-
-import com.arjuna.ats.arjuna.coordinator.BasicAction;
-import com.arjuna.ats.arjuna.coordinator.RecordList;
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.ObjectType;
-import com.arjuna.ats.arjuna.gandiva.ObjectName;
-import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
-
-public class ArjunaTransactionWrapper extends BasicAction
-{
- public ArjunaTransactionWrapper(Uid objUid, ObjectName objectName)
- {
- super(objUid, ObjectType.ANDPERSISTENT, objectName);
- }
-
- /**
- * Overloads StateManager.type()
- */
- public String type()
- {
- return ArjunaTransactionImple.typeName();
- }
-
- public RecordList getFailedList()
- {
- return failedList;
- }
-
- public RecordList getHeuristicList()
- {
- return heuristicList;
- }
-
- public RecordList getPendingList()
- {
- return pendingList;
- }
-
- public RecordList getPreparedList()
- {
- return preparedList;
- }
-
- public RecordList getReadOnlyList()
- {
- return readonlyList;
- }
-}
Modified: labs/jbosstm/trunk/ArjunaJTS/tsmx/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/tsmx/build.xml 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/ArjunaJTS/tsmx/build.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -30,6 +30,10 @@
location="${com.arjuna.arjunacore.dir}/tsmx/lib"/>
<property name="com.arjuna.arjunacore.tsmx.tools"
location="${com.arjuna.arjunacore.tsmx.lib}/bin/tools"/>
+ <property name="com.arjuna.arjunajta.tsmx.classes"
+ location="${com.arjuna.arjunajta.dir}/tsmx/build/bin"/>
+ <property name="com.arjuna.arjunajta.tsmx.lib"
+ location="${com.arjuna.arjunajta.dir}/tsmx/lib"/>
<!-- Load Build Properties File -->
<property file="${com.arjuna.mw.ts.properties}"/>
@@ -120,6 +124,7 @@
<classpath>
<path path="${build.classpath}"/>
<path path="${tsmx.classpath}"/>
+ <path path="${com.arjuna.arjunajta.tsmx.classes}"/>
</classpath>
</javac>
</target>
@@ -137,6 +142,7 @@
<delete dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
<mkdir dir="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
<unzip src="${com.arjuna.arjunacore.tsmx.tools}/${objectstorebrowser}" dest="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
+ <unzip src="${com.arjuna.arjunajta.tsmx.lib}/${objectstorebrowser}" dest="${com.arjuna.mwlabs.ts.tsmx.tmp}"/>
<copy todir="${com.arjuna.mwlabs.ts.tsmx.tmp}" overwrite="true">
<fileset dir="${com.arjuna.mwlabs.ts.tsmx.utilities.dest}"
Modified: labs/jbosstm/trunk/build.xml
===================================================================
--- labs/jbosstm/trunk/build.xml 2008-07-28 13:52:44 UTC (rev 21257)
+++ labs/jbosstm/trunk/build.xml 2008-07-28 17:23:01 UTC (rev 21258)
@@ -30,6 +30,8 @@
<property name="jta.dir" location="ArjunaJTA"/>
<property name="jts.dir" location="ArjunaJTS"/>
<property name="integration.dir" location="atsintegration"/>
+ <property name="jboss.tools.dir" location="${core.dir}/tsmx"/>
+ <property name="com.hp.mw.installationdirectory.bin" location="${com.hp.mw.installationdirectory}/bin"/>
<property name="jboss.eula" location="JBossORG-EULA.txt"/>
<property name="jboss.libdir" location="jboss"/>
@@ -84,10 +86,12 @@
<target name="jbossjts">
<runant target="run_jbossjts"/>
+ <runant target="install_jboss_tools"/>
</target>
<target name="jbossjta">
<runant target="run_jbossjta"/>
+ <runant target="install_jboss_tools"/>
</target>
<target name="clean">
@@ -144,6 +148,12 @@
</copy>
</target>
+ <target name="install_jboss_tools">
+ <ant dir="${jboss.tools.dir}" target="install_jboss_tools">
+ <property name="jboss.ts.tools.install.dir" value="${com.hp.mw.installationdirectory.bin}"/>
+ </ant>
+ </target>
+
<target name="build_jts" depends="init_jts, init, build_jta">
<ant dir="${jts.dir}" target="jar"/>
</target>
More information about the jboss-svn-commits
mailing list