Package org.ovirt.engine.sdk4
Interface Connection
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
HttpConnection
public interface Connection extends AutoCloseable
This interface represents a connection to the API server.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
authenticate()
Return token which can be used for authentication instead of credentials.void
close(boolean logout)
Releases the resources used by this connection.<TYPE> TYPE
followLink(TYPE object)
Follows the `href` attribute of the given object, retrieves the target object and returns it.boolean
isLink(Object object)
Indicates if the given object is a link.SystemService
systemService()
Returns a reference to the root of the services tree.boolean
validate()
Validate the connection by making a trivial request and checking that the result is not null-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
systemService
SystemService systemService()
Returns a reference to the root of the services tree.
-
isLink
boolean isLink(Object object)
Indicates if the given object is a link. An object is a link if it has an `href` attribute.- Parameters:
object
- the object to check- Returns:
true
iff the object is a link
-
followLink
<TYPE> TYPE followLink(TYPE object)
Follows the `href` attribute of the given object, retrieves the target object and returns it.- Type Parameters:
TYPE
- the type of the target of the link- Parameters:
object
- the object containing the `href` attribute- Returns:
- the object retrieved from the `href`
-
authenticate
String authenticate()
Return token which can be used for authentication instead of credentials. It will be created, if it not exists, yet. By default the token will be revoked when the connection is closed, unless the `logout` parameter of the `close` method is `false`.
-
close
void close(boolean logout) throws Exception
Releases the resources used by this connection.- Parameters:
logout
- A boolean, which specify if token should be revoked, and so user should be logged out.- Throws:
Exception
-
validate
boolean validate()
Validate the connection by making a trivial request and checking that the result is not null- Returns:
- true if the connection is valid, false otherwise
-
-