forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
62 lines
1.4 KiB
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package db;
|
|
|
|
import com.evolute.properties.EvoAbstractPropertiesLoader;
|
|
import com.evolute.properties.PropertiesException;
|
|
|
|
/**
|
|
*
|
|
* @author dneves
|
|
*/
|
|
public class DBPropertiesLoader extends EvoAbstractPropertiesLoader
|
|
{
|
|
private static DBPropertiesLoader INSTANCE = null;
|
|
|
|
private String connection_url = null;
|
|
private String local_connection_url = null;
|
|
|
|
|
|
private DBPropertiesLoader()
|
|
{
|
|
super( null, null, null, null );
|
|
}
|
|
|
|
public static synchronized DBPropertiesLoader getInstance()
|
|
{
|
|
if ( INSTANCE == null )
|
|
{
|
|
INSTANCE = new DBPropertiesLoader();
|
|
}
|
|
return INSTANCE;
|
|
}
|
|
|
|
@Override
|
|
protected void postLoad() throws PropertiesException
|
|
{
|
|
String server = findProperty( DBConstants.SERVER_SIPRP );
|
|
int port = findProperty( DBConstants.PORT_SIPRP, new Integer( -1 ) );
|
|
String database = findProperty( DBConstants.DATABASE_SIPRP );
|
|
connection_url = "jdbc:postgresql://" + server + ":" + port + "/" + database;
|
|
|
|
server = findProperty( DBConstants.SERVER_SIPRP_LOCAL );
|
|
port = findProperty( DBConstants.PORT_SIPRP_LOCAL, new Integer( -1 ) );
|
|
database = findProperty( DBConstants.DATABASE_SIPRP_LOCAL );
|
|
local_connection_url = "jdbc:postgresql://" + server + ":" + port + "/" + database;
|
|
}
|
|
|
|
public String getConnectionURL()
|
|
{
|
|
return connection_url;
|
|
}
|
|
|
|
public String getLocalConnectionURL()
|
|
{
|
|
return local_connection_url;
|
|
}
|
|
|
|
}
|