[jboss-svn-commits] JBL Code SVN: r33144 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common and 14 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 28 11:36:02 EDT 2010
Author: mmusgrov
Date: 2010-05-28 11:36:01 -0400 (Fri, 28 May 2010)
New Revision: 33144
Added:
labs/jbosstm/trunk/rhq-plugin/
labs/jbosstm/trunk/rhq-plugin/pom.xml
labs/jbosstm/trunk/rhq-plugin/src/
labs/jbosstm/trunk/rhq-plugin/src/main/
labs/jbosstm/trunk/rhq-plugin/src/main/java/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/JMXClient.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnBaseComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnConstants.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineDiscoveryComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryDiscoveryComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantDiscoveryComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreComponent.java
labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreDiscoveryComponent.java
labs/jbosstm/trunk/rhq-plugin/src/resources/
labs/jbosstm/trunk/rhq-plugin/src/resources/META-INF/
labs/jbosstm/trunk/rhq-plugin/src/resources/META-INF/rhq-plugin.xml
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/ActionBean.java
labs/jbosstm/trunk/common/classes/com/arjuna/common/util/ConfigurationInfo.java
Log:
JBTM-719 RHQ plugin for the transaction manager
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java 2010-05-28 15:35:02 UTC (rev 33143)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -23,6 +23,7 @@
import com.arjuna.common.internal.util.propertyservice.PropertyPrefix;
import com.arjuna.common.internal.util.propertyservice.FullPropertyName;
import com.arjuna.ats.arjuna.utils.Utility;
+import com.arjuna.common.util.ConfigurationInfo;
import java.io.File;
@@ -241,4 +242,21 @@
{
this.disableMultipleLastResourcesWarning = disableMultipleLastResourcesWarning;
}
+
+ /**
+ * @return the version control tag of the source used, or "unknown"
+ */
+ public String getBuildVersion()
+ {
+ return ConfigurationInfo.getVersion();
+ }
+
+ /**
+ * @return the build identification line indicating the os name and version and build date
+ */
+ public String getBuildId()
+ {
+ return ConfigurationInfo.getBuildId();
+ }
+
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java 2010-05-28 15:35:02 UTC (rev 33143)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -58,4 +58,8 @@
boolean isDisableMultipleLastResourcesWarning();
void setDisableMultipleLastResourcesWarning(boolean disableMultipleLastResourcesWarning);
+
+ String getBuildVersion();
+
+ String getBuildId();
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/ActionBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/ActionBean.java 2010-05-28 15:35:02 UTC (rev 33143)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/ActionBean.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -28,18 +28,18 @@
* [com.arjuna.ats.arjuna.tools.osb.mbean.m_3] - remove committed exception: {0}.
*/
public class ActionBean extends OSEntryBean implements ActionBeanMBean {
- // Basic properties this enty
+ // Basic properties this enty
private StateManagerWrapper sminfo;
- // collection of participants belonging to this BasicAction
+ // collection of participants belonging to this BasicAction
private Collection<LogRecordWrapper> participants = new ArrayList<LogRecordWrapper>();
- // wrapper around the real AtomicAction
+ // wrapper around the real AtomicAction
private ActionBeanWrapperInterface ra;
public ActionBean(UidWrapper w) {
super(w);
boolean isJTS = JMXServer.isJTS() && w.getType().endsWith("ArjunaTransactionImple");
- // Participants in a JTS transaction are represented by entries in the ObjectStore
+ // Participants in a JTS transaction are represented by entries in the ObjectStore
List<UidWrapper> recuids = null;
if (isJTS) {
@@ -60,13 +60,13 @@
sminfo = new StateManagerWrapper(TxControl.getStore(), getUid(), getType());
if (isJTS) {
- /*
- * for JTS actions the participants will have entries in the ObjectStore.
- * these entries will be associated with the current MBean (refer to
- * the method findParticipants below for details)
- */
+ /*
+ * for JTS actions the participants will have entries in the ObjectStore.
+ * these entries will be associated with the current MBean (refer to
+ * the method findParticipants below for details)
+ */
recuids = w.probe(JMXServer.AJT_RECORD_TYPE, JMXServer.AJT_XAREC_TYPE);
- }
+ }
for (ParticipantStatus lt : ParticipantStatus.values()) {
findParticipants(recuids, ra.getRecords(lt), lt);
@@ -86,19 +86,19 @@
return sb;
}
- /**
- * return the Uid for given AbstractRecord
- * @param rec the record whose Uid is required
- * @return the Uid of the requested record
- */
+ /**
+ * return the Uid for given AbstractRecord
+ * @param rec the record whose Uid is required
+ * @return the Uid of the requested record
+ */
public Uid getUid(AbstractRecord rec) {
return ra.getUid(rec);
}
- /**
- * Remove this AtomicAction from the ObjectStore
- * @return a textual indication of whether the remove operation succeeded
- */
+ /**
+ * Remove this AtomicAction from the ObjectStore
+ * @return a textual indication of whether the remove operation succeeded
+ */
public String remove() {
try {
if (!TxControl.getStore().remove_committed(getUid(), getType()))
@@ -112,14 +112,14 @@
}
}
- /**
- * create MBean representations of the participants of this transaction
- * @param recuids some transaction participants are represented in the ObjectStore
- * - if this is the case then recuids contains a list of MBean wrappers representing them.
- * Otherwise this list will be empty.
- * @param list the records representing the participants
- * @param listType indicates the type of the records in list (PREPARED, PENDING, FAILED, READONLY, HEURISTIC)
- */
+ /**
+ * create MBean representations of the participants of this transaction
+ * @param recuids some transaction participants are represented in the ObjectStore
+ * - if this is the case then recuids contains a list of MBean wrappers representing them.
+ * Otherwise this list will be empty.
+ * @param list the records representing the participants
+ * @param listType indicates the type of the records in list (PREPARED, PENDING, FAILED, READONLY, HEURISTIC)
+ */
private void findParticipants(List<UidWrapper> recuids, RecordList list, ParticipantStatus listType) {
if (list != null) {
for (AbstractRecord rec = list.peekFront(); rec != null; rec = list.peekNext(rec)) {
@@ -136,34 +136,33 @@
if (tsLogger.arjLoggerI18N.isDebugEnabled())
tsLogger.arjLoggerI18N.debug("participant record is not a LogRecordWrapper");
lw = createParticipant(rec, listType);
- lw.activate();
}
} else {
lw = createParticipant(rec, listType);
- lw.activate();
}
+ lw.activate();
participants.add(lw);
}
}
}
- /**
- * Extension point for other Bean implementations to provide an implementation bean for its participants.
- * For example @see com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean
- * @param rec the record that should be represented by an MBean
- * @param listType the status of the record
- * @return the MBean implementation of the participant
- */
+ /**
+ * Extension point for other Bean implementations to provide an implementation bean for its participants.
+ * For example @see com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean
+ * @param rec the record that should be represented by an MBean
+ * @param listType the status of the record
+ * @return the MBean implementation of the participant
+ */
protected LogRecordWrapper createParticipant(AbstractRecord rec, ParticipantStatus listType) {
return new LogRecordWrapper(this, rec, listType);
}
- /**
- * See if there is participant Bean corresponding to the given record
- * @param rec the record for the target participant
- * @return the bean corresponding to the requested record
- */
+ /**
+ * See if there is participant Bean corresponding to the given record
+ * @param rec the record for the target participant
+ * @return the bean corresponding to the requested record
+ */
public LogRecordWrapper getParticipant(AbstractRecord rec) {
for (LogRecordWrapper w : participants)
if (w.getRecord().equals(rec))
@@ -172,9 +171,9 @@
return null;
}
- /**
- * register this bean (and its participants) with the MBeanServer
- */
+ /**
+ * register this bean (and its participants) with the MBeanServer
+ */
public void register() {
super.register();
@@ -182,9 +181,9 @@
JMXServer.getAgent().registerMBean(p.getName(), p);
}
- /**
- * unregister this bean (and its participants) with the MBeanServer
- */
+ /**
+ * unregister this bean (and its participants) with the MBeanServer
+ */
public void unregister() {
for (LogRecordWrapper p : participants)
JMXServer.getAgent().unregisterMBean(p.getName());
@@ -204,15 +203,15 @@
return false;
}
- /**
- * Request a change in status of a participant. For example if a record has a
- * heuristic status then this method could be used to move it back into the
- * prepared state so that the recovery system can replay phase 2 of the
- * committment protocol
- * @param logrec the record whose status is to be changed
- * @param newStatus the desired status
- * @return true if the status was changed
- */
+ /**
+ * Request a change in status of a participant. For example if a record has a
+ * heuristic status then this method could be used to move it back into the
+ * prepared state so that the recovery system can replay phase 2 of the
+ * committment protocol
+ * @param logrec the record whose status is to be changed
+ * @param newStatus the desired status
+ * @return true if the status was changed
+ */
public boolean setStatus(LogRecordWrapper logrec, ParticipantStatus newStatus) {
ParticipantStatus lt = logrec.getListType();
AbstractRecord targRecord = logrec.getRecord();
@@ -220,35 +219,35 @@
RecordList oldList = ra.getRecords(lt);
RecordList newList = ra.getRecords(newStatus);
- if (lt.equals(ParticipantStatus.HEURISTIC) && !targRecord.forgetHeuristic()) {
- return false;
- }
+ if (lt.equals(ParticipantStatus.HEURISTIC) && !targRecord.forgetHeuristic()) {
+ return false;
+ }
// move the record from currList to targList
if (oldList.remove(targRecord)) {
-
+
if (newList.insert(targRecord)) {
if (lt.equals(ParticipantStatus.HEURISTIC)) {
- switch (newStatus) {
- case FAILED:
- ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR);
- break;
- case PENDING:
- ra.clearHeuristicDecision(TwoPhaseOutcome.NOT_PREPARED);
- break;
- case PREPARED:
- ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_OK);
- break;
- case READONLY:
- ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_READONLY);
- break;
- default:
- break;
- }
- }
+ switch (newStatus) {
+ case FAILED:
+ ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR);
+ break;
+ case PENDING:
+ ra.clearHeuristicDecision(TwoPhaseOutcome.NOT_PREPARED);
+ break;
+ case PREPARED:
+ ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_OK);
+ break;
+ case READONLY:
+ ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_READONLY);
+ break;
+ default:
+ break;
+ }
+ }
ra.doUpdateState();
-
+
return true;
}
}
@@ -256,19 +255,19 @@
return false;
}
- /**
- *
- * @return the MBeans corresponding to the participants within this action
- */
- public Collection<LogRecordWrapper> getParticipants() {
- return Collections.unmodifiableCollection(participants);
- }
+ /**
+ *
+ * @return the MBeans corresponding to the participants within this action
+ */
+ public Collection<LogRecordWrapper> getParticipants() {
+ return Collections.unmodifiableCollection(participants);
+ }
- /**
- * The ActionBean needs access to the participant lists maintained by an AtomicAction but these
- * lists are protected. Therefore define a simple extension class to get at these records:
- */
- class AtomicActionWrapper extends AtomicAction implements ActionBeanWrapperInterface {
+ /**
+ * The ActionBean needs access to the participant lists maintained by an AtomicAction but these
+ * lists are protected. Therefore define a simple extension class to get at these records:
+ */
+ class AtomicActionWrapper extends AtomicAction implements ActionBeanWrapperInterface {
boolean activated;
public AtomicActionWrapper(UidWrapper w) {
@@ -295,12 +294,12 @@
return sb.append('\n').append(prefix).append(get_uid());
}
- public void clearHeuristicDecision(int newDecision) {
- if (super.heuristicList.size() == 0)
- setHeuristicDecision(newDecision);
- }
+ public void clearHeuristicDecision(int newDecision) {
+ if (super.heuristicList.size() == 0)
+ setHeuristicDecision(newDecision);
+ }
- public RecordList getRecords(ParticipantStatus type) {
+ public RecordList getRecords(ParticipantStatus type) {
switch (type) {
default:
case PREPARED: return preparedList;
Modified: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/ConfigurationInfo.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/ConfigurationInfo.java 2010-05-28 15:35:02 UTC (rev 33143)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/ConfigurationInfo.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -61,6 +61,13 @@
}
/**
+ * @return the build identification line indicating the os name and version and build date
+ */
+ public static String getBuildId() {
+ return buildId;
+ }
+
+ /**
* Print config info to stdout.
* @param args unused
*/
@@ -110,6 +117,11 @@
sourceId = attributes.getValue(name);
}
+ name = new Attributes.Name("arjuna-builder");
+ if(attributes.containsKey(name)) {
+ buildId = attributes.getValue(name);
+ }
+
} catch(Exception exception) {
exception.printStackTrace();
} finally {
@@ -123,6 +135,7 @@
private static volatile String sourceId = "unknown";
private static volatile String propertiesFile = "arjuna-properties.xml";
+ private static volatile String buildId = "arjuna-builder";
static {
getBuildTimeProperties();
Added: labs/jbosstm/trunk/rhq-plugin/pom.xml
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/pom.xml (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/pom.xml 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,131 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossts-jopr-plugin</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0.SNAPSHOT</version>
+ <name>JBoss Transaction Management JOPR plugin</name>
+ <url>http://www.jboss.org/jbosstm</url>
+ <description>JBossTS JOPR plugin</description>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!-- Compile (global dependencies) -->
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <version>6.0.0.Alpha9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>2.1.1.SP1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>1.4.0.B01</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>1.4.0.B01</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-jmx-plugin</artifactId>
+ <version>1.4.0.B01</version>
+ <scope>provided</scope>
+ </dependency>
+ <!--we dont compile without these, some strange annotation dependency-->
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <version>1.0.0-CR-1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.5.0-CR-1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>interval:10080</updatePolicy>
+ </releases>
+ <id>jboss.release</id>
+ <name>JBoss releases</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>interval:10080</updatePolicy>
+ </releases>
+ <id>jboss.release</id>
+ <name>JBoss releases</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss.org Release Distribution Repository</name>
+ <url>dav:https://svn.jboss.org/repos/repository.jboss.org/maven2</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss.org Development Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+</project>
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/JMXClient.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/JMXClient.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/JMXClient.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,342 @@
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.domain.measurement.*;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnector;
+import javax.management.*;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.util.*;
+
+public class JMXClient extends TxnBaseComponent
+{
+ static Map<String, MBeanInfo> mBeanInfo;
+ static Map<String, Map<String, MBeanAttributeInfo>> mBeanPropInfo;
+
+ MBeanServerConnection conn;
+ ResourceContext context;
+
+ public JMXClient()
+ {
+ try {
+ getMBeanServerConnection();
+ } catch (Exception e) {
+ throw new RuntimeException("MBeanServer connection error: " + e.getMessage());
+ }
+ }
+
+ @Override
+ public void start(ResourceContext context)
+ { //context.resourceDiscoveryComponent.
+ super.start(context);
+ this.context = context;
+
+ initMBeanInfo();
+ }
+
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests, ObjectName on) throws Exception
+ {
+ String[] props = new String[requests.size()];
+ MeasurementScheduleRequest[] reqs = requests.toArray(new MeasurementScheduleRequest[requests.size()]);
+
+ for (int i = 0; i < props.length; i++) {
+ props[i] = reqs[i].getName();
+ }
+
+ AttributeList al = getAttributes(on, false, props);
+ Attribute[] aa = al.toArray(new Attribute[al.size()]);
+
+ for (int i = 0; i < aa.length; i++) {
+ if (reqs[i].getDataType().equals(DataType.MEASUREMENT))
+ report.addData(new MeasurementDataNumeric(reqs[i], Double.valueOf(aa[i].getValue().toString())));
+ else if (reqs[i].getDataType().equals(DataType.TRAIT))
+ report.addData(new MeasurementDataTrait(reqs[i], aa[i].getValue().toString()));
+ }
+ }
+
+ /**
+ * The plugin container will call this method and it needs to obtain the
+ * current configuration of the managed resource. Your plugin will obtain
+ * the managed resource's configuration in your own custom way and populate
+ * the returned Configuration object with the managed resource's
+ * configuration property values.
+ *
+ * @see //ConfigurationFacet#loadResourceConfiguration()
+ */
+ @Override
+ public Configuration loadResourceConfiguration()
+ {
+ return super.loadResourceConfiguration();
+ /*
+ Configuration config = new Configuration();
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
+ try {
+ updateConfig(config, new ObjectName(JTAEBEAN), configDef.getPropertiesInGroup("EngineConfiguration"));
+ updateConfig(config, new ObjectName(JTAEBEAN), configDef.getPropertiesInGroup("EngineConfigurationClasses"));
+ updateConfig(config, new ObjectName(CEBEAN), configDef.getPropertiesInGroup("CoordinatorConfiguration"));
+ updateConfig(config, new ObjectName(REBEAN), configDef.getPropertiesInGroup("RecoveryConfiguration"));
+ updateConfig(config, new ObjectName(COREEBEAN), configDef.getPropertiesInGroup("CoreEngineConfiguration"));
+
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+
+
+ return config;
+ */
+ }
+
+ protected void updateConfig(Configuration config, ObjectName on, List<PropertyDefinition> propDefs) throws Exception
+ {
+ String[] props = new String[propDefs.size()];
+
+ for (int i = 0; i < propDefs.size(); i++)
+ props[i] = propDefs.get(i).getName();
+
+ List<Attribute> attrs = conn.getAttributes(on, props).asList();
+
+ for (Attribute a : attrs)
+ config.put(new PropertySimple(a.getName(), a.getValue()));
+ }
+ /**
+ * The plugin container will call this method when it has a new
+ * configuration for your managed resource. Your plugin will re-configure
+ * the managed resource in your own custom way, setting its configuration
+ * based on the new values of the given configuration.
+ *
+ * @see //ConfigurationFacet#updateResourceConfiguration(ConfigurationUpdateReport)
+ */
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report)
+ {
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ updateResourceConfiguration(report, "StatsConfiguration", TxnConstants.CEBEAN);
+ }
+
+ /**
+ * Update configuration properties
+ *
+ * @param report configuration properties together with their new values
+ * @param groupName only apply changes to properties in this configuration group (see rhq-plugin.xml)
+ * @param beans a list of beans that which define the target configuration properties
+ * (currently on the first bean in the list is used)
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report,
+ String groupName, ObjectName ... beans)
+ {
+ Map<String, PropertySimple> props = report.getConfiguration().getSimpleProperties();
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+ Collection<String> errors = new ArrayList<String> ();
+ List<PropertyDefinition> propDefs = configDef.getPropertiesInGroup(groupName);
+
+ for (PropertyDefinition def : propDefs) {
+ if (!def.isReadOnly() && props.containsKey(def.getName())) {
+ Attribute a;
+ MBeanAttributeInfo attrInfo = null;
+ ObjectName bean = null;
+
+ for (ObjectName on : beans) {
+ Map<String, MBeanAttributeInfo> mbprops = mBeanPropInfo.get(on.getCanonicalName());
+
+ if (mbprops != null && (attrInfo = mbprops.get(def.getName())) != null) {
+ bean = on;
+ break;
+ }
+ }
+
+ if (bean == null) {
+ errors.add("Property " + def.getName() + " in group " + groupName + ": no MBean with that property");
+ } else {
+ try {
+ a = toJMXAttribute(attrInfo, props.get(def.getName()));
+ AttributeList al = setAttributes(bean, a);
+
+ // did the remote MBean fail the update request?
+ if (al.size() != 1)
+ errors.add("Property " + def.getName() + " in group " + groupName + " with MBean name " + bean.getCanonicalName() + ": failed to update");
+ } catch (Exception e) {
+ errors.add("Property " + def.getName() + " in group " + groupName + " with MBean name " + bean.getCanonicalName() + ": " + e.toString());
+ }
+ }
+ }
+ }
+
+ if (errors.size() != 0) {
+ StringBuilder sb = new StringBuilder();
+ String prev = report.getErrorMessage();
+
+ for (String e : errors) {
+ sb.append(e).append(System.getProperty("line.separator"));
+ }
+
+ log.debug(sb);
+
+ if (prev != null)
+ sb.append(prev);
+
+ report.setErrorMessage(sb.toString());
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ }
+ }
+
+ Attribute toJMXAttribute(MBeanAttributeInfo mbpropinfo, PropertySimple ps) throws Exception {
+ String type = mbpropinfo.getType();
+
+ if (type.startsWith("java.lang."))
+ type = type.substring("java.lang.".length());
+
+ if (type.equals("String"))
+ return new Attribute(ps.getName(), ps.getStringValue());
+ else if (type.equalsIgnoreCase("Boolean"))
+ return new Attribute(ps.getName(), ps.getBooleanValue());
+ else if (type.equalsIgnoreCase("Long"))
+ return new Attribute(ps.getName(), ps.getLongValue());
+ else if (type.equalsIgnoreCase("int") || type.equalsIgnoreCase("Integer"))
+ return new Attribute(ps.getName(), ps.getIntegerValue());
+ else if (type.equalsIgnoreCase("Float"))
+ return new Attribute(ps.getName(), ps.getFloatValue());
+ else if (type.equalsIgnoreCase("Double"))
+ return new Attribute(ps.getName(), ps.getDoubleValue());
+ else
+ throw new Exception("Unsupported object type");
+ }
+
+ private void initMBeanInfo() {
+ mBeanInfo = new HashMap<String, MBeanInfo> ();
+ mBeanPropInfo = new HashMap<String, Map<String, MBeanAttributeInfo>> ();
+
+ try {
+ for (ObjectName on : conn.queryNames(new ObjectName("jboss.jta:name=*"), null))
+ try {
+ MBeanInfo mbi = conn.getMBeanInfo(on);
+ mBeanInfo.put(on.getCanonicalName(), mbi);
+
+ Map<String, MBeanAttributeInfo> mbaimap = new HashMap<String, MBeanAttributeInfo> ();
+
+ for (MBeanAttributeInfo mbai : mbi.getAttributes())
+ mbaimap.put(mbai.getName(), mbai);
+
+ mBeanPropInfo.put(on.getCanonicalName(), mbaimap);
+ } catch (Exception e) {
+ System.out.println("MBean info error (" + e.getMessage() + ") for " + on);
+ }
+
+
+ } catch (Exception e) {
+ System.out.println("MBeanServer connection error for " + e.getMessage());
+ }
+ }
+
+ MBeanServerConnection getMBeanServerConnection() throws Exception
+ {
+ if (conn == null) {
+ try {
+ JMXServiceURL url = new JMXServiceURL(TxnConstants.JMXURL);
+ JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
+
+ conn = jmxc.getMBeanServerConnection();
+
+ } catch (MalformedURLException e) {
+ System.out.println("jmx connect exception: " + e);
+ throw e;
+ } catch (IOException e) {
+ System.out.println("jmx connect exception: " + e);
+ throw e;
+ }
+ }
+
+ return conn;
+ }
+
+ Object getAttribute(ObjectName objectName, String attr) throws Exception
+ {
+ return conn.getAttribute(objectName, attr);
+ }
+
+ AttributeList getAttributes(ObjectName on, MBeanAttributeInfo[] mbi) throws Exception {
+ String[] attrs = new String[mbi.length];
+
+ for (int i = 0; i < mbi.length; i++)
+ attrs[i] = mbi[i].getName();
+
+ return conn.getAttributes(on, attrs);
+ }
+
+ AttributeList getAttributes(ObjectName on, boolean verbose, String ... attrs) throws MalformedObjectNameException, InstanceNotFoundException, IOException, ReflectionException
+ {
+ AttributeList attributes = conn.getAttributes(on, attrs);
+
+ if (verbose)
+ for (Attribute a : attributes.asList())
+ System.out.println(a.getName() + " = " + a.getValue());
+
+ return attributes;
+ }
+
+ AttributeList setAttributes(ObjectName on, Attribute ... attrs) throws InstanceNotFoundException, IOException, ReflectionException
+ {
+ AttributeList attributes = new AttributeList();
+
+ attributes.addAll(Arrays.asList(attrs));
+
+ return conn.setAttributes(on, attributes);
+ }
+
+ public MBeanInfo getMBeanInfo(ObjectName on) throws Exception
+ {
+ MBeanInfo mbi = mBeanInfo.get(on.getCanonicalName());
+
+ return (mbi == null ? conn.getMBeanInfo(on) : mbi);
+ }
+
+ public Object invokeOperation(ObjectName on, String method, Object ... params) throws Exception
+ {
+ return conn.invoke(on, method, params, null);
+ }
+
+ public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
+ try {
+ return conn.queryMBeans(name, query);
+ } catch (IOException e) {
+ log.info("MBean query error: " + e);
+ }
+
+ return Collections.EMPTY_SET;
+ }
+
+ public Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
+ try {
+ return conn.queryNames(name, query); // conn.queryNames(new ObjectName("jboss.jta:type=ObjectStore,*"), null)
+ } catch (IOException e) {
+ log.info("MBean query error: " + e);
+ }
+
+ return Collections.EMPTY_SET;
+ }
+
+ public Set<ObjectInstance> queryMBeans(String name, QueryExp query) {
+ try {
+ return queryMBeans(new ObjectName(name), query);
+ } catch (MalformedObjectNameException e) {
+ log.info("MBean query error: " + e);
+ return Collections.EMPTY_SET;
+ }
+ }
+ public Set<ObjectName> queryNames(String name, QueryExp query) {
+ try {
+ return queryNames(new ObjectName(name), query);
+ } catch (MalformedObjectNameException e) {
+ log.info("MBean query error: " + e);
+ return Collections.EMPTY_SET;
+ } }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnBaseComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnBaseComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnBaseComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+package org.jboss.as.integration.jbossts.jopr;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.*;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+public class TxnBaseComponent implements ResourceComponent, MeasurementFacet,
+ OperationFacet, ConfigurationFacet, ContentFacet, DeleteResourceFacet,
+ CreateChildResourceFacet {
+ final Log log = LogFactory.getLog(TxnBaseComponent.class);
+
+ /**
+ * Represents the resource configuration of the custom product being
+ * managed.
+ */
+ private Configuration resourceConfiguration;
+
+ /**
+ * This is called when your component has been started with the given
+ * context. You normally initialize some internal state of your component as
+ * well as attempt to make a stateful connection to your managed resource.
+ *
+ * @see ResourceComponent#start(ResourceContext)
+ */
+ public void start(ResourceContext context) throws InvalidPluginConfigurationException {
+ log.debug("start resource: ");
+ }
+
+ /**
+ * This is called when the component is being stopped, usually due to the
+ * plugin container shutting down. You can perform some cleanup here; though
+ * normally not much needs to be done here.
+ *
+ * @see ResourceComponent#stop()
+ */
+ public void stop() {
+ }
+
+ /**
+ * All resource components must be able to tell the plugin container if the
+ * managed resource is available or not. This method is called by the plugin
+ * container when it needs to know if the managed resource is actually up
+ * and available.
+ *
+ * @see ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability() {
+ return AvailabilityType.UP;
+ }
+
+ /**
+ * The plugin container will call this method when your resource component
+ * has been scheduled to collect some measurements now. It is within this
+ * method that you actually talk to the managed resource and collect the
+ * measurement data that is has emitted.
+ *
+ * @see MeasurementFacet#getValues(MeasurementReport, Set)
+ */
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) {
+ }
+
+ /**
+ * The plugin container will call this method when it wants to invoke an
+ * operation on your managed resource. Your plugin will connect to the
+ * managed resource and invoke the analogous operation in your own custom
+ * way.
+ *
+ * @see OperationFacet#invokeOperation(String, Configuration)
+ */
+ public OperationResult invokeOperation(String name, Configuration params) throws Exception {
+ return new OperationResult();
+ }
+
+ /**
+ * The plugin container will call this method and it needs to obtain the
+ * current configuration of the managed resource. Your plugin will obtain
+ * the managed resource's configuration in your own custom way and populate
+ * the returned Configuration object with the managed resource's
+ * configuration property values.
+ *
+ * @see ConfigurationFacet#loadResourceConfiguration()
+ */
+ public Configuration loadResourceConfiguration() {
+ // here we simulate the loading of the managed resource's configuration
+
+ if (resourceConfiguration == null) {
+ // return an empty configuration (ie there are no required
+ // configs in the plugin descriptor).
+ resourceConfiguration = new Configuration();
+ }
+
+ return resourceConfiguration;
+ }
+
+ /**
+ * The plugin container will call this method when it has a new
+ * configuration for your managed resource. Your plugin will re-configure
+ * the managed resource in your own custom way, setting its configuration
+ * based on the new values of the given configuration.
+ *
+ * @see ConfigurationFacet#updateResourceConfiguration(ConfigurationUpdateReport)
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ // this simulates the plugin taking the new configuration and
+ // reconfiguring the managed resource
+ resourceConfiguration = report.getConfiguration().deepCopy();
+
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ }
+
+ /**
+ * When this is called, the plugin is responsible for scanning its managed
+ * resource and look for content that need to be managed for that resource.
+ * This method should only discover packages of the given package type.
+ *
+ * @see ContentFacet#discoverDeployedPackages(PackageType)
+ */
+ public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
+ return null;
+ }
+
+ /**
+ * The plugin container calls this method when new packages need to be
+ * deployed/installed on resources.
+ *
+ * @see ContentFacet#deployPackages(Set, ContentServices)
+ */
+ public DeployPackagesResponse deployPackages(
+ Set<ResourcePackageDetails> packages,
+ ContentServices contentServices) {
+ return null;
+ }
+ /**
+ * When a remote client wants to see the actual data content for an
+ * installed package, this method will be called. This method must return a
+ * stream of data containing the full content of the package.
+ *
+ * @see ContentFacet#retrievePackageBits(ResourcePackageDetails)
+ */
+ public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+ return null;
+ }
+
+ /**
+ * This is the method that is used when the component has to create the
+ * installation steps and their results.
+ *
+ * @see ContentFacet#generateInstallationSteps(ResourcePackageDetails)
+ */
+ public List<DeployPackageStep> generateInstallationSteps(
+ ResourcePackageDetails packageDetails) {
+ return null;
+ }
+
+ /**
+ * This is called when the actual content of packages should be deleted from
+ * the managed resource.
+ *
+ * @see ContentFacet#removePackages(Set)
+ */
+ public RemovePackagesResponse removePackages(
+ Set<ResourcePackageDetails> packages) {
+ return null;
+ }
+
+ /**
+ * When called, the plugin container is asking the plugin to create a new
+ * managed resource. The new resource's details need to be added to the
+ * given report.
+ *
+ * @see CreateChildResourceFacet#createResource(CreateResourceReport)
+ */
+ public CreateResourceReport createResource(CreateResourceReport report) {
+ return null;
+ }
+
+ /**
+ * When called, the plugin container is asking the plugin to delete a
+ * managed resource.
+ *
+ * @see DeleteResourceFacet#deleteResource()
+ */
+ public void deleteResource() throws Exception {
+ }
+
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnConstants.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnConstants.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnConstants.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,47 @@
+package org.jboss.as.integration.jbossts.jopr;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXServiceURL;
+import java.net.MalformedURLException;
+
+public class TxnConstants {
+ static String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi";
+ static MalformedObjectNameException error = null;
+
+ public static final ObjectName OS_MBEAN = initON("jboss.jta:type=ObjectStore");
+ public static final ObjectName STATBEAN = initON("jboss.jta:name=TransactionStatistics");
+ public static final ObjectName REBEAN = initON("jboss.jta:name=RecoveryEnvironmentBean");
+ public static final ObjectName CEBEAN = initON("jboss.jta:name=CoordinatorEnvironmentBean");
+ public static final ObjectName JTAEBEAN = initON("jboss.jta:name=JTAEnvironmentBean");
+ public static final ObjectName OSENVBEAN = initON("jboss.jta:name=ObjectStoreEnvironmentBean");
+ public static final ObjectName COREEBEAN = initON("jboss.jta:name=CoreEnvironmentBean");
+
+// public static final ObjectName JTSEBEAN = initON("jboss.jta:name=JTSEnvironmentBean");
+// public static final ObjectName JDBCBEAN = initON("jboss.jta:name=JDBCEnvironmentBean");
+
+ static ObjectName initON(String name) {
+ try {
+ return new ObjectName(name);
+ } catch (MalformedObjectNameException e) {
+ error = e;
+ return null;
+ }
+ }
+
+ static void initConstants() throws MalformedObjectNameException {
+ if (error != null)
+ throw error;
+ }
+
+ static void setJMXUrl(String url) throws MalformedURLException, MalformedObjectNameException {
+ new JMXServiceURL(url);
+ JMXURL = url;
+
+ initConstants();
+ }
+
+ static String getJMXUrl() {
+ return JMXURL;
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,88 @@
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+
+import javax.management.*;
+import java.io.IOException;
+import java.util.Set;
+
+public class TxnEngineComponent extends JMXClient {
+ private ObjectName coreEnvObjName;
+ private ObjectName statsObjName;
+
+ @Override
+ public void start(ResourceContext context) {
+ super.start(context);
+
+ coreEnvObjName = TxnConstants.COREEBEAN;
+ statsObjName = TxnConstants.STATBEAN;
+ }
+
+ @Override
+ public AvailabilityType getAvailability() {
+ try {
+ conn.getMBeanInfo(new ObjectName("jboss:service=TransactionManager"));
+ return AvailabilityType.UP;
+ } catch (Exception e) {
+ return AvailabilityType.DOWN;
+ }
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) {
+ try {
+ super.getValues(report, requests, coreEnvObjName);
+ super.getValues(report, requests, statsObjName);
+ } catch (Exception e) {
+ log.info("TxnEngineComponent lookup error: " + e.getMessage());
+ }
+ }
+
+ @Override
+ public Configuration loadResourceConfiguration()
+ {
+ Configuration config = new Configuration();
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
+ try {
+ updateConfig(config, TxnConstants.CEBEAN, configDef.getPropertiesInGroup("CommonConfiguration"));
+ updateConfig(config, TxnConstants.COREEBEAN, configDef.getPropertiesInGroup("CommonConfiguration"));
+
+ updateConfig(config, TxnConstants.JTAEBEAN, configDef.getPropertiesInGroup("EngineConfiguration"));
+ updateConfig(config, TxnConstants.JTAEBEAN, configDef.getPropertiesInGroup("EngineConfigurationClasses"));
+ updateConfig(config, TxnConstants.CEBEAN, configDef.getPropertiesInGroup("CoordinatorConfiguration"));
+ updateConfig(config, TxnConstants.REBEAN, configDef.getPropertiesInGroup("RecoveryConfiguration"));
+ updateConfig(config, TxnConstants.COREEBEAN, configDef.getPropertiesInGroup("CoreEngineConfiguration"));
+
+ /* TODO The following beans are not registered - if they are required then register them in transaction-jboss-beans.xml
+ updateConfig(config, JDBCBEAN, configDef.getPropertiesInGroup("JDBCConfiguration"));
+ updateConfig(config, JTSBEAN) configDef.getPropertiesInGroup("JTSConfiguration"));
+ updateConfig(config, ORBPBEAN) configDef.getPropertiesInGroup("OrbPortabilityConfiguration"));
+ */
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+
+
+ return config;
+ }
+
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report)
+ {
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ updateResourceConfiguration(report, "CommonConfiguration", TxnConstants.CEBEAN, TxnConstants.COREEBEAN);
+ updateResourceConfiguration(report, "EngineConfiguration", TxnConstants.JTAEBEAN);
+ updateResourceConfiguration(report, "EngineConfigurationClasses", TxnConstants.JTAEBEAN);
+ updateResourceConfiguration(report, "CoordinatorConfiguration", TxnConstants.CEBEAN);
+ updateResourceConfiguration(report, "RecoveryConfiguration", TxnConstants.REBEAN);
+ updateResourceConfiguration(report, "CoreEngineConfiguration", TxnConstants.COREEBEAN);
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineDiscoveryComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineDiscoveryComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEngineDiscoveryComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,37 @@
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import javax.management.MalformedObjectNameException;
+import java.net.MalformedURLException;
+import java.util.HashSet;
+import java.util.Set;
+
+public class TxnEngineDiscoveryComponent implements ResourceDiscoveryComponent {
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws InvalidPluginConfigurationException {
+ Set<DiscoveredResourceDetails> engines = new HashSet<DiscoveredResourceDetails>();
+ String key = context.getDefaultPluginConfiguration().getSimpleValue("key", "TxnEngine1");
+ String name = context.getDefaultPluginConfiguration().getSimpleValue("name", "Transaction Engine");
+ String version = context.getDefaultPluginConfiguration().getSimpleValue("version", "0.1");
+ String description = context.getDefaultPluginConfiguration().getSimpleValue("description", "JBossTS Transaction Engine Management");
+
+ try {
+ TxnConstants.setJMXUrl(context.getDefaultPluginConfiguration().getSimpleValue("jmxurl", TxnConstants.getJMXUrl()));
+ } catch (MalformedURLException e) {
+ throw new InvalidPluginConfigurationException(e);
+ } catch (MalformedObjectNameException e) {
+ throw new InvalidPluginConfigurationException(e);
+ }
+
+ DiscoveredResourceDetails res = new DiscoveredResourceDetails(
+ context.getResourceType(), key, name, version, description,
+ context.getDefaultPluginConfiguration(), null);
+
+ engines.add(res);
+
+ return engines;
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.domain.measurement.*;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+import java.util.*;
+
+public class TxnEntryComponent extends JMXClient
+{
+ private ObjectName objectName;
+ /*
+ * There are two ways to delete the transaction, via:
+ * 1) invokeOperation, or
+ * 2) deleteResource
+ * But deleteResource does not provide any way of notifying the caller that the operation
+ * failed and the rhq console would then be missing the transaction (until the next
+ * update).
+ * So, until it's fixed, record whether or not it has already been deleted
+ */
+ private boolean deleted;
+
+ @Override
+ public void start(ResourceContext context) throws InvalidPluginConfigurationException
+ {
+ super.start(context);
+// TxnStoreComponent store = (TxnStoreComponent) context.getParentResourceComponent();
+ try {
+ objectName = new ObjectName(context.getResourceKey());
+ } catch (MalformedObjectNameException e) {
+ log.warn("Invalid transaction mbean name: " + context.getResourceKey());
+ throw new InvalidPluginConfigurationException(e);
+ }
+ }
+
+ @Override
+ public AvailabilityType getAvailability() {
+ return (deleted ? AvailabilityType.DOWN : AvailabilityType.UP);
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests)
+ {
+ try {
+ getValues(report, requests, objectName);
+
+ } catch (Exception e) {
+ log.info("MBean log entry lookup error: " + e.getMessage());
+ }
+ }
+
+ @Override
+ public Configuration loadResourceConfiguration()
+ {
+ Configuration config = new Configuration();
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
+ try {
+ updateConfig(config, TxnConstants.OSENVBEAN, configDef.getPropertiesInGroup("ObjStoreConfiguration"));
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+
+ return config;
+ }
+
+ @Override
+ public OperationResult invokeOperation(String name, Configuration params)
+ {
+ String result = "Unsupported operation or invalid Transaction Store";
+
+ if (name.equals("remove")) {
+ try {
+ Object res = invokeOperation(objectName, "remove");
+ result = "operation returned " + res;
+ deleted = true;
+ } catch (Exception e) {
+ result = e.getMessage() == null ? e.getClass().getName() :e.getMessage();
+ }
+ }
+
+ return new OperationResult(result);
+ }
+
+ public void deleteResource() throws Exception {
+ try {
+ if (!deleted) {
+ invokeOperation(objectName, "remove");
+
+ deleted = true;
+ log.debug("Transaction removed from log store: " + objectName);
+ }
+ } catch (Exception e) {
+ // TODO doing this produces a stack trace on the rhq console window - ask the rhq team to provide an error report
+ log.debug("Unable to remove transaction from log store: " + e.getMessage());
+ throw new Exception("Unable to remove transaction: " + e.getMessage());
+ }
+ }
+
+ public Collection<ObjectName> getParticipants() {
+ QueryExp query = Query.eq( Query.attr( "Participant" ), Query.value( true ) );
+ String scope = objectName.getCanonicalName() + ",*";
+
+ try {
+ return conn.queryNames(new ObjectName(scope), query);
+ } catch (Exception e) {
+ log.info("MBean query error: " + e);
+ return Collections.EMPTY_SET;
+ }
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryDiscoveryComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryDiscoveryComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnEntryDiscoveryComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.pluginapi.inventory.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.management.ObjectName;
+import java.util.*;
+
+public class TxnEntryDiscoveryComponent implements ResourceDiscoveryComponent
+{
+ static final Log log = LogFactory.getLog(TxnEntryDiscoveryComponent.class);
+
+ public Set discoverResources(ResourceDiscoveryContext context)
+ {
+ Set<DiscoveredResourceDetails> txns = new HashSet<DiscoveredResourceDetails>();
+ String version = context.getDefaultPluginConfiguration().getSimpleValue("version", "0.1");
+ String description = context.getDefaultPluginConfiguration().getSimpleValue("description", "A terminating transaction");
+
+ TxnStoreComponent parent = (TxnStoreComponent) context.getParentResourceComponent();
+ Collection<ObjectName> components = parent.getComponents();
+
+ for (ObjectName on : components) {
+ txns.add(new DiscoveredResourceDetails(
+ context.getResourceType(), on.getCanonicalName(), on.getCanonicalName(), version,
+ description, context.getDefaultPluginConfiguration(), null));
+ }
+
+ return txns;
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+ package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import javax.management.Attribute;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.util.Set;
+
+/**
+ * TODO
+ */
+public class TxnParticipantComponent extends JMXClient
+{
+ private ObjectName objectName;
+ private TxnEntryComponent txn;
+
+ @Override
+ public void start(ResourceContext context)
+ {
+ super.start(context);
+
+ txn = (TxnEntryComponent) context.getParentResourceComponent();
+
+ try {
+ objectName = new ObjectName(context.getResourceKey());
+ } catch (MalformedObjectNameException e) {
+ log.warn("Invalid transaction participant mbean name: " + e);
+ }
+ }
+
+
+ @Override
+ public AvailabilityType getAvailability() {
+ return (txn != null ? txn.getAvailability() : AvailabilityType.DOWN );
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests)
+ {
+ if (objectName != null)
+ try {
+ super.getValues(report, requests, objectName);
+ } catch (Exception e) {
+ log.warn("Error retrieving txn participant attributes: " + e);
+ }
+ }
+
+
+ @Override
+ public OperationResult invokeOperation(String name, Configuration params) throws Exception
+ {
+ String result = "Unsupported operation or invalid Transaction Store";
+
+ if (name.equals("setStatus") && objectName != null) {
+ try {
+ conn.setAttribute(objectName, new Attribute("Status", params.getSimpleValue("status", "PREPARED")));
+ //Object res = invokeOperation(objectName, "setStatus", params.getSimpleValue("status", "PREPARED"));
+ result = "Operation succeeed"; // + res;
+ } catch (Exception e) {
+ result = "Operation failed: ";
+ result += e.getMessage() == null ? e.getClass().getName() :e.getMessage();
+ throw new Exception(result, e);
+ }
+ }
+
+ return new OperationResult(result);
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantDiscoveryComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantDiscoveryComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnParticipantDiscoveryComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+
+import javax.management.ObjectName;
+import java.util.Set;
+import java.util.HashSet;
+
+public class TxnParticipantDiscoveryComponent implements ResourceDiscoveryComponent
+{
+
+ public Set discoverResources(ResourceDiscoveryContext context) throws InvalidPluginConfigurationException, Exception
+ {
+ Set<DiscoveredResourceDetails> participants = new HashSet<DiscoveredResourceDetails>();
+ TxnEntryComponent parent = (TxnEntryComponent) context.getParentResourceComponent();
+ String version = context.getDefaultPluginConfiguration().getSimpleValue("version", "0.1");
+ String description = context.getDefaultPluginConfiguration().getSimpleValue("description", "A participant in a transaction");
+
+ for (ObjectName on : parent.getParticipants()) {
+ participants.add(new DiscoveredResourceDetails(
+ context.getResourceType(), on.getCanonicalName(), on.getCanonicalName(), version,
+ description, context.getDefaultPluginConfiguration(), null));
+ }
+
+ return participants;
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.domain.measurement.*;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+public class TxnStoreComponent extends JMXClient
+{
+ private ObjectName objectName;
+ private Collection<ObjectName> transactions;
+
+ @Override
+ public void start(ResourceContext context)
+ {
+ super.start(context);
+
+ objectName = TxnConstants.OS_MBEAN;
+ transactions = Collections.EMPTY_LIST;
+ }
+
+ public Collection<ObjectName> getComponents()
+ {
+ QueryExp query = Query.eq( Query.attr( "Participant" ), Query.value( false ) );
+
+ try {
+ // tell the mbean to update its view of which transactions are present
+ log.debug("Updating view of Transactions");
+ invokeOperation(objectName, "probe");
+ transactions = conn.queryNames(new ObjectName("jboss.jta:type=ObjectStore,*"), query);
+ } catch (Exception e) {
+ log.info("MBean query error: " + e);
+ }
+
+// String scope = "jboss.jta:type=ObjectStore,participant=false,*";
+// transactions = queryNames(scope, null);
+
+ return transactions;
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests)
+ {
+ try {
+ if (objectName != null)
+ getValues(report, requests, objectName);
+
+ } catch (Exception e) {
+ log.info("MBean log entry lookup error: " + e.getMessage());
+ }
+ }
+
+ @Override
+ public Configuration loadResourceConfiguration()
+ {
+ Configuration config = new Configuration();
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
+ try {
+ updateConfig(config, TxnConstants.OSENVBEAN, configDef.getPropertiesInGroup("ObjStoreConfiguration"));
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+
+ return config;
+ }
+
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report)
+ {
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ updateResourceConfiguration(report, "ObjStoreConfiguration", TxnConstants.OSENVBEAN);
+ }
+
+ @Override
+ public OperationResult invokeOperation(String name, Configuration params)
+ {
+ String result = "Unsupported operation or invalid Transaction Store";
+
+ if (name.equals("refresh") && objectName != null) {
+ int sz = transactions.size();
+
+ try {
+ invokeOperation(objectName, "probe");
+ result = "Transaction count changed from " + sz + " to " + transactions.size();
+ } catch (Exception e) {
+ result = e.getMessage() == null ? e.getClass().getName() :e.getMessage();
+ }
+ }
+
+ return new OperationResult(result);
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreDiscoveryComponent.java
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreDiscoveryComponent.java (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/main/java/org/jboss/as/integration/jbossts/jopr/TxnStoreDiscoveryComponent.java 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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) 2010
+ * @author JBoss Inc.
+ */
+package org.jboss.as.integration.jbossts.jopr;
+
+import org.rhq.core.pluginapi.inventory.*;
+
+import java.util.Set;
+import java.util.HashSet;
+
+public class TxnStoreDiscoveryComponent implements ResourceDiscoveryComponent
+{
+ public Set discoverResources(ResourceDiscoveryContext context) throws InvalidPluginConfigurationException, Exception
+ {
+ Set<DiscoveredResourceDetails> txns = new HashSet<DiscoveredResourceDetails>();
+ String key = context.getDefaultPluginConfiguration().getSimpleValue("key", "TxnLog1");
+ String name = context.getDefaultPluginConfiguration().getSimpleValue("name", "Transaction Log");
+ String version = context.getDefaultPluginConfiguration().getSimpleValue("version", "0.1");
+ String description = context.getDefaultPluginConfiguration().getSimpleValue("description", "Storage for Transaction Logs");
+
+ DiscoveredResourceDetails res = new DiscoveredResourceDetails(
+ context.getResourceType(), key, name, version, description,
+ context.getDefaultPluginConfiguration(), null);
+
+ txns.add(res);
+
+ return txns;
+ }
+}
Added: labs/jbosstm/trunk/rhq-plugin/src/resources/META-INF/rhq-plugin.xml
===================================================================
--- labs/jbosstm/trunk/rhq-plugin/src/resources/META-INF/rhq-plugin.xml (rev 0)
+++ labs/jbosstm/trunk/rhq-plugin/src/resources/META-INF/rhq-plugin.xml 2010-05-28 15:36:01 UTC (rev 33144)
@@ -0,0 +1,401 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE plugin [
+
+<!ENTITY enginePluginConfig '
+ <plugin-configuration>
+ <c:simple-property name="jmxurl" default="service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi" description="The URL for contacting the JMX listener running on the monitored server" readOnly="false"/>
+ <c:simple-property name="key" default="TxnEngine1" readOnly="true"/>
+ <c:simple-property name="name" default="Transaction Engine" readOnly="false"/>
+ <c:simple-property name="version" default="0.1" readOnly="true"/>
+ <c:simple-property name="description" default="JBossTS Transaction System Management" readOnly="false"/>
+ </plugin-configuration>
+'>
+<!ENTITY objStorePluginConfig '
+ <plugin-configuration>
+ <c:simple-property name="key" default="TxnLog1" readOnly="true"/>
+ <c:simple-property name="name" default="Transaction Log" readOnly="false"/>
+ <c:simple-property name="version" default="0.1" readOnly="true"/>
+ <c:simple-property name="description" default="Transaction Logging: Transactions that have been prepared will appear as services below this entry and are removed once they successfully complete." readOnly="false"/>
+ </plugin-configuration>
+'>
+
+<!ENTITY txnEntryPluginConfig '
+ <plugin-configuration>
+ <c:simple-property name="version" default="0.1" readOnly="true"/>
+ <c:simple-property name="description" default="A Terminating Transaction" readOnly="false"/>
+ </plugin-configuration>
+'>
+
+<!ENTITY txnParticipantPluginConfig '
+ <plugin-configuration>
+ <c:simple-property name="version" default="0.1" readOnly="true"/>
+ <c:simple-property name="description" default="A transaction participant (such as a database or a JMS queue)" readOnly="false"/>
+ </plugin-configuration>
+'>
+
+<!ENTITY globalResourceConfiguration '
+ <resource-configuration>
+
+ <c:group name="CommonConfiguration" displayName="Common Configuration Options">
+ <c:simple-property name="EnableStatistics" description="Set to true to start recording transaction statistics. Note that enabling statistics may have a slight performance impact due to locking on the counter variables." displayName="Enable Transaction Statistics" required="true" readOnly="false"/>
+ <c:simple-property name="DefaultTimeout" description="The default interval after which a transaction may be considered for timeout, in seconds. Note: depending on the reaper mode and workload, transactions may not be timed out immediately." displayName="DefaultTimeout" required="true" readOnly="false"/>
+
+ <c:simple-property name="AllowMultipleLastResources" description="True if multiple last (i.e. one-phase) resources are allowed in the same transaction or not." displayName="Allow Multiple Last Resources" required="true" readOnly="false"/>
+ <c:simple-property name="DisableMultipleLastResourcesWarning" description="True if the per-transaction warning on enlistment of multiple last resources is disabled or not." displayName="Disable Multiple Last Resources Warning" required="true" readOnly="false"/>
+ <c:simple-property name="BuildVersion" description="The version control tag of the source used" displayName="Build Version" required="false" readOnly="true"/>
+ <c:simple-property name="BuildId" description=" The build identification line indicating the os name and version and build date" displayName="Build Id" required="false" readOnly="true"/>
+
+ </c:group>
+
+ <c:group name="EngineConfiguration" displayName="Transaction Manager Options" hiddenByDefault="true">
+ <c:simple-property name="XaRollbackOptimization" description="True if connections associated to XAResources that fail during prepare should be cleaned up immediately. False for cleanup during phase two rollback." displayName="XA Rollback Optimization" required="true" readOnly="false"/>
+ <c:simple-property name="XaAssumeRecoveryComplete" description="if XAResources that cannot be recovered should be assumed to have completed. WARNING: enabling this property is not recommended and may cause inconsistency if your recovery configuration is incorrect or resource managers are not available." displayName=" XA Assume Recovery Complete" required="true" readOnly="false"/>
+ <c:simple-property name="XaTransactionTimeoutEnabled" description="True if the transaction timeout is passed on to the enlisted XAResources." displayName="XA Transaction Timeout Enabled" required="true" readOnly="false"/>
+
+ <c:simple-property name="SupportSubtransactions" description="True if subtransactions are allowed." displayName="Support Subtransactions" required="true" readOnly="true"/>
+<!--
+ <c:simple-property name="UserTransactionJNDIContext" description="The JNDI bind name for the implementation of UserTransaction interface." displayName="UserTransaction JNDI Context" required="true" readOnly="false"/>
+ <c:simple-property name="TransactionManagerJNDIContext" description="The JNDI bind name for the implementation of TransactionManager interface." displayName="TransactionManager JNDI Context" required="true" readOnly="true"/>
+ <c:simple-property name="TransactionSynchronizationRegistryJNDIContext" description="The JNDI bind name for the implementation of TransactionSynchronizationRegistry interface." displayName="TransactionSynchronizationRegistry JNDI Context" required="true" readOnly="true"/>
+-->
+ </c:group>
+
+ <c:group name="CoreEngineConfiguration" displayName="Core Transaction Manager" hiddenByDefault="true">
+ <c:simple-property name="VarDir" description="The var directory path." displayName="Var Dir" required="false" readOnly="true"/>
+ <c:simple-property name="NodeIdentifier" description="The Node Identifier." displayName="Node Identifier" required="false" readOnly="true"/>
+ <c:simple-property name="SocketProcessIdPort" description="The port number for the Socket based process id implementation." displayName="Socket ProcessId Port" required="false" readOnly="true"/>
+ <c:simple-property name="SocketProcessIdMaxPorts" description="The maximum number of ports to search when looking for one that is free." displayName="Socket ProcessId Max Ports" required="false" readOnly="true"/>
+ <c:simple-property name="ProcessImplementation" description="The class name of the Process implementation to use." displayName="Process Implementation" required="false" readOnly="true"/>
+ <c:simple-property name="Pid" description="The process id to use if ManualProcessId is selected. Should be uniq across all instances on the same host." displayName="Pid" required="false" readOnly="true"/>
+
+<!-- the following properties have been moved to group name="CommonConfiguration"
+ - note that moving properties into other groups may require that the relevant Object Names (the ones that implement the properties being moved) are passed to the implementation
+ org.jboss.as.integration.jbossts.jopr.updateResourceConfiguration(ObjectName ... beans)
+ - ideally it would be nice to pass the Object Name as part of the simple-property definition
+
+ <c:simple-property name="AllowMultipleLastResources" description="True if multiple last (i.e. one-phase) resources are allowed in the same transaction or not." displayName="Allow Multiple Last Resources" required="false" readOnly="true"/>
+ <c:simple-property name="DisableMultipleLastResourcesWarning" description="True if the per-transaction warning on enlistment of multiple last resources is disabled or not." displayName="Disable Multiple Last Resources Warning" required="false" readOnly="true"/>
+ <c:simple-property name="BuildVersion" description="The version control tag of the source used" displayName="Build Version" required="false" readOnly="true"/>
+ <c:simple-property name="BuildId" description=" The build identification line indicating the os name and version and build date" displayName="Build Id" required="false" readOnly="true"/>
+
+-->
+
+<!-- TODO how do you display an array property in the JOPR console? -->
+ <c:simple-property name="XaRecoveryNodes" description="The set of node identifiers for which recovery will be performed." displayName="XA Recovery Node Ids" required="false" readOnly="true"/>
+
+ </c:group>
+
+ <c:group name="EngineConfigurationClasses" displayName="Transaction Manager Implementation Options" hiddenByDefault="true">
+ <c:simple-property name="LastResourceOptimisationInterface" description="The classname of the marker interface used to indicate a LastResource." displayName="Last Resource Optimisation Interface" required="false" readOnly="true"/>
+
+ <c:simple-property name="TransactionManagerClassName" description="The class name of the javax.transaction.TransactionManager implementation." displayName="TransactionManager Class Name" required="false" readOnly="true"/>
+ <c:simple-property name="UserTransactionClassName" displayName="User Transaction Class Name" required="false" readOnly="true"/>
+ <c:simple-property name="TransactionSynchronizationRegistryClassName" description="The class name of the javax.transaction.TransactionSynchronizationRegistry implementation." displayName="TransactionSynchronization Registry Class Name" required="false" readOnly="true"/>
+
+ <c:simple-property name="XaResourceMapClassNames" description="The set of XAResourceMap implementation class names used to configure XAException handling." displayName="XA ResourceMap Class Names" required="false" readOnly="true"/>
+ <c:simple-property name="XaResourceRecoveryClassNames" description="The set of XAResourceRecovery implementation class names, each of which may have configuration data appended to it." displayName="XA Resource Recovery Class Names" required="false" readOnly="true"/>
+ <c:simple-property name="XaResourceOrphanFilterClassNames" description="A list of names of classes that implement XAResourceOrphanFilter." displayName="XA Resource Orphan Filter Class Names" required="false" readOnly="true"/>
+ </c:group>
+
+ <c:group name="CoordinatorConfiguration" displayName="Coordinator Options" hiddenByDefault="true">
+ <c:simple-property name="BeforeCompletionWhenRollbackOnly" description="True if beforeCompletion should be called on Synchronizations when completing transactions that are marked rollback only." displayName="BeforeCompletionWhenRollbackOnly" required="true" readOnly="false"/>
+ <c:simple-property name="ClassicPrepare" description="True is classic prepare handling is enabled, false otherwise." displayName="ClassicPrepare" required="true" readOnly="false"/>
+ <c:simple-property name="CommitOnePhase" description="True if one phase commit optimization is to be used." displayName="CommitOnePhase" required="true" readOnly="false"/>
+ <!--
+ <c:simple-property name="DefaultTimeout" description="The default interval after which a transaction may be considered for timeout, in seconds. Note: depending on the reaper mode and workload, transactions may not be timed out immediately." displayName="DefaultTimeout" required="true" readOnly="false"/>
+ -->
+ <!--
+ <c:simple-property name="EnableStatistics" description="True if transaction statistics should be recorded. Note: Enabling statistics may have a slight performance impact due to locking on the counter variables." displayName="EnableStatistics" required="true" readOnly="false"/>
+ -->
+ <c:simple-property name="MaintainHeuristics" description="True if heuristic outcomes should be recorded." displayName="MaintainHeuristics" required="true" readOnly="false"/>
+ <c:simple-property name="ReadonlyOptimisation" description="True if handling of read only resources should be optimized." displayName="ReadonlyOptimisation" required="true" readOnly="false"/>
+ <c:simple-property name="SharedTransactionLog" description="True if the transaction log sould be run in shared mode or not." displayName="SharedTransactionLog" required="true" readOnly="false"/>
+ <c:simple-property name="StartDisabled" description="True if the transaction manager should be created in a disabled state or not." displayName="StartDisabled" required="true" readOnly="false"/>
+ <c:simple-property name="TransactionLog" description="True if the transaction log should be distinct from the action store." displayName="TransactionLog" required="true" readOnly="true"/>
+ <c:simple-property name="TransactionStatusManagerEnable" description="True if the transaction status manager (TSM) service, needed for out of process recovery, should be provided or not." displayName="TransactionStatusManagerEnable" required="true" readOnly="true"/>
+ <c:simple-property name="TxReaperCancelFailWaitPeriod" description="The number of millisecs delay afer a worker thread is interrupted, before the reaper writes the it off as a zombie and starts a new thread." displayName="TxReaperCancelFailWaitPeriod" required="true" readOnly="true"/>
+ <c:simple-property name="TxReaperCancelWaitPeriod" description="The number of millisecs delay afer a cancel is scheduled, before the reaper tries to interrupt the worker thread executing the cancel." displayName="TxReaperCancelWaitPeriod" required="true" readOnly="true"/>
+ <c:simple-property name="TxReaperTimeout" description="The timeout (wakeup) interval of the reapers PERIODIC mode, in milliseconds." displayName="TxReaperMode" required="true" readOnly="true"/>
+ <c:simple-property name="TxReaperTimeout" displayName="TxReaperTimeout" required="true" readOnly="true"/>
+ <c:simple-property name="TxReaperZombieMax" description="The threshold for count of non-exited zombies at which the system starts logging error messages." displayName="TxReaperZombieMax" required="true" readOnly="true"/>
+ <c:simple-property name="WriteOptimisation" description="True if write optimisation is enabled, false otherwise." displayName="WriteOptimisation" required="true" readOnly="true"/>
+ <c:simple-property name="CheckedActionFactoryClassName" description="The class name of an implementation of CheckedActionFactory" displayName="CheckedActionFactoryClassName" required="true" readOnly="true"/>
+ <c:simple-property name="AlternativeRecordOrdering" description="Whether to use the alternative abstract record ordering. True if order abstract records on type first, or false if order on Uid first." displayName="Use alterntate record ordering" required="false" readOnly="true"/>
+
+ <c:simple-property name="ActionStore" description="The symbolic name for the action store type." displayName="Action Store" required="true" readOnly="true"/>
+ <c:simple-property name="AsyncCommit" description="True if anynchronous commit behaviour is enabled." displayName="Async Commit" required="true" readOnly="true"/>
+ <c:simple-property name="AsyncPrepare" description="True if asynchronous prepare behaviour is enabled." displayName="Async Prepare" required="true" readOnly="true"/>
+ <c:simple-property name="AsyncRollback" description="True if asynchronous rollback behaviour is enabled." displayName="Async Rollback" required="true" readOnly="true"/>
+ </c:group>
+
+ <c:group name="RecoveryConfiguration" displayName="Recovery System" hiddenByDefault="true">
+
+ <c:simple-property name="PeriodicRecoveryPeriod" description="The interval between recovery scans, in seconds." displayName="PeriodicRecoveryPeriod" required="true" readOnly="false"/>
+ <c:simple-property name="RecoveryBackoffPeriod" description="The interval between recovery phases within a recovery scan, in seconds." displayName="RecoveryBackoffPeriod" required="true" readOnly="false"/>
+ <c:simple-property name="RecoveryListener" description="True if the recovery system should listen on a network socket. False for local JVM only use." displayName="RecoveryListener" required="true" readOnly="false"/>
+ <c:simple-property name="RecoveryPort" description="The network port number on which the recovery listener should bind." displayName="RecoveryPort" required="true" readOnly="false"/>
+ <c:simple-property name="RecoveryAddress" description="The hostname on which the recovery listener shoud bind." displayName="RecoveryAddress" required="true" readOnly="false"/>
+ <c:simple-property name="TransactionStatusManagerPort" description="The network port number on which the transaction status manager should bind." displayName="TransactionStatusManagerPort" required="true" readOnly="false"/>
+ <c:simple-property name="TransactionStatusManagerAddress" description="The hostname on which the transaction status manager should bind." displayName="TransactionStatusManagerAddress" required="true" readOnly="false"/>
+ <c:simple-property name="ExpiryScanInterval" description="The interval on which the ObjectStore will be scanned for expired items, in hours." displayName="ExpiryScanInterval" required="true" readOnly="false"/>
+ <c:simple-property name="TransactionStatusManagerExpiryTime" description="The time period after which items will be considered to have expired, in hours." displayName="TimeoutSocket" required="true" readOnly="false"/>
+ <c:simple-property name="TimeoutSocket" description="True if SO_TIMEOUT should be set on Listener socket instances." displayName="TimeoutSocket" required="true" readOnly="false"/>
+
+<!-- List<String> -->
+ <c:simple-property name="ExpiryScanners" description="A list of names of classes that implement ExpiryScanner." displayName="ExpiryScanners" required="false" readOnly="true"/>
+ <c:simple-property name="RecoveryExtensions" description="A list of names of classes that implement RecoveryModule." displayName="RecoveryExtensions" required="false" readOnly="true"/>
+ <c:simple-property name="RecoveryActivators" description="A list of names of classes that implement RecoveryActivator." displayName="RecoveryActivators" required="false" readOnly="true"/>
+
+ </c:group>
+
+ <c:group name="JDBCConfiguration" hiddenByDefault="true" displayName="JDBC Configuration">
+ <c:simple-property name="IsolationLevel" description="The default isolation level for tansactional database operations." displayName="Isolation Level" required="false" readOnly="true"/>
+ </c:group>
+
+ <c:group name="JTSConfiguration" displayName="JTS Configuration" hiddenByDefault="true">
+
+ <c:simple-property name="UserTransactionClassName" description="The class name of the javax.transaction.UserTransaction implementation." displayName="TransactionManager" required="false" readOnly="true"/>
+ <c:simple-property name="NeedTranContext" description="True if transaction context interceptors will require a context to be present." displayName="NeedTranContext" required="false" readOnly="true"/>
+ <c:simple-property name="AlwaysPropagateContext" description="True if a transaction context should always be propagated on remote calls. False to propagate selectively." displayName="AlwaysPropagateContext" required="false" readOnly="true"/>
+ <c:simple-property name="Interposition" description="The Xid format interposition strategy implementation class name." displayName="Interposition" required="false" readOnly="true"/>
+ <c:simple-property name="CheckedTransactions" description="True if checked transactions should be used." displayName="CheckedTransactions" required="false" readOnly="true"/>
+ <c:simple-property name="SupportSubtransactions" description="True if subtransactions should be used in the JTS. Note that this is distinct from the JTA module subtransaction option." displayName="SupportSubtransactions" required="false" readOnly="true"/>
+ <c:simple-property name="SupportRollbackSync" description="True if Synchronizations should be fired on transaction rollback. Note: this is distinct from the coordinators beforeCompletionWhenRollbackOnly option." displayName="SupportRollbackSync" required="false" readOnly="true"/>
+ <c:simple-property name="SupportInterposedSynchronization" description="True if Synchronizations can be interposed i.e. registered direct with the parent coordinator." displayName="SupportInterposedSynchronization" required="false" readOnly="true"/>
+ <c:simple-property name="PropagateTerminator" description="True if a reference to the terminator should be included in the propagation context." displayName="PropagateTerminator" required="false" readOnly="true"/>
+ <c:simple-property name="ContextPropMode" description="The name of the context propagation mode (CONTEXT or NONE)." displayName="ContextPropMode" required="false" readOnly="true"/>
+ <c:simple-property name="RecoveryManagerPort" description="The port number on which the recovery manager will listen." displayName="RecoveryManagerPort" required="false" readOnly="true"/>
+ <c:simple-property name="RecoveryManagerAddress" description="The hostname on which the recovery manager will bind." displayName="RecoveryManagerAddress" required="false" readOnly="true"/>
+ <c:simple-property name="TimeoutPropagation" description="True if the timeout value sent should be the time remaining or not. true for OTS 1.2 (time remaining), false for backwards compatible (total time)" displayName="TimeoutPropagation" required="false" readOnly="true"/>
+ <c:simple-property name="IssueRecoveryRollback" description="True if resources will have rollback invoked explicitly on them by recovery." displayName="IssueRecoveryRollback" required="false" readOnly="true"/>
+ <c:simple-property name="CommitedTransactionRetryLimit" description="The number of attempts to make to notify resources of a transaction commit during recovery." displayName="CommitedTransactionRetryLimit" required="false" readOnly="true"/>
+
+ </c:group>
+
+ <c:group name="OrbPortabilityConfiguration" displayName="Orb Portability Layer Configuration" hiddenByDefault="true">
+ <c:simple-property name="InitialReferencesRoot" description="The name of the directory in which the initial reference file is stored." displayName="Initial References Root" required="false" readOnly="true"/>
+ <c:simple-property name="InitialReferencesFile" description="The relative name of the file in which initial references are stored." displayName="Initial References File" required="false" readOnly="true"/>
+ <c:simple-property name="FileDir" description="The name of the directory to store reference files in." displayName="File Directory" required="false" readOnly="true"/>
+ <c:simple-property name="ResolveService" description="The symbolic name of the configuration mechanism for resolving service references." displayName="Resolve Service" required="false" readOnly="true"/>
+ <!--
+ <c:simple-property name="EventHandlers" description="The classnames for the ORB object connect/disconnect event handlers." displayName="Event Handlers" required="false" readOnly="true"/>
+ -->
+ <c:simple-property name="OrbImplementation" description="The classname of the ORBImple implementation." displayName="Orb Implementation" required="false" readOnly="true"/>
+ <c:simple-property name="OaImplementation" description="The classname of the POAImple implementation." displayName="Oa Implementation" required="false" readOnly="true"/>
+ <c:simple-property name="BindMechanism" description="The symbolic name of the configuration mechanism used for service bindings." displayName="Bind Mechanism" required="false" readOnly="true"/>
+ <!--
+ <c:simple-property name="String> OrbInitializationProperties" description="The Map used for the orb initialization parameters. As there are potentially an arbitrary number of ORBs, each with an arbitrary set of initialization classes, it is not well suited to bean based properties." displayName="Orb Initialization Properties" required="false" readOnly="true"/>
+ -->
+
+ </c:group>
+
+ </resource-configuration>
+'>
+
+<!ENTITY generalTraits '
+ <metric property="BuildId"
+ displayName="Sofware build identification"
+ description="Indication of who built the release, on which date and on which machine"
+ dataType="trait" displayType="summary"/>
+ <metric property="BuildVersion"
+ displayName="Source code version control tag"
+ description="The version control tag of the source used for this build"
+ dataType="trait" displayType="summary"/>
+'>
+
+<!ENTITY txStatsMetrics '
+ <metric property="NumberOfTransactions"
+ displayName="NumberOfTransactions"
+ description="the total number of transactions (top-level and nested) created since last restart"
+ displayType="summary"
+ defaultOn="true"
+ defaultInterval="10000"
+ measurementType="trendsup" dataType="measurement"/>
+<!--
+ <metric property="numberOfTransactions"
+ category="utilization"
+ measurementType="trendsup"/>
+-->
+ <metric property="NumberOfNestedTransactions"
+ displayName="NumberOfNestedTransactions"
+ description="the total number of nested (sub) transactions created"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfHeuristics"
+ displayName="NumberOfHeuristics"
+ description="the number of transactions which have terminated with heuristic outcomes"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfCommittedTransactions"
+ displayName="NumberOfCommittedTransactions"
+ description="the number of committed transactions"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfAbortedTransactions"
+ displayName="NumberOfAbortedTransactions"
+ description="the number of aborted (i.e. rolledback) transactions"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfInflightTransactions"
+ displayName="NumberOfInflightTransactions"
+ description="the number of transactions that have begun but not yet terminated"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfTimedOutTransactions"
+ displayName="NumberOfTimedOutTransactions"
+ description="the number of transactions that have rolled back due to timeout"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfApplicationRollbacks"
+ displayName="NumberOfApplicationRollbacks"
+ description="the number of transactions that have been rolled back by application request (including ones that have timed out)"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+ <metric property="NumberOfResourceRollbacks"
+ displayName="NumberOfResourceRollbacks"
+ description="the number of transactions that rolled back due to resource (participant) failure"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+'>
+
+<!ENTITY objStoreConfiguration '
+ <resource-configuration>
+ <c:group name="ObjStoreConfiguration" displayName="Transaction Log Configuration">
+ <c:simple-property name="ObjectStoreDir" description="The filesystem location of the ObjectStore" displayName="ObjectStore Directory" readOnly="true"/>
+ <c:simple-property name="ObjectStoreType" description="The type of the ObjectStore" displayName="ObjectStore Type" readOnly="true"/>
+ <c:simple-property name="LocalOSRoot" description="The local ObjectStore root directory name. This should be a path element, not a complete path." displayName="Local OS Root" readOnly="true"/>
+ <c:simple-property name="ObjectStoreSync" description="True if ObjectStore operations should be synched to disk. Note that this value may be overridden by store implementation specific configuration. See also: TransactionSync" displayName="ObjectStore Sync" readOnly="true"/>
+ <c:simple-property name="TransactionSync" description="True if transaction log operations should be synched to disk or not. Caution: Disabling this may be lead to non-ACID transaction behaviour." displayName="Transaction Sync" readOnly="true"/>
+ <c:simple-property name="HashedDirectories" description="The number of directories over which the ObjectStore contents will be distributed. Splitting the contents is important for performance on some file systems, as it reduces chain length ie the number of items in a directory, and directory lock contention." displayName="Number of Hashed Directories" readOnly="true"/>
+ <c:simple-property name="Share" description="The share mode for the ObjectStore, i.e., is this being shared between VMs? For definition of the values @see com.arjuna.ats.arjuna.objectstore.StateStatus.stateStatusString()" displayName="Share" readOnly="true"/>
+ <c:simple-property name="HierarchyRetry" description="The maximum number of attempts which may be made to create a file path in the store." displayName="HierarchyRetry" readOnly="true"/>
+ <c:simple-property name="HierarchyTimeout" description="The time in milliseconds to wait between file creation retries." displayName="Hierarchy Timeout" readOnly="true"/>
+ </c:group>
+
+ </resource-configuration>
+'>
+
+<!ENTITY objStoreEntryMetrics '
+
+ <metric property="CreationTime"
+ displayName="CreationTime"
+ description="Time when the txn was prepared"
+ dataType="trait" displayType="summary"/>
+ <metric property="AgeInSeconds"
+ displayName="AgeInSeconds"
+ description="The elapsed time since prepare was called on this transaction"
+ units="seconds"
+ measurementType="trendsup" dataType="measurement" displayType="summary"/>
+
+'>
+
+<!ENTITY participantMetrics '
+ <metric property="Status"
+ displayName="Status"
+ description="Reports the commitment status of this participant (can be one of Pending, Prepared, Failed, Heuristic or Readonly)"
+ dataType="trait" displayType="summary"/>
+ <metric property="Type"
+ displayName="Type"
+ description="The record type used for storing this transaction"
+ dataType="trait" displayType="detail"/>
+ <metric property="ClassName"
+ displayName="XA Resource Class Name"
+ description="The java type that implements this XAResource"
+ dataType="trait" displayType="detail"/>
+ <metric property="EisProductName"
+ displayName="JNDI Name"
+ description="JNDI name of the JCA resource"
+ dataType="trait" displayType="summary"/>
+ <metric property="EisProductVersion"
+ displayName="Product Version"
+ description="JCA product version"
+ dataType="trait" displayType="summary"/>
+ <metric property="Timeout"
+ displayName="Timeout"
+ description="The number of seconds before the resource can rollback the branch"
+ units="seconds" dataType="trait" displayType="detail"/>
+ '>
+
+]>
+
+<plugin name="JBossTS"
+ displayName="JBossTSPlugin"
+ description="Supports management and monitoring of JBossTS transaction managers"
+ package="org.jboss.as.integration.jbossts.jopr"
+ version="0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <service name="TX Engine"
+ description="Supports management and monitoring of JBossTS transaction managers"
+ discovery="TxnEngineDiscoveryComponent"
+ class="TxnEngineComponent"
+ singleton="true">
+
+ <runs-inside>
+ <parent-resource-type name="JBossAS Server" plugin="JBossAS"/>
+ <parent-resource-type name="JBossAS Server" plugin="JBossAS5"/>
+ </runs-inside>
+
+ &enginePluginConfig;
+ &generalTraits;
+ &txStatsMetrics;
+ &globalResourceConfiguration;
+
+ <service name="Transaction Log"
+ discovery="TxnStoreDiscoveryComponent"
+ class="TxnStoreComponent"
+ singleton="true">
+ <!--
+ <operation name="refresh" displayName="Find Transactions" description="Resynchronize view of unresolved transactions">
+ <results><c:simple-property name="operationResult" type="string" description="Indication of whether there were changes"/></results>
+ </operation>
+ -->
+
+ &objStorePluginConfig;
+ &objStoreConfiguration;
+
+ <service name="Transaction Entries"
+ discovery="TxnEntryDiscoveryComponent"
+ class="TxnEntryComponent"
+ createDeletePolicy="delete-only"
+ singleton="false">
+
+ &txnEntryPluginConfig;
+ <operation name="remove" displayName="Remove Transaction" description="Tell the Transaction Manager to remove this action">
+ <results><c:simple-property name="operationResult" type="string" description="Indication of whether the transaction was removed"/></results>
+ </operation>
+
+ &objStoreEntryMetrics;
+
+ <service name="Transaction Participants"
+ discovery="TxnParticipantDiscoveryComponent"
+ class="TxnParticipantComponent"
+ singleton="false">
+
+ &txnParticipantPluginConfig;
+
+ <operation name="setStatus" displayName="Clear Heuristic" description="Modify the status of this participant. This operation is most useful in
+ those cases where the participant generated a heuristic outcome and the administrator wants the Transaction manager to re-run phase 2 of
+ the commitment protocol.">
+ <parameters>
+ <c:simple-property required="true" name="status" displayName="New status">
+ <c:property-options>
+ <c:option value="PREPARED" default="true"/>
+ <c:option value="HEURISTIC"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ <results><c:simple-property name="operationResult" type="string" description="Indication of whether the status was modified"/></results>
+ </operation>
+
+ &participantMetrics;
+ </service>
+ </service>
+
+ </service>
+
+ </service>
+
+</plugin>
More information about the jboss-svn-commits
mailing list