Package de.espirit.firstspirit.access
Interface Connection
- All Superinterfaces:
- AutoCloseable,- Closeable,- ServicesBroker
Connection to a FirstSpirit server.
- Since:
- 2.3
- 
Field SummaryFields inherited from interface de.espirit.firstspirit.access.ServicesBrokerTYPE
- 
Method SummaryModifier and TypeMethodDescriptionvoidconnect()Connects the server.Creates a one-time FS SSO ticket for the user of this connection.createTicket(boolean oneTimeTicket) Creates a FS SSO ticket for the user of this connection.voidDisconnects from the server and clears all services.@NotNull SpecialistsBrokerReturns broker without project binding.@NotNull ClassLoaderReturns a class loader which can load classes from the server and from module libraries.de.espirit.firstspirit.access.ExceptionHandlerReturns currentExceptionHandler.getHost()Get server hostintgetMode()Get the connection mode, eitherConnectionManager.HTTP_MODEorConnectionManager.SOCKET_MODE.intgetPort()Get server port@Nullable ProjectgetProjectById(long id) Return a project with a specific id ornullif no project exists with the given id or the project is not visible for the current user.@Nullable ProjectgetProjectByName(String name) Return a project with a specific name ornullif no project exists with the specified name.Project[]Get all active projects allowed for the current user.
 Checks if the current user is server admin and is allowed to edit a project using java client or webedit.
 UseProjectStorage.getProjects(boolean)to get projects unfiltered.Returns the remote connection specified by the givenRemoteProjectConfiguration.Returns server properties.@NotNull ObjectgetService(String serviceName) Returns a service instance for the given name.@Nullable StringGet servlet zone, used in HTTP mode only for constructing the connection URL.getUser()Return the user of the current sessionbooleanReturnstrueif this connection is connected and working.booleanisRemote()Indicates whether this connection is related to a remote project (based on aRemoteProjectConfiguration) or not.voidremoveTicket(String ticket) Destroys the giventicket; neccessary for long-life tickets created withcreateTicket(false)!voidsetExceptionHandler(de.espirit.firstspirit.access.ExceptionHandler handler) Sets theExceptionHandlerfor this connection.Methods inherited from interface de.espirit.firstspirit.access.ServicesBrokergetService
- 
Method Details- 
connectvoid connect() throws IOException, AuthenticationException, MaximumNumberOfSessionsExceededExceptionConnects the server.- Throws:
- AuthenticationException- if the authentication of the belonging user failed
- MaximumNumberOfSessionsExceededException- if the maximum number of allowed sessions (license value) exceeded
- IOException
- Since:
- 2.3
 
- 
isConnectedboolean isConnected()Returnstrueif this connection is connected and working. Returnsfalseif the connection is not connected or is stalled and has IO problems.
 Important: Connection problems, detected during this call, can cause adisconnect.- Returns:
- trueif this connection is connected and working.
- Since:
- 2.3
 
- 
disconnectDisconnects from the server and clears all services. This method can be called even if the connection is already disconnected.- Throws:
- IOException
- Since:
- 2.3
 
- 
getHostString getHost()Get server host- Returns:
- The hostname
- Since:
- 3.0.4
 
- 
getPortint getPort()Get server port- Returns:
- The portnumber
- Since:
- 3.0.4
 
- 
getModeint getMode()Get the connection mode, eitherConnectionManager.HTTP_MODEorConnectionManager.SOCKET_MODE.- Returns:
- ConnectionManager.HTTP_MODEor- ConnectionManager.SOCKET_MODE
- Since:
- 3.0.4
 
- 
getServletZoneGet servlet zone, used in HTTP mode only for constructing the connection URL. URL schema: http://host:port/servletZone/do.ClientIOServlet- Returns:
- The servlet zone
- Since:
- 4.0.95
 
- 
getBrokerReturns broker without project binding. Request thebroker agentof given specialists broker toget hold of a broker with project relation.- Since:
- 5.0.207
 
- 
getProjectsProject[] getProjects()Get all active projects allowed for the current user.
 Checks if the current user is server admin and is allowed to edit a project using java client or webedit.
 UseProjectStorage.getProjects(boolean)to get projects unfiltered.- Returns:
- the projects
- Since:
- 2.3
 
- 
getProjectByNameReturn a project with a specific name ornullif no project exists with the specified name.- Parameters:
- name- name of the project
- Returns:
- the project or nullif no project exists with the specified name.
- Since:
- 2.3.17
 
- 
getProjectByIdReturn a project with a specific id ornullif no project exists with the given id or the project is not visible for the current user.- Parameters:
- id- id of the project
- Returns:
- the project or nullif no project exists with the given id or the project is not visible for the current user.
- Since:
- 4.0.17
 
- 
getUserReturn the user of the current session- Returns:
- the user
- Throws:
- InvalidSessionException
- Since:
- 2.3.23
 
- 
getServiceReturns a service instance for the given name.- Parameters:
- serviceName- The name of the service to look up.
- Returns:
- A service instance.
- Throws:
- ServiceNotFoundException- If no appropriate service was found.
- Since:
- 3.0.133
 
- 
createTicketString createTicket()Creates a one-time FS SSO ticket for the user of this connection. This kind of ticket can be used only once and will expire after a short amount of time. For long-life tickets usecreateTicket(false).- Returns:
- a one-time FS SSO ticket for the user of this connection.
- Since:
- 4.0.17
 
- 
createTicketCreates a FS SSO ticket for the user of this connection. One-time-tickets can be used only once and will expire after a short amount of time. Long-life-tickets are free of such restrictions but must beinvalidatedmanually!- Parameters:
- oneTimeTicket-- truefor one-time-tickets,- falsefor long-life-tickets.
- Returns:
- a FS SSO ticket for the user of this connection.
- Since:
- 4.0.17
- See Also:
 
- 
removeTicketDestroys the giventicket; neccessary for long-life tickets created withcreateTicket(false)!- Parameters:
- ticket- Ticket to destroy.
- Since:
- 4.0.17
- See Also:
 
- 
getRemoteConnectionConnection getRemoteConnection(RemoteProjectConfiguration config) throws IOException, AuthenticationException, MaximumNumberOfSessionsExceededException Returns the remote connection specified by the givenRemoteProjectConfiguration. If already existing the cached remote connection will be returned, otherwise a new connection will be established with the given remote config params.- Parameters:
- config- the remote configuration params to specifiy the connection
- Returns:
- the remote connection specified by the given RemoteProjectConfiguration.
- Throws:
- IOException
- AuthenticationException
- MaximumNumberOfSessionsExceededException
- Since:
- 4.0.17
 
- 
isRemoteboolean isRemote()Indicates whether this connection is related to a remote project (based on aRemoteProjectConfiguration) or not.- Returns:
- trueif this connection is a related to a remote project.
- Since:
- 4.0.17
 
- 
getExceptionHandlerde.espirit.firstspirit.access.ExceptionHandler getExceptionHandler()Returns currentExceptionHandler.- Returns:
- current ExceptionHandler.
- Since:
- 4.0.17
 
- 
setExceptionHandlervoid setExceptionHandler(de.espirit.firstspirit.access.ExceptionHandler handler) Sets theExceptionHandlerfor this connection.- Parameters:
- handler- new- ExceptionHandler.
- Since:
- 4.0.17
 
- 
getServerConfigurationServerConfiguration getServerConfiguration()Returns server properties.- Returns:
- server properties.
- Since:
- 4.0.17
 
- 
getClassLoaderReturns a class loader which can load classes from the server and from module libraries.- Since:
- 4.0.52
 
 
-