use of org.ovirt.engine.sdk4.ConnectionBuilder in project ovirt-engine-sdk-java by oVirt.
the class VmBackup method run.
/**
* This is the non-static method equivalent to {@code main}. Its purpose is to create a connection to the server and
* make sure that it is always closed, regardless of what happens during the execution of the actual work.
*/
private void run() throws Exception {
// Connect to the server:
ConnectionBuilder builder = ConnectionBuilder.connection().url(API_URL).user(API_USER).password(API_PASSWORD).trustStoreFile(API_TRUSTSTORE);
// Do the rest of the work and always remember to close the connection:
try (Connection connection = builder.build()) {
log.info("Connected to the server.");
run(connection.systemService());
}
}
Aggregations