Interface StorageAPI
- All Known Implementing Classes:
SQLDatabase
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFlag
(Character flagChar, Portal portal, StorageType portalType) Add a flag to a portal in the databasevoid
addFlagType
(char flagChar) Add a new flag typevoid
addPortalPosition
(RealPortal portal, StorageType portalType, PortalPosition portalPosition) Add a portalPosition to a portal in the databasevoid
addPortalPositionType
(String portalPositionTypeName) Add a new type of portalPositioncreateNetwork
(String networkName, NetworkType type, StorageType storageType) Creates a new network unassigned to a registrygetPortalMetaData
(Portal portal, StorageType portalType) Get misc data of a portalgetPortalPositionMetaData
(Portal portal, PortalPosition portalPosition, StorageType portalType) Get misc data of a portal positionvoid
loadFromStorage
(StargateAPI stargateAPI) Loads all portals from storage and adds them to the portal registryboolean
netWorkExists
(String netName, StorageType portalType) Check if the networks exists in the databasevoid
removeFlag
(Character flagChar, Portal portal, StorageType portalType) Remove a flag to a portal in the databasevoid
removePortalFromStorage
(Portal portal) Removes a portal and its associated data from storagevoid
removePortalPosition
(RealPortal portal, StorageType portalType, PortalPosition portalPosition) Remove a portalPosition to a portal in the databaseboolean
savePortalToStorage
(RealPortal portal) Saves the given portal to storagevoid
setPortalMetaData
(Portal portal, String data, StorageType portalType) Set misc data of a portalvoid
setPortalPositionMetaData
(RealPortal portal, PortalPosition portalPosition, String data, StorageType portalType) Set misc data of a portal positionvoid
"Starts" the inter-server connection by setting this server's portals as onlinevoid
updateNetworkName
(String newName, String networkName, StorageType portalType) Update the network name in the databasevoid
updatePortalName
(String newName, GlobalPortalId portalId, StorageType portalType) Update the name of a portal
-
Method Details
-
loadFromStorage
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
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
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
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
Network createNetwork(String networkName, NetworkType type, StorageType storageType) throws InvalidNameException, NameLengthException, UnimplementedFlagException 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
"Starts" the inter-server connection by setting this server's portals as online- Throws:
StorageWriteException
-If unable to write to storage
-
addFlagType
Add a new flag type- Parameters:
flagChar
-The character identifying the flag
- Throws:
StorageWriteException
-If unable to write the flag to storage
-
addPortalPositionType
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
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
- Returns:
The gate formats of the portals scheduled to be cleared
-