1 4 package org.objectweb.speedo.jmx.mbeans; 5 6 import org.objectweb.jorm.api.PMapper; 7 import org.objectweb.perseus.pool.api.Pool; 8 import org.objectweb.perseus.pool.api.PoolAttributes; 9 import org.objectweb.speedo.Speedo; 10 import org.objectweb.speedo.api.SpeedoProperties; 11 import org.objectweb.speedo.mapper.api.JormFactory; 12 import org.objectweb.speedo.pm.api.ProxyManagerFactory; 13 14 import java.util.ArrayList ; 15 import java.util.Arrays ; 16 import java.util.Collection ; 17 import java.util.Collections ; 18 19 24 public class PMF implements PMFMBean { 25 26 private ProxyManagerFactory pmf; 27 private PMapper mapper; 28 private JormFactory jf; 29 private PoolAttributes pa; 30 private Pool pool; 31 32 public PMF(PoolAttributes pa, 33 Pool pool, 34 ProxyManagerFactory pmf, 35 PMapper mapper, 36 JormFactory jf) { 37 this.pa = pa; 38 this.pool = pool; 39 this.pmf = pmf; 40 this.mapper = mapper; 41 this.jf = jf; 42 } 43 44 public int getPool_Of_PM_MaxSize() { 45 return pa.getMaxSize(); 46 } 47 public void setPool_Of_PM_MaxSize(int arg0) throws Exception { 48 pa.setMaxSize(arg0); 49 } 50 51 public int getPool_Of_PM_MinSize() { 52 return pa.getMinSize(); 53 } 54 public void setPool_Of_PM_MinSize(int arg0) throws Exception { 55 pa.setMinSize(arg0); 56 } 57 58 public long getPool_Of_PM_Timeout() { 59 return pa.getTimeout(); 60 } 61 public void setPool_Of_PM_Timeout(long arg0) { 62 pa.setTimeout(arg0); 63 } 64 65 public long getPool_Of_PM_TTL() { 66 return pa.getTTL(); 67 } 68 public void setPool_Of_PM_TTL(long arg0) { 69 pa.setTTL(arg0); 70 } 71 72 public int getPool_Of_PM_Current_Size() { 73 return pool.getSize(); 74 } 75 76 public int getPool_Of_PM_Current_Free_Number() { 77 return pool.getFreeResourceNumber(); 78 } 79 public int getPool_Of_PM_Current_Used_Number() { 80 return pool.getUsedResourceNumber(); 81 } 82 83 public boolean getTransaction_RetainValues() { 84 return pmf.getRetainValues(); 85 } 86 public void setTransaction_RetainValues(boolean rv) { 87 pmf.setRetainValues(rv); 88 } 89 90 public boolean getTransaction_RestoreValues() { 91 return pmf.getRestoreValues(); 92 } 93 public void setTransaction_RestoreValues(boolean rv) { 94 pmf.setRestoreValues(rv); 95 } 96 97 public boolean getTransaction_MultiThread() { 98 return pmf.getMultithreaded(); 99 } 100 public void setTransaction_MultiThread(boolean mt) { 101 pmf.setMultithreaded(mt); 102 } 103 104 public boolean getIsOpen() { 105 return !pmf.isClosed(); 106 } 107 108 public String getMappingStructure() { 109 return Speedo.getMappingStructureString(jf.getMappingStructureRule()); 110 } 111 112 public boolean getDebug() { 113 return Boolean.valueOf( 114 pmf.getProperties().getProperty(SpeedoProperties.DEBUG)) 115 .booleanValue(); 116 } 117 118 public void setDebug(boolean d) { 119 pmf.getProperties().setProperty( 120 SpeedoProperties.DEBUG, Boolean.TRUE.toString()); 121 } 122 123 public Collection getPersistentClasseNames() { 124 return Arrays.asList(mapper.getMappedClasses()); 125 } 126 127 } 128 | Popular Tags |