00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 package org.objectweb.jonas.container;
00027
00028 import org.objectweb.jonas_ejb.container.EntityCounters;
00029 import org.objectweb.jonas_ejb.container.JEntityFactory;
00030 import org.objectweb.jonas_ejb.deployment.api.EntityDesc;
00031
00037 public class EntityBean extends EJB {
00038
00039
00040 private static final int LOCK_CONTAINER_READ_UNCOMMITTED = EntityDesc.LOCK_CONTAINER_READ_UNCOMMITTED;
00041 private static final int LOCK_CONTAINER_SERIALIZED = EntityDesc.LOCK_CONTAINER_SERIALIZED;
00042 private static final int LOCK_CONTAINER_READ_COMMITTED = EntityDesc.LOCK_CONTAINER_READ_COMMITTED;
00043 private static final int LOCK_DATABASE = EntityDesc.LOCK_DATABASE;
00044 private static final int LOCK_READ_ONLY = EntityDesc.LOCK_READ_ONLY;
00045
00046 private String persistency;
00047
00048 public EntityBean(String objectName, JEntityFactory factoryToManage, String persistency) {
00049 super(objectName, factoryToManage);
00050 this.persistency = persistency;
00051 }
00052
00056 public String getPersistency() {
00057 return persistency;
00058 }
00059
00064 public int getPassivationTimeOut() {
00065 return ejbToManage.getContainer().getSwapTime();
00066 }
00067
00072 public void setPassivationTimeOut(int timeOut) {
00073 ejbToManage.getContainer().setSwapTime(timeOut);
00074 }
00075
00080 public int getInactivityTimeOut() {
00081 return ((JEntityFactory) ejbToManage).getInactivityTimeout();
00082 }
00083
00087 public boolean getShared() {
00088 return ((JEntityFactory) ejbToManage).isShared();
00089 }
00090
00094 public int getMinPoolSize() {
00095 return ((JEntityFactory) ejbToManage).getMinPoolSize();
00096 }
00097
00101 public int getMaxCacheSize() {
00102 return ((JEntityFactory) ejbToManage).getMaxCacheSize();
00103 }
00104
00108 public int getPoolSize() {
00109 return ((JEntityFactory) ejbToManage).getPoolSize();
00110 }
00111
00115 public String getLockPolicy() {
00116 int lockPolicy = ((JEntityFactory) ejbToManage).lockPolicy();
00117 String sLockPolicy = null;
00118 switch (lockPolicy) {
00119 case LOCK_CONTAINER_READ_UNCOMMITTED:
00120 sLockPolicy = "container-read-uncommitted";
00121 break;
00122 case LOCK_CONTAINER_SERIALIZED:
00123 sLockPolicy = "container-serialized";
00124 break;
00125 case LOCK_CONTAINER_READ_COMMITTED:
00126 sLockPolicy = "container-read-committed";
00127 break;
00128 case LOCK_DATABASE:
00129 sLockPolicy = "database";
00130 break;
00131 case LOCK_READ_ONLY:
00132 sLockPolicy = "read-only";
00133 break;
00134 }
00135 return sLockPolicy;
00136 }
00137
00138 public boolean getPrefetch() {
00139 return ((JEntityFactory) ejbToManage).isPrefetch();
00140 }
00144 public int getCacheSize() {
00145 return ((JEntityFactory) ejbToManage).getCacheSize();
00146 }
00147
00152 public Integer[] getEntityCounters() {
00153 EntityCounters ec = ((JEntityFactory) ejbToManage).getEntityCounters();
00154 Integer[] result = new Integer[5];
00155 result[0] = new Integer(ec.inTx);
00156 result[1] = new Integer(ec.outTx);
00157 result[2] = new Integer(ec.idle);
00158 result[3] = new Integer(ec.passive);
00159 result[4] = new Integer(ec.removed);
00160 return result;
00161 }
00162
00166 public void synchronize() {
00167 ((JEntityFactory) ejbToManage).sync();
00168 }
00169
00173 public void reduceCache() {
00174 ((JEntityFactory) ejbToManage).reduceCache();
00175 }
00176 }