git-svn-id: https://svn.coded.pt/svn/SIPRP@851 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 17 years ago
parent 264e71f9cf
commit 5f12ea964a

@ -0,0 +1,69 @@
package siprp;
import java.util.Date;
import java.util.Properties;
import com.evolute.utils.Singleton;
import com.evolute.utils.jdo.JDOProvider;
public class JDOInitializer
{
public void initializeJDO(String url, String user, String password)
{
Date d = new Date();
System.out.println( "INIT: " + d );
Properties jpoxProps;
jpoxProps = System.getProperties();//new Properties();
// Set the PersistenceManagerFactoryClass to the TJDO class.
jpoxProps.setProperty( "javax.jdo.PersistenceManagerFactoryClass",
"org.jpox.PersistenceManagerFactoryImpl" );
// Set the JDBC driver name.
jpoxProps.setProperty( "javax.jdo.option.ConnectionDriverName", (String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ) );
jpoxProps.setProperty( "org.jpox.identifier.fullyQualifiedNames", "false" );
// props.setProperty("com.triactive.jdo.transactionIsolation",
// "read-uncommitted" );
// Set the connection URL
// jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", "jdbc:informix-sqli://192.168.0.3:6666"
// + "/apdp_db:informixserver=server" );
jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", url );
jpoxProps.setProperty( "javax.jdo.option.ConnectionUserName", user );
jpoxProps.setProperty( "javax.jdo.option.ConnectionPassword", password );
// jpoxProps.setProperty( "javax.jdo.option.IgnoreCache", "true" );
// jpoxProps.setProperty( "javax.jdo.option.NonTransactionalRead", "true" );
jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" );
jpoxProps.setProperty( "org.jpox.autoCreateTables", "false" );
jpoxProps.setProperty( "org.jpox.autoCreateSchema", "false" );
jpoxProps.setProperty( "org.jpox.autoCreateConstraints", "false" );
jpoxProps.setProperty( "org.jpox.validateTables", "false" );
jpoxProps.setProperty( "org.jpox.validateConstraints", "false" );
jpoxProps.setProperty( "org.jpox.autoStartMechanismMode", "Ignored" );
jpoxProps.setProperty( "org.jpox.autoStartMechanism", "None" );
// jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" );
// jpoxProps.setProperty( "javax.jdo.option.Optimistic", "true" );
// jpoxProps.setProperty( "org.jpox.identifier.defaultSchemaName", "informix" );
jpoxProps.setProperty( "org.jpox.rdbms.CheckExistTablesOrViews", "false" );
System.setProperty( "org.jpox.catalogName", (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ) );
System.setProperty( "org.jpox.schemaName", "" );
// PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( jpoxProps );
//// pmf.setOptimistic( true );
//System.out.print( "Loading PM: " + new Date() );
// // ( ( PersistenceManagerFactoryImpl )pmf ).setTransactionIsolation( Connection.TRANSACTION_READ_UNCOMMITTED );
// // Retrieve a PersistenceManager from the PersistenceManagerFactory.
// PersistenceManager pm = pmf.getPersistenceManager();
// JDOObject.setPersistentManager( pm );
// Singleton.setInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY, pmf );
// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm );
JDOProvider jdoProvider = new JDOProvider( jpoxProps );
Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, jdoProvider );
System.out.println( "PM done " + new Date() + "JDO: " + jdoProvider );
}
}

@ -186,7 +186,7 @@ public class Main implements com.evolute.utils.ui.window.Connector
StatementExecuterFactory.initialize(
new DBStatementExecuter( dbm.getSharedExecuter() ) );
initializeJPOX( url, user, passwd );
new JDOInitializer().initializeJDO( url, user, passwd );
StatementExecuterFactory.initialize(
new DBStatementExecuter( dbm.getSharedExecuter() ) );
StatementExecuterFactory.initialize(
@ -284,61 +284,5 @@ public class Main implements com.evolute.utils.ui.window.Connector
// TODO: override DB location, user and password
}
public void initializeJPOX(String url, String user, String password)
{
Date d = new Date();
System.out.println( "INIT: " + d );
Properties jpoxProps;
jpoxProps = System.getProperties();//new Properties();
// Set the PersistenceManagerFactoryClass to the TJDO class.
jpoxProps.setProperty( "javax.jdo.PersistenceManagerFactoryClass",
"org.jpox.PersistenceManagerFactoryImpl" );
// Set the JDBC driver name.
jpoxProps.setProperty( "javax.jdo.option.ConnectionDriverName", (String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ) );
jpoxProps.setProperty( "org.jpox.identifier.fullyQualifiedNames", "false" );
// props.setProperty("com.triactive.jdo.transactionIsolation",
// "read-uncommitted" );
// Set the connection URL
// jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", "jdbc:informix-sqli://192.168.0.3:6666"
// + "/apdp_db:informixserver=server" );
jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", url );
jpoxProps.setProperty( "javax.jdo.option.ConnectionUserName", user );
jpoxProps.setProperty( "javax.jdo.option.ConnectionPassword", password );
// jpoxProps.setProperty( "javax.jdo.option.IgnoreCache", "true" );
// jpoxProps.setProperty( "javax.jdo.option.NonTransactionalRead", "true" );
jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" );
jpoxProps.setProperty( "org.jpox.autoCreateTables", "false" );
jpoxProps.setProperty( "org.jpox.autoCreateSchema", "false" );
jpoxProps.setProperty( "org.jpox.autoCreateConstraints", "false" );
jpoxProps.setProperty( "org.jpox.validateTables", "false" );
jpoxProps.setProperty( "org.jpox.validateConstraints", "false" );
jpoxProps.setProperty( "org.jpox.autoStartMechanismMode", "Ignored" );
jpoxProps.setProperty( "org.jpox.autoStartMechanism", "None" );
// jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" );
// jpoxProps.setProperty( "javax.jdo.option.Optimistic", "true" );
// jpoxProps.setProperty( "org.jpox.identifier.defaultSchemaName", "informix" );
jpoxProps.setProperty( "org.jpox.rdbms.CheckExistTablesOrViews", "false" );
System.setProperty( "org.jpox.catalogName", (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ) );
System.setProperty( "org.jpox.schemaName", "" );
// PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( jpoxProps );
//// pmf.setOptimistic( true );
//System.out.print( "Loading PM: " + new Date() );
// // ( ( PersistenceManagerFactoryImpl )pmf ).setTransactionIsolation( Connection.TRANSACTION_READ_UNCOMMITTED );
// // Retrieve a PersistenceManager from the PersistenceManagerFactory.
// PersistenceManager pm = pmf.getPersistenceManager();
// JDOObject.setPersistentManager( pm );
// Singleton.setInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY, pmf );
// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm );
JDOProvider jdoProvider = new JDOProvider( jpoxProps );
Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, jdoProvider );
System.out.println( "PM done " + new Date() + "JDO: " + jdoProvider );
}
}

Loading…
Cancel
Save