/* * 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; } }