/**
* Returns the fully configured datasource.
*/
public DataSource getDataSource() throws Exception{
UpdateableOracleDataSource tempDatasource = new UpdateableOracleDataSource();
// set the properties
tempDatasource.setDatabaseShapeColumn(myTextFieldDatabaseColumn.getText());
tempDatasource.setDatabaseName(myTextFieldDatabaseName.getText());
tempDatasource.setDatabasePassword(myTextFieldDatabasePassword.getText());
tempDatasource.setDatabaseServername(myTextFieldDatabaseServername.getText());
tempDatasource.setDatabaseUsername(myTextFieldDatabaseUsername.getText());
tempDatasource.setDatabaseTablename(myTextFieldDatabaseTablename.getText());
tempDatasource.setDatabaseSpatialReferenceID(myTextFieldSpatialReferenceID.getText());
try{
tempDatasource.setDatabasePort(Integer.parseInt(myTextFieldDatabasePort.getText()));
}
catch (NumberFormatException e){
tempDatasource.setDatabasePort(1521);
}
tempDatasource.connect();
// save the configuration information.
System.getProperties().setProperty(Constants.getApplicationName()+"."+SERVERNAME_TAG, tempDatasource.getDatabaseServername());
System.getProperties().setProperty(Constants.getApplicationName()+"."+DATABASENAME_TAG, tempDatasource.getDatabaseName());
System.getProperties().setProperty(Constants.getApplicationName()+"."+USERNAME_TAG, tempDatasource.getDatabaseUsername());
System.getProperties().setProperty(Constants.getApplicationName()+"."+PASSWORD_TAG, tempDatasource.getDatabasePassword());
System.getProperties().setProperty(Constants.getApplicationName()+"."+PORT_TAG, ""+tempDatasource.getDatabasePort());
System.getProperties().setProperty(Constants.getApplicationName()+"."+SHAPECOLUMN_TAG, ""+tempDatasource.getDatabaseShapeColumn());
System.getProperties().setProperty(Constants.getApplicationName()+"."+SRID_TAG, ""+tempDatasource.getDatabaseSpatialReferenceID());
System.getProperties().setProperty(Constants.getApplicationName()+"."+TABLENAME_TAG, tempDatasource.getDatabaseTablename());
return tempDatasource;
}