RETURN
- INTERNAL
- public abstract class AuthenticatedFuture<RETURN,INTERNAL> extends Object implements Future<RETURN>
Constructor and Description |
---|
AuthenticatedFuture(Future<INTERNAL> internalFuture,
Class<RETURN> returnClass,
rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper wrapper)
Create an AuthenticatedFuture that uses the SessionManager singleton for the verification.
|
AuthenticatedFuture(Future<INTERNAL> internalFuture,
Class<RETURN> returnClass,
rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper wrapper,
SessionManager sessionManager)
Create an AuthenticatedFuture.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Cancel the internal future.
|
protected abstract RETURN |
convertFromInternal(INTERNAL internalType)
Method defining how to get the return value from the result of the internal future.
|
RETURN |
get()
Call get on the internal future, verifies the ticket and converts the result from
the internal future to REPONSE.
|
RETURN |
get(long timeout,
TimeUnit unit)
Call get on the internal future with a given timeout, verifies the ticket and converts the result from
the internal future to REPONSE.
|
protected Class<RETURN> |
getReturnClass()
Get the return class.
|
protected SessionManager |
getSessionManager()
Get the session manager used by this authenticated future.
|
protected abstract rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper |
getTicketFromInternal(INTERNAL internalType)
Method defining how to get the ticket from the result of the internal future.
|
boolean |
isCancelled()
Return if the internal future has been canceled.
|
boolean |
isDone()
Return it the internal future is done.
|
public AuthenticatedFuture(Future<INTERNAL> internalFuture, Class<RETURN> returnClass, rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper wrapper)
internalFuture
- The internal future whose result is verified.returnClass
- Class of type RETURN.wrapper
- The ticket that was used for the request.public AuthenticatedFuture(Future<INTERNAL> internalFuture, Class<RETURN> returnClass, rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper wrapper, SessionManager sessionManager)
internalFuture
- The internal future whose result is verified.returnClass
- Class of type RETURN.wrapper
- The ticket that was used for the request.sessionManager
- The session manager that is used for the verification.public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<RETURN>
public boolean isDone()
public RETURN get() throws InterruptedException, ExecutionException
get
in interface Future<RETURN>
InterruptedException
- If interrupted inside of get of the internal future.ExecutionException
- If the execution of the internal future failed, the response could not be verified or the conversion to the return type failed.public RETURN get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<RETURN>
InterruptedException
- If interrupted inside of get of the internal future.ExecutionException
- If the execution of the internal future failed, the response could not be verified or the conversion to the return type failed.TimeoutException
- If get on the internal future times out.protected Class<RETURN> getReturnClass()
protected SessionManager getSessionManager()
protected abstract rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper getTicketFromInternal(INTERNAL internalType)
internalType
- The result from the internal future.protected abstract RETURN convertFromInternal(INTERNAL internalType) throws org.openbase.jul.exception.CouldNotPerformException
internalType
- The result from the internal future.org.openbase.jul.exception.CouldNotPerformException
- If the conversion from the internal type fails.Copyright © 2017–2018 openbase.org. All rights reserved.