1 23 24 29 30 package com.sun.jdo.spi.persistence.support.sqlstore.ejb; 31 32 import javax.transaction.*; 33 34 import com.sun.jdo.api.persistence.model.ClassLoaderStrategy; 35 import com.sun.jdo.api.persistence.support.JDOFatalInternalException; 36 import com.sun.jdo.api.persistence.support.PersistenceManagerFactory; 37 38 57 abstract public class TransactionHelperImpl 58 implements TransactionHelper { 59 60 static final String DEFAULT_STRING = "default"; 62 65 static { 66 if (System.getProperty( 67 ClassLoaderStrategy.PROPERTY_MULTIPLE_CLASS_LOADERS) == null) 68 ClassLoaderStrategy.setStrategy( 69 ClassLoaderStrategy.MULTIPLE_CLASS_LOADERS_RELOAD); 70 } 71 72 75 public boolean isManaged() { 76 return true; 77 } 78 79 80 91 abstract public Transaction getTransaction(); 92 93 97 abstract public UserTransaction getUserTransaction(); 98 99 110 public int translateStatus(int st) { 111 return st; 112 } 113 114 129 public PersistenceManagerFactory replaceInternalPersistenceManagerFactory( 130 PersistenceManagerFactory pmf) { 131 132 return pmf; 133 } 134 135 150 public Object preInvoke(Object component) { 151 return null; 152 } 153 154 161 public void postInvoke(Object im) { 162 } 163 164 174 public void registerSynchronization(Transaction jta, Synchronization sync) 175 throws RollbackException, SystemException { 176 177 jta.registerSynchronization(sync); 178 } 179 180 193 public java.sql.Connection getConnection(Object resource, String username, 194 String password) throws java.sql.SQLException { 195 java.sql.Connection rc = null; 196 if (resource instanceof javax.sql.DataSource ) { 197 javax.sql.DataSource ds = (javax.sql.DataSource )resource; 198 if (username == null) { 199 rc = ds.getConnection(); 200 } else { 201 rc = ds.getConnection(username, password); 202 } 203 } 204 return rc; 205 } 206 207 217 abstract public java.sql.Connection getNonTransactionalConnection( 218 Object resource, String username, String password) 219 throws java.sql.SQLException ; 220 221 227 abstract public TransactionManager getLocalTransactionManager(); 228 229 233 public java.sql.Statement unwrapStatement(java.sql.Statement stmt) { 234 return stmt; 235 } 236 237 244 public void setPersistenceManagerFactoryDefaults(PersistenceManagerFactory pmf) { 245 pmf.setOptimistic(false); 246 } 248 249 256 public String getDDLNamePrefix(Object info) { 257 return DEFAULT_STRING; 258 } 259 260 263 public void registerApplicationLifeCycleEventListener( 264 ApplicationLifeCycleEventListener listener) { 265 266 } 267 268 } 269 | Popular Tags |