KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > jmx > mbeans > Tx


1 /**
2  * Copyright (C) 2001-2005 France Telecom R&D
3  */

4 package org.objectweb.speedo.jmx.mbeans;
5
6 import org.objectweb.perseus.dependency.api.DependencyGraph;
7 import org.objectweb.speedo.api.SpeedoProperties;
8 import org.objectweb.speedo.pm.api.ProxyManagerFactory;
9
10 import java.util.ArrayList JavaDoc;
11 import java.util.Collection JavaDoc;
12 import java.util.HashMap JavaDoc;
13 import java.util.Iterator JavaDoc;
14 import java.util.Map JavaDoc;
15
16 /**
17  *
18  *
19  * @author chassase
20  */

21 public class Tx implements TxMBean {
22
23     ProxyManagerFactory pmf;
24     DependencyGraph dg;
25     
26     public Tx(ProxyManagerFactory pmf, DependencyGraph dg) {
27         this.pmf = pmf;
28         this.dg = dg;
29     }
30     
31     public String JavaDoc getConcurrencyManager() {
32         return pmf.getProperties().getProperty(SpeedoProperties.TRANSACTION_LOCKING);
33     }
34
35     public String JavaDoc getConcurrencyPolicy() {
36         return (pmf.getOptimistic() ? "optimistic" : "pessimistic");
37     }
38
39     public String JavaDoc getTransactionManagerName() {
40         return pmf.getProperties().getProperty(SpeedoProperties.TM_NAME);
41     }
42     
43     public Collection JavaDoc getDependencies() {
44         Map JavaDoc vs = new HashMap JavaDoc(dg.getVertexes());
45         ArrayList JavaDoc deps = new ArrayList JavaDoc(vs.size());
46         for (Iterator JavaDoc it = vs.entrySet().iterator(); it.hasNext();) {
47             Map.Entry JavaDoc me = (Map.Entry JavaDoc) it.next();
48             deps.add(me.getKey() + " ==> " + me.getValue());
49         }
50         return deps;
51     }
52 }
53
Popular Tags