use of org.geotools.data.oracle.OracleNGDataStoreFactory in project sldeditor by robward-scisys.
the class DatabaseConnectionFactory method createOracle.
/**
* Creates a new DatabaseConnection object for Oracle.
*
* @return the database connection
*/
public static DatabaseConnection createOracle() {
List<DatabaseConnectionField> list = new ArrayList<DatabaseConnectionField>();
list.add(new DatabaseConnectionField(OracleNGDataStoreFactory.HOST));
list.add(new DatabaseConnectionField(OracleNGDataStoreFactory.PORT));
list.add(new DatabaseConnectionField(OracleNGDataStoreFactory.SCHEMA));
list.add(new DatabaseConnectionField(OracleNGDataStoreFactory.DATABASE));
list.add(new DatabaseConnectionField(OracleNGDataStoreFactory.USER));
list.add(new DatabaseConnectionField(OracleNGDataStoreFactory.PASSWD));
OracleNGDataStoreFactory factory = new OracleNGDataStoreFactory();
DatabaseConnection databaseConnection = new DatabaseConnection(OracleNGDataStoreFactory.DBTYPE, factory.getDisplayName(), true, list, new DatabaseConnectionName() {
@Override
public String getConnectionName(String duplicatePrefix, int noOfTimesDuplicated, Map<String, String> properties) {
String connectionName = String.format("%s/%s@%s:%s", properties.get(OracleNGDataStoreFactory.SCHEMA.key), properties.get(OracleNGDataStoreFactory.DATABASE.key), properties.get(OracleNGDataStoreFactory.HOST.key), properties.get(OracleNGDataStoreFactory.PORT.key));
for (int i = 0; i < noOfTimesDuplicated; i++) {
connectionName = duplicatePrefix + connectionName;
}
return connectionName;
}
});
return databaseConnection;
}
Aggregations