Interface Connection

All Superinterfaces:
AutoCloseable, Closeable, ServicesBroker

public interface Connection extends Closeable, ServicesBroker
Connection to a FirstSpirit server.
Since:
2.3
  • Method Details

    • connect

      Connects 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
    • isConnected

      boolean isConnected()
      Returns true if this connection is connected and working. Returns false if the connection is not connected or is stalled and has IO problems.
      Important: Connection problems, detected during this call, can cause a disconnect.
      Returns:
      true if this connection is connected and working.
      Since:
      2.3
    • disconnect

      void disconnect() throws IOException
      Disconnects from the server and clears all services. This method can be called even if the connection is already disconnected.
      Throws:
      IOException
      Since:
      2.3
    • getHost

      String getHost()
      Get server host
      Returns:
      The hostname
      Since:
      3.0.4
    • getPort

      int getPort()
      Get server port
      Returns:
      The portnumber
      Since:
      3.0.4
    • getMode

      int getMode()
      Returns:
      ConnectionManager.HTTP_MODE or ConnectionManager.SOCKET_MODE
      Since:
      3.0.4
    • getServletZone

      @Nullable @Nullable String getServletZone()
      Get 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
    • getBroker

      @NotNull @NotNull SpecialistsBroker getBroker()
      Returns broker without project binding. Request the broker agent of given specialists broker to get hold of a broker with project relation.
      Since:
      5.0.207
    • getProjects

      Project[] 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.
      Use ProjectStorage.getProjects(boolean) to get projects unfiltered.
      Returns:
      the projects
      Since:
      2.3
    • getProjectByName

      @Nullable @Nullable Project getProjectByName(String name)
      Return a project with a specific name or null if no project exists with the specified name.
      Parameters:
      name - name of the project
      Returns:
      the project or null if no project exists with the specified name.
      Since:
      2.3.17
    • getProjectById

      @Nullable @Nullable 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.
      Parameters:
      id - id of the project
      Returns:
      the project or null if no project exists with the given id or the project is not visible for the current user.
      Since:
      4.0.17
    • getUser

      User getUser() throws InvalidSessionException
      Return the user of the current session
      Returns:
      the user
      Throws:
      InvalidSessionException
      Since:
      2.3.23
    • getService

      @NotNull @NotNull Object getService(String serviceName) throws ServiceNotFoundException
      Returns 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
    • createTicket

      String 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 use createTicket(false).
      Returns:
      a one-time FS SSO ticket for the user of this connection.
      Since:
      4.0.17
    • createTicket

      String createTicket(boolean oneTimeTicket)
      Creates 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 be invalidated manually!
      Parameters:
      oneTimeTicket - true for one-time-tickets,false for long-life-tickets.
      Returns:
      a FS SSO ticket for the user of this connection.
      Since:
      4.0.17
      See Also:
    • removeTicket

      void removeTicket(String ticket)
      Destroys the given ticket; neccessary for long-life tickets created with createTicket(false)!
      Parameters:
      ticket - Ticket to destroy.
      Since:
      4.0.17
      See Also:
    • getRemoteConnection

      Returns the remote connection specified by the given RemoteProjectConfiguration. 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
    • isRemote

      boolean isRemote()
      Indicates whether this connection is related to a remote project (based on a RemoteProjectConfiguration) or not.
      Returns:
      true if this connection is a related to a remote project.
      Since:
      4.0.17
    • getExceptionHandler

      de.espirit.firstspirit.access.ExceptionHandler getExceptionHandler()
      Returns current ExceptionHandler.
      Returns:
      current ExceptionHandler.
      Since:
      4.0.17
    • setExceptionHandler

      void setExceptionHandler(de.espirit.firstspirit.access.ExceptionHandler handler)
      Sets the ExceptionHandler for this connection.
      Parameters:
      handler - new ExceptionHandler.
      Since:
      4.0.17
    • getServerConfiguration

      ServerConfiguration getServerConfiguration()
      Returns server properties.
      Returns:
      server properties.
      Since:
      4.0.17
    • getClassLoader

      @NotNull @NotNull ClassLoader getClassLoader()
      Returns a class loader which can load classes from the server and from module libraries.
      Since:
      4.0.52