Methods Summary |
---|
public void | close()
Stack stack;
data = null;
synchronized( cache ) {
if( !cache.containsKey(this.getClass()) ) {
stack = new Stack();
cache.put(this.getClass(), stack);
}
else {
stack = (Stack)cache.get(this.getClass());
}
}
synchronized( stack ) {
stack.push(this);
}
|
public java.util.HashMap | execute()
return execute(true);
|
public java.util.HashMap | execute(boolean cl)
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(getDataSource());
HashMap res;
connection = ds.getConnection();
statement = connection.prepareStatement(getStatement());
res = run();
if( cl ) {
close();
}
return res;
}
catch( NamingException e) {
throw new PersistenceException(e);
}
catch( SQLException e ) {
throw new PersistenceException(e);
}
finally {
if( results != null ) {
try { results.close(); }
catch( SQLException e ) { }
results = null;
}
if( statement != null ) {
try { statement.close(); }
catch( SQLException e ) { }
statement = null;
}
if( connection != null ) {
try { connection.close(); }
catch( SQLException e ) { }
connection = null;
}
data = null;
}
|
public java.util.HashMap | execute(java.util.HashMap d)
data = d;
return execute(true);
|
public java.util.HashMap | execute(java.util.HashMap d, boolean cl)
data = d;
return execute(cl);
|
public abstract java.lang.String | getDataSource()
|
public static org.dasein.persist.Execution | getInstance(java.lang.Class cls)
try {
Stack stack;
synchronized( cache ) {
if( !cache.containsKey(cls) ) {
return (Execution)cls.newInstance();
}
else {
stack = (Stack)cache.get(cls);
}
}
synchronized( stack ) {
if( stack.empty() ) {
return (Execution)cls.newInstance();
}
else {
return (Execution)stack.pop();
}
}
}
catch( InstantiationException e ) {
throw new RuntimeException(e.getMessage());
}
catch( IllegalAccessException e ) {
throw new RuntimeException(e.getMessage());
}
|
public abstract java.lang.String | getStatement()
|
public abstract java.util.HashMap | run()
|
public void | setData(java.util.HashMap data)
this.data = data;
|