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.
|
SpecialistsBroker |
getBroker()
Returns broker without project binding.
|
ClassLoader |
getClassLoader()
Returns a class loader which can load classes from the server and from module libraries.
|
de.espirit.firstspirit.access.ExceptionHandler |
getExceptionHandler()
Returns current
ExceptionHandler . |
String |
getHost()
Get server host
|
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 and working. |
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(de.espirit.firstspirit.access.ExceptionHandler handler)
Sets the
ExceptionHandler for this connection. |
getService
void connect() throws IOException, AuthenticationException, MaximumNumberOfSessionsExceededException
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 and working. Returns false
if the
connection is not connected or is stalled and has IO problems.disconnect
.true
if this connection is connected and working.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
.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, 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
AuthenticationException
MaximumNumberOfSessionsExceededException
boolean isRemote()
RemoteProjectConfiguration
) or not.true
if this connection is a related to a remote project.de.espirit.firstspirit.access.ExceptionHandler getExceptionHandler()
ExceptionHandler
.ExceptionHandler
.void setExceptionHandler(de.espirit.firstspirit.access.ExceptionHandler handler)
ExceptionHandler
for this connection.handler
- new ExceptionHandler
.ServerConfiguration getServerConfiguration()
@NotNull ClassLoader getClassLoader()
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210