use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class TestDataSourceResource method delete.
private static void delete() {
init();
WebResource resource = client.resource(delete_url);
IDatabaseConnection connection = createConnectionObject();
String conn = (new JSONObject(connection)).toString();
System.out.println(conn);
try {
Response result = resource.accept(MediaType.APPLICATION_JSON).entity(conn).post(Response.class);
System.out.println(result);
} catch (Exception ex) {
System.out.println("Error in Delete");
}
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class TestDataSourceResource method createConnectionObject.
private static IDatabaseConnection createConnectionObject() {
IDatabaseConnection connection = new DatabaseConnection();
connection.setAccessType(DatabaseAccessType.NATIVE);
// connection.setDriverClass("org.hsqldb.jdbcDriver");
// connection.setUrl("jdbc:hsqldb:hsql://localhost:9001/sampledata");
connection.setUsername("pentaho_user");
connection.setPassword("password");
connection.setName(CONNECTION_NAME);
return connection;
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class TestDataSourceResource method getConnectionByName.
private static IDatabaseConnection getConnectionByName(String aConnecitonName) {
ClientConfig clientConfig = new DefaultClientConfig();
Client client = Client.create(clientConfig);
IDatabaseConnection connection = null;
WebResource resource = client.resource(getURL);
try {
connection = resource.type(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_XML).entity(aConnecitonName).get(DatabaseConnection.class);
} catch (Exception ex) {
ex.printStackTrace();
}
return connection;
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class TestDataSourceResource method add.
private static void add() {
init();
IDatabaseConnection connection = createConnectionObject();
String conn = (new JSONObject(connection)).toString();
System.out.println(conn);
try {
WebResource resource = client.resource(add_url);
Response result = resource.accept(MediaType.APPLICATION_JSON).entity(conn).post(Response.class);
System.out.println(result);
} catch (Exception ex) {
System.out.println("Error in Add");
}
}
Aggregations