forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1142 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
eb3b644acc
commit
ff056c233d
@ -1,27 +0,0 @@
|
||||
package db;
|
||||
|
||||
public interface DBConstants
|
||||
{
|
||||
public static final String WEB_URL = "jdbc:postgresql://localhost:5436/siprp";
|
||||
// public static final String WEB_URL = "jdbc:postgresql://storage:5432/siprp_20091203";
|
||||
public static final String WEB_USER = "postgres";
|
||||
// public static final String WEB_PASSWORD = "Typein";
|
||||
public static final String WEB_PASSWORD = null;
|
||||
|
||||
// public static final String WEB_URL = "jdbc:postgresql://www.evolute.pt:5436/siprp";
|
||||
// public static final String WEB_USER = "postgres";
|
||||
// public static final String WEB_PASSWORD = "Typein";
|
||||
|
||||
public static final String LOCAL_URL = "jdbc:postgresql://localhost:5436/siprp_local_3";
|
||||
// public static final String LOCAL_URL = "jdbc:postgresql://storage:5432/siprp_local_3_20091203";
|
||||
public static final String LOCAL_USER = "postgres";
|
||||
// public static final String LOCAL_PASSWORD = "Typein";
|
||||
public static final String LOCAL_PASSWORD = null;
|
||||
|
||||
// public static final String LOCAL_URL = "jdbc:postgresql://www.evolute.pt:5436/siprp_local_3";
|
||||
// public static final String LOCAL_USER = "postgres";
|
||||
// public static final String LOCAL_PASSWORD = "Typein";
|
||||
|
||||
public static final String WEB_DBMANAGER = "WEB DBMANAGER";
|
||||
public static final String LOCAL_DBMANAGER = "LOCAL DBMANAGER";
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package db;
|
||||
|
||||
import siprp.SingletonConstants;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.JDBCManager;
|
||||
import com.evolute.utils.db.keyretrievers.PostgresqlAutoKeyRetriever;
|
||||
import com.evolute.utils.sql.Insert;
|
||||
import com.evolute.utils.strings.UnicodeChecker;
|
||||
|
||||
public class PlanoActuacaoDBInit
|
||||
{
|
||||
public static void initDB( boolean web )
|
||||
throws Exception
|
||||
{
|
||||
if( web )
|
||||
{
|
||||
String url = DBConstants.WEB_URL;
|
||||
String user = DBConstants.WEB_USER;
|
||||
String pwd = DBConstants.WEB_PASSWORD;
|
||||
DBManager webManager = new JDBCManager( url, user, pwd, 10, 8, 8, null );
|
||||
Singleton.setInstance( DBConstants.WEB_DBMANAGER, webManager );
|
||||
|
||||
url = DBConstants.LOCAL_URL;
|
||||
user = DBConstants.LOCAL_USER;
|
||||
pwd = DBConstants.LOCAL_PASSWORD;
|
||||
DBManager localManager = new JDBCManager( url, user, pwd, 10, 8, 8, null );
|
||||
Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, localManager );
|
||||
}
|
||||
else
|
||||
{
|
||||
String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX );
|
||||
url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/";
|
||||
url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/";
|
||||
String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER );
|
||||
String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD );
|
||||
DBManager webManager = new JDBCManager( url, user, pwd, 10, 8, 8, null );
|
||||
Singleton.setInstance( DBConstants.WEB_DBMANAGER, webManager );
|
||||
Singleton.setInstance( DBConstants.LOCAL_DBMANAGER, Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ) );
|
||||
}
|
||||
|
||||
Insert.setDefaultKeyRetriever( PostgresqlAutoKeyRetriever.RETRIEVER );
|
||||
UnicodeChecker.setUseDoubleSlash( true );
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue