Package org.astrogrid.samp.xmlrpc
Class LockInfo
java.lang.Object
java.util.AbstractMap
org.astrogrid.samp.SampMap
org.astrogrid.samp.xmlrpc.LockInfo
- All Implemented Interfaces:
Map
Represents the information read from a SAMP Standard Profile Lockfile.
This contains a key-value entry for each assignment read from the file.
Any non-assignment lines are not represented by this object.
- Since:
- 14 Jul 2008
- Author:
- Mark Taylor
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
SAMP Standard Profile version for this toolkit implementation.static final String
Key for opaque text string required by the hub for registration.static final String
Key for the SAMP Standard Profile version implemented by the hub.static final String
Key for XML-RPC endpoint for communication with the hub. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LockInfo
asLockInfo
(Map map) Returns a given map as a LockInfo object.void
check()
Checks that this object is ready for use with the SAMP toolkit.Returns the value of theSECRET_KEY
key.Returns the value of theVERSION_KEY
key.Returns the value of theXMLRPCURL_KEY
key.static LockInfo
Returns the LockInfo read from a given stream.static LockInfo
readLockFile
(URL url) Returns a LockInfo as read from a lockfile at a given location.Methods inherited from class org.astrogrid.samp.SampMap
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
SECRET_KEY
Key for opaque text string required by the hub for registration.- See Also:
-
XMLRPCURL_KEY
Key for XML-RPC endpoint for communication with the hub.- See Also:
-
VERSION_KEY
Key for the SAMP Standard Profile version implemented by the hub.- See Also:
-
DEFAULT_VERSION_VALUE
SAMP Standard Profile version for this toolkit implementation.- See Also:
-
-
Constructor Details
-
LockInfo
public LockInfo()Constructs an empty LockInfo. -
LockInfo
Constructs a LockInfo based on an existing map.- Parameters:
map
- map containing initial data for this object
-
LockInfo
Constructs a LockInfo from a given SAMP secret and XML-RPC URL. The version string is set to the default for this toolkit.- Parameters:
secret
- value forSECRET_KEY
keyxmlrpcurl
- value forXMLRPCURL_KEY
key
-
-
Method Details
-
getXmlrpcUrl
Returns the value of theXMLRPCURL_KEY
key.- Returns:
- hub XML-RPC connection URL
-
getVersion
Returns the value of theVERSION_KEY
key.- Returns:
- version of the SAMP standard profile implemented
-
getSecret
Returns the value of theSECRET_KEY
key.- Returns:
- password for hub connection
-
check
public void check()Description copied from class:SampMap
Checks that this object is ready for use with the SAMP toolkit. As well as callingSampUtils.checkMap(java.util.Map)
(ensuring that all keys are Strings, and all values Strings, Lists or Maps), subclass-specific invariants may be checked. In the case that there's something wrong, an informativeDataException
will be thrown. -
readLockFile
Returns a LockInfo as read from a lockfile at a given location. If the lockfile does not exist, null is returned. An exception may be thrown if it exists but is cannot be read.- Parameters:
url
- lockfile location- Returns:
- lockfile contents, or null if it is absent
- Throws:
IOException
-
readLockFile
Returns the LockInfo read from a given stream. The stream is closed if the read is successful.- Parameters:
in
- input stream to read- Returns:
- lockfile information
- Throws:
IOException
-
asLockInfo
Returns a given map as a LockInfo object.- Parameters:
map
- map- Returns:
- lock info
-