01: /**
02: * Copyright (C) 2001-2005 France Telecom R&D
03: */package org.objectweb.speedo.jmx.mbeans;
04:
05: import org.objectweb.perseus.dependency.api.DependencyGraph;
06: import org.objectweb.speedo.api.SpeedoProperties;
07: import org.objectweb.speedo.pm.api.POManagerFactoryItf;
08: import org.objectweb.speedo.pm.jdo.api.JDOPOManagerFactoryItf;
09:
10: import java.util.ArrayList;
11: import java.util.Collection;
12: import java.util.HashMap;
13: import java.util.Iterator;
14: import java.util.Map;
15:
16: /**
17: *
18: *
19: * @author chassase
20: */
21: public class Tx implements TxMBean {
22:
23: JDOPOManagerFactoryItf pmf;
24: DependencyGraph dg;
25:
26: public Tx(JDOPOManagerFactoryItf pmf, DependencyGraph dg) {
27: this .pmf = pmf;
28: this .dg = dg;
29: }
30:
31: public String getConcurrencyManager() {
32: return pmf.getProperties().getProperty(
33: SpeedoProperties.TRANSACTION_LOCKING);
34: }
35:
36: public String getConcurrencyPolicy() {
37: return (pmf.getOptimistic() ? "optimistic" : "pessimistic");
38: }
39:
40: public String getTransactionManagerName() {
41: return pmf.getProperties()
42: .getProperty(SpeedoProperties.TM_NAME);
43: }
44:
45: public Collection getDependencies() {
46: Map vs = new HashMap(dg.getVertexes());
47: ArrayList deps = new ArrayList(vs.size());
48: for (Iterator it = vs.entrySet().iterator(); it.hasNext();) {
49: Map.Entry me = (Map.Entry) it.next();
50: deps.add(me.getKey() + " ==> " + me.getValue());
51: }
52: return deps;
53: }
54: }
|