From b4262582fbfad8499402aea9e32880ddd8ab7016 Mon Sep 17 00:00:00 2001 From: Frederico Palma Date: Tue, 25 May 2004 12:36:04 +0000 Subject: [PATCH] no message git-svn-id: https://svn.coded.pt/svn/SIPRP@85 bb69d46d-e84e-40c8-a05a-06db0d633741 --- trunk/siprp/Main.java | 43 ++++++++++++++++++++--------- trunk/siprp/SingletonConstants.java | 23 +++++++++++++++ 2 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 trunk/siprp/SingletonConstants.java diff --git a/trunk/siprp/Main.java b/trunk/siprp/Main.java index c1474737..f96cc2ca 100644 --- a/trunk/siprp/Main.java +++ b/trunk/siprp/Main.java @@ -10,6 +10,11 @@ import com.evolute.utils.sql.*; import com.evolute.utils.ui.*; import com.evolute.utils.ui.window.*; +import javax.jdo.JDOHelper; +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; +import javax.jdo.Transaction; + import java.awt.*; import java.io.*; import java.text.*; @@ -19,6 +24,8 @@ import javax.swing.tree.*; public class Main implements Connector { + private final static ClassLoader classLoader = new EVUtilsImageLib().getClass().getClassLoader(); + private static final String dbase = "siprp"; private SIPRPTracker siprpTracker; @@ -35,21 +42,22 @@ public class Main implements Connector { */ Insert.setDefaultKeyRetriever( JDBCAutoKeyRetriever.DEFAULT ); String server = System.getProperty( "server.address" ); - if( server == null ) - { - server = "ws_fpalma"; - } - - String user = "root"; - String passwd = "UNIXLuvsU"; +// if( server == null ) +// { +// server = "ws_fpalma"; +// } +// +// String user = "root"; +// String passwd = "UNIXLuvsU"; +// +// DBManager dbm = new JDBCManager( "jdbc:mysql://" + server + "/" + dbase, +// user, passwd , 10, 8, 8, null ); - DBManager dbm = new JDBCManager( "jdbc:mysql://" + server + "/" + dbase, - user, passwd , 10, 8, 8, null ); UnicodeChecker.setUseDoubleSlash( true ); - Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); +// Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); - StatementExecuterFactory.initialize( - new DBStatementExecuter( dbm.getSharedExecuter() ) ); +// StatementExecuterFactory.initialize( +// new DBStatementExecuter( dbm.getSharedExecuter() ) ); // } // FichaWindow window = new FichaWindow(); /* window.setLogo( new ImageIcon( @@ -76,9 +84,18 @@ public class Main implements Connector } DBManager dbm = new JDBCManager( "jdbc:mysql://" + server + "/" + dbase, user, passwd , 10, 8, 8, null ); - UnicodeChecker.setUseDoubleSlash( true ); +// UnicodeChecker.setUseDoubleSlash( true ); Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); + StatementExecuterFactory.initialize( + new DBStatementExecuter( dbm.getSharedExecuter() ) ); + + Properties props = new Properties(); + props.load( classLoader.getResourceAsStream( "speedo.properties" ) ); + PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( props ); + PersistenceManager pm = pmf.getPersistenceManager(); + Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm ); + StatementExecuterFactory.initialize( new DBStatementExecuter( dbm.getSharedExecuter() ) ); StatementExecuterFactory.initialize( diff --git a/trunk/siprp/SingletonConstants.java b/trunk/siprp/SingletonConstants.java new file mode 100644 index 00000000..fbc14e5f --- /dev/null +++ b/trunk/siprp/SingletonConstants.java @@ -0,0 +1,23 @@ +/* + * SingletonConstants.java + * + * Created on 25 de Maio de 2004, 13:34 + */ + +package siprp; + +/** + * + * @author fpalma + */ +public class SingletonConstants +{ + public static final String PERSISTENCE_MANAGER = "PERSISTENCE_MANAGER"; + + + /** Creates a new instance of SingletonConstants */ + private SingletonConstants() + { + } + +}