Interface StorageAPI

All Known Implementing Classes:
SQLDatabase

public interface StorageAPI
A generic API for Stargate's storage methods
  • Method Details

    • loadFromStorage

      void loadFromStorage(StargateAPI stargateAPI) throws StorageReadException
      Loads all portals from storage and adds them to the portal registry
      Parameters:
      stargateAPI -

      The stargate API

      Throws:
      StorageReadException -

      If unable to read from storage

    • savePortalToStorage

      boolean savePortalToStorage(RealPortal portal) throws StorageWriteException
      Saves the given portal to storage
      Parameters:
      portal -

      The portal to save

      Returns:

      Whether or not the portal was successfully saved

      Throws:
      StorageWriteException -

      If unable to write to storage

    • removePortalFromStorage

      void removePortalFromStorage(Portal portal) throws StorageWriteException
      Removes a portal and its associated data from storage
      Parameters:
      portal -

      The portal to remove

      Throws:
      StorageWriteException -

      If unable to write to storage

    • setPortalMetaData

      void setPortalMetaData(Portal portal, String data, StorageType portalType) throws StorageWriteException
      Set misc data of a portal
      Parameters:
      portal -

      A portal

      data -

      Any data

      portalType -

      The portal's expected type

      Throws:
      StorageWriteException -

      If unable to successfully set the new portal data

    • getPortalMetaData

      String getPortalMetaData(Portal portal, StorageType portalType) throws StorageReadException
      Get misc data of a portal
      Parameters:
      portal -

      A portal

      portalType -

      The portal's expected type

      Returns:

      Data

      Throws:
      StorageReadException -

      If unable to successfully get the portal data

    • setPortalPositionMetaData

      void setPortalPositionMetaData(RealPortal portal, PortalPosition portalPosition, String data, StorageType portalType) throws StorageWriteException
      Set misc data of a portal position
      Parameters:
      portal -

      A portal

      portalPosition -

      A portalPosition

      data -

      Any data

      portalType -

      The type of portal to set the data for

      Throws:
      StorageWriteException -

      If unable to set the metadata for the portal

    • getPortalPositionMetaData

      String getPortalPositionMetaData(Portal portal, PortalPosition portalPosition, StorageType portalType) throws StorageReadException
      Get misc data of a portal position
      Parameters:
      portal -

      A portal

      portalPosition -

      A portalPosition

      portalType -

      The portal's expected type

      Returns:

      Data

      Throws:
      StorageReadException -

      If unable to successfully read the portal metadata

    • createNetwork

      Creates a new network unassigned to a registry
      Parameters:
      networkName -

      The name of the new network

      type -

      The type of network to look for.

      storageType -

      Whether or not the network works across servers (I flag)

      Returns:
      The network that was created
      Throws:
      InvalidNameException -

      If the given network name is invalid

      NameLengthException -

      If a name is too long or short

      UnimplementedFlagException -

      If a selected flag is unimplemented

    • startInterServerConnection

      void startInterServerConnection() throws StorageWriteException
      "Starts" the inter-server connection by setting this server's portals as online
      Throws:
      StorageWriteException -

      If unable to write to storage

    • addFlagType

      void addFlagType(char flagChar) throws StorageWriteException
      Add a new flag type
      Parameters:
      flagChar -

      The character identifying the flag

      Throws:
      StorageWriteException -

      If unable to write the flag to storage

    • addPortalPositionType

      void addPortalPositionType(String portalPositionTypeName) throws StorageWriteException
      Add a new type of portalPosition
      Parameters:
      portalPositionTypeName -

      The name of the portal type to add

      Throws:
      StorageWriteException -

      If unable to write the portal position type to storage

    • addFlag

      void addFlag(Character flagChar, Portal portal, StorageType portalType) throws StorageWriteException
      Add a flag to a portal in the database
      Parameters:
      flagChar -

      The character representation of that flag

      portal -

      A portal

      portalType -

      How the portal should be considered by the database

      Throws:
      StorageWriteException -

      If unable to write the flag change to storage

    • removeFlag

      void removeFlag(Character flagChar, Portal portal, StorageType portalType) throws StorageWriteException
      Remove a flag to a portal in the database
      Parameters:
      flagChar -

      The character representation of that flag

      portal -

      A portal

      portalType -

      How the portal should be considered by the database

      Throws:
      StorageWriteException -

      Uf unable to write the flag change to storage

    • addPortalPosition

      void addPortalPosition(RealPortal portal, StorageType portalType, PortalPosition portalPosition) throws StorageWriteException
      Add a portalPosition to a portal in the database
      Parameters:
      portal -

      A portal

      portalType -

      How the portal should be considered by the database

      portalPosition -

      A portal position

      Throws:
      StorageWriteException -

      If unable to write the new portal position to storage

    • removePortalPosition

      void removePortalPosition(RealPortal portal, StorageType portalType, PortalPosition portalPosition) throws StorageWriteException
      Remove a portalPosition to a portal in the database
      Parameters:
      portal -

      A portal

      portalType -

      How the portal should be considered by the database

      portalPosition -

      A portal position

      Throws:
      StorageWriteException -

      If unable to write the portal position change to storage

    • updateNetworkName

      @Internal void updateNetworkName(String newName, String networkName, StorageType portalType) throws StorageWriteException
      Update the network name in the database
      Parameters:
      newName -

      The new name of the network

      networkName -

      The previous name of the network

      portalType -

      The storage type of the network

      Throws:
      StorageWriteException -

      If unable to modify the database

    • updatePortalName

      @Internal void updatePortalName(String newName, GlobalPortalId portalId, StorageType portalType) throws StorageWriteException
      Update the name of a portal
      Parameters:
      newName -

      The name of the portal

      portalId -

      A portal id representing this portal

      portalType -

      How the portal is stored

      Throws:
      StorageWriteException -

      If unable to modify the database

    • netWorkExists

      boolean netWorkExists(String netName, StorageType portalType) throws StorageReadException
      Check if the networks exists in the database
      Parameters:
      netName -

      Network name

      portalType -

      The storage type of the network

      Returns:

      True if exists

      Throws:
      StorageReadException -

      If unable to read the database

    • getScheduledGatesClearing

      Set<String> getScheduledGatesClearing()
      Returns:

      The gate formats of the portals scheduled to be cleared