public interface Connection extends Closeable, ServicesBroker
TYPE
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects the server.
|
String |
createTicket()
Creates a one-time FS SSO ticket for the user of this connection.
|
String |
createTicket(boolean oneTimeTicket)
Creates a FS SSO ticket for the user of this connection.
|
void |
disconnect()
Disconnects from the server and clears all services.
|
AdminService |
getAdminService()
Deprecated.
since 4.2.34 - use
getService(AdminService.class) instead. |
SpecialistsBroker |
getBroker()
Returns broker without project binding.
|
ClassLoader |
getClassLoader()
Returns a class loader which can load classes from the server and from module libraries.
|
ExceptionHandler |
getExceptionHandler()
Returns current
IOErrorHandler . |
String |
getHost()
Get server host
|
MailService |
getMailService()
Deprecated.
since 4.2.34 - use
getService(MailService.class) instead. |
MessageService |
getMessageService()
Deprecated.
since 4.2.34 - use
getService(MessageService.class) instead. |
int |
getMode()
Get the connection mode, either
ConnectionManager.HTTP_MODE or
ConnectionManager.SOCKET_MODE . |
int |
getPort()
Get server port
|
Project |
getProjectById(long id)
Return a project with a specific id or
null if no project exists with the given id or the project
is not visible for the current user. |
Project |
getProjectByName(String name)
Return a project with a specific name or
null if no project exists with the specified name. |
Project[] |
getProjects()
Get all active projects allowed for the current user.
|
Connection |
getRemoteConnection(RemoteProjectConfiguration config)
Returns the remote connection specified by the given
RemoteProjectConfiguration . |
ServerConfiguration |
getServerConfiguration()
Returns server properties.
|
Object |
getService(String serviceName)
Returns a service instance for the given name.
|
String |
getServletZone()
Get servlet zone, used in HTTP mode only for constructing the connection URL.
|
User |
getUser()
Return the user of the current session
|
boolean |
isConnected()
Returns
true if this connection is connected. |
boolean |
isRemote()
Indicates whether this connection is related to a remote project (based on a
RemoteProjectConfiguration ) or not. |
void |
removeTicket(String ticket)
Destroys the given
ticket ; neccessary for long-life tickets created with createTicket(false) ! |
void |
setExceptionHandler(ExceptionHandler handler)
Sets the
IOErrorHandler for this connections. |
getService
void connect() throws IOException, de.espirit.firstspirit.server.authentication.AuthenticationException, MaximumNumberOfSessionsExceededException
de.espirit.firstspirit.server.authentication.AuthenticationException
- if the authentication of the belonging user failedMaximumNumberOfSessionsExceededException
- if the maximum number of allowed sessions (license value) exceededIOException
boolean isConnected()
true
if this connection is connected. Important: Connection problems, detected during this
call, can cause a disconnect
.true
if this connection is connected.void disconnect() throws IOException
IOException
String getHost()
int getPort()
int getMode()
ConnectionManager.HTTP_MODE
or
ConnectionManager.SOCKET_MODE
.ConnectionManager.HTTP_MODE
or
ConnectionManager.SOCKET_MODE
@Nullable String getServletZone()
@NotNull SpecialistsBroker getBroker()
broker agent
of given
specialists broker to get hold of a broker with project relation
.@NotNull @Deprecated AdminService getAdminService()
getService(AdminService.class)
instead.@NotNull @Deprecated MailService getMailService()
getService(MailService.class)
instead.@Deprecated @NotNull MessageService getMessageService()
getService(MessageService.class)
instead.Project[] getProjects()
ProjectStorage.getProjects(boolean)
to get projects unfiltered.@Nullable Project getProjectByName(String name)
null
if no project exists with the specified name.name
- name of the projectnull
if no project exists with the specified name.@Nullable Project getProjectById(long id)
null
if no project exists with the given id or the project
is not visible for the current user.id
- id of the projectnull
if no project exists with the given id or the project
is not visible for the current user.User getUser() throws InvalidSessionException
InvalidSessionException
@NotNull Object getService(String serviceName) throws ServiceNotFoundException
serviceName
- The name of the service to look up.ServiceNotFoundException
- If no appropriate service was found.String createTicket()
createTicket(false)
.String createTicket(boolean oneTimeTicket)
invalidated
manually!oneTimeTicket
- true
for one-time-tickets,false
for long-life-tickets.createTicket()
,
removeTicket(String)
void removeTicket(String ticket)
ticket
; neccessary for long-life tickets created with createTicket(false)
!ticket
- Ticket to destroy.createTicket(boolean)
Connection getRemoteConnection(RemoteProjectConfiguration config) throws IOException, de.espirit.firstspirit.server.authentication.AuthenticationException, MaximumNumberOfSessionsExceededException
RemoteProjectConfiguration
.
If already existing the cached remote connection will be returned, otherwise a new connection will be established with the given remote config params.config
- the remote configuration params to specifiy the connectionRemoteProjectConfiguration
.IOException
de.espirit.firstspirit.server.authentication.AuthenticationException
MaximumNumberOfSessionsExceededException
boolean isRemote()
RemoteProjectConfiguration
) or not.true
if this connection is a related to a remote project.ExceptionHandler getExceptionHandler()
IOErrorHandler
.IOErrorHandler
.void setExceptionHandler(ExceptionHandler handler)
IOErrorHandler
for this connections.handler
- new default handler.ServerConfiguration getServerConfiguration()
@NotNull ClassLoader getClassLoader()
Copyright © 2015 e-Spirit AG. All Rights Reserved. Build 5.1.408