# Class CAServer

java.lang.Object
com.io7m.cardant.server.basic.internal.CAServer

All Implemented Interfaces:
  `CAServerType`, `AutoCloseable`

public final class CAServer extends Object implements CAServerType
The basic server frontend.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CAServer(CAServerConfiguration inConfiguration)`
  The basic server frontend.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `CAServerConfiguration`
  `configuration()`
  `CADatabaseType`
  `database()`
  `boolean`
  `isClosed()`
  `void`
  `setUserAsAdmin(CAUserID adminId, com.io7m.idstore.model.IdName adminName)`
  Do the work necessary to set up a server instance (such as initializing and/or upgrading the database) but do not actually start the instance.
  `void`
  `start()`
  Start the server instance.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.io7m.cardant.server.api.CAServerType

  `inventoryAPI`

- ## Constructor Details

  - ### CAServer

    public CAServer(CAServerConfiguration inConfiguration)
    The basic server frontend.
    Parameters:
      `inConfiguration` - The server configuration

- ## Method Details

  - ### start

    public void start() throws CAServerException
    Description copied from interface: `CAServerType`
    Start the server instance. Can be called multiple times redundantly, and can be called before or after #close() has been called.
    Specified by:
      `start` in interface `CAServerType`
    Throws:
      `CAServerException` - On errors

  - ### database

    public CADatabaseType database()
    Specified by:
      `database` in interface `CAServerType`
    Returns:
      The server's database instance

  - ### configuration

    public CAServerConfiguration configuration()
    Specified by:
      `configuration` in interface `CAServerType`
    Returns:
      The server's associated configuration

  - ### isClosed

    public boolean isClosed()
    Specified by:
      `isClosed` in interface `CAServerType`
    Returns:
      `true` if the server is closed
    See Also:
      - `CAServerType.start()`
      - `CAServerType.close()`

  - ### setUserAsAdmin

    public void setUserAsAdmin(CAUserID adminId, com.io7m.idstore.model.IdName adminName) throws CAServerException
    Description copied from interface: `CAServerType`

    Do the work necessary to set up a server instance (such as initializing and/or upgrading the database) but do not actually start the instance. A user with the given ID will be marked as the administrator and assigned all available security roles.

    The given name is simply informative; it will be replaced by the name in the identity server the first time the user logs in.

    Specified by:
      `setUserAsAdmin` in interface `CAServerType`
    Parameters:
      `adminId` - The admin ID
      `adminName` - The name
    Throws:
      `CAServerException` - On errors

  - ### close

    public void close() throws CAServerException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `CAServerType`
    Throws:
      `CAServerException`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`