public interface RepositoryExceptionHandler
Exceptions throwns when opening a session are handled separately using
handleException(Throwable)
All other exceptions handleException(Throwable)
are handled using
RepositoryExceptionHandler#handleOpenException(RepositoryInstance, Throwable)
This type of exceptions is handled separatelly because it may be due to an authentication failure
and this way we give the oportunity to a client application to retry the authentication
Modifier and Type | Method and Description |
---|---|
CoreSession |
handleAuthenticationFailure(Repository repository,
Throwable t)
When a session open fails this method is invoked by passing the current
repository instance and the exception that occured.
|
void |
handleException(Throwable t)
Handle exceptions other than thos fired at session creation
|
void handleException(Throwable t) throws Exception
t
- the exception to handleException
- if don't know how to hanle rethrow the exception to the callerCoreSession handleAuthenticationFailure(Repository repository, Throwable t) throws Exception
This method must handle authentication failures and retry to login and getting the session created.
If the session is opened successfuly it must be returned
to the caller otherwise a null value must be returned so that the caller will rethrown the exception - so finally
it will be catched by the handleException(Throwable)
This ghives a chance to clients to display login dialogs when a session creation failed because
of an authentication failure - usually a EJBAccessException
Example of usage
if (t instanceof EJBAccessException) {
int ret = showLoginDialog();
if (ret == OK) {
// do login if not already done in the dialog
// Framework.login(username, password);
// and retry the creation of a new session
return repository.getSession();
}
}
return null;
repository
- the repository instance that attempted to create a sessiont
- the re-trhown exception if session cannot be openenedException
Copyright © 2014 Nuxeo SA. All Rights Reserved.