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,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSAMP Standard Profile version for this toolkit implementation.static final StringKey for opaque text string required by the hub for registration.static final StringKey for the SAMP Standard Profile version implemented by the hub.static final StringKey for XML-RPC endpoint for communication with the hub. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LockInfoasLockInfo(Map map) Returns a given map as a LockInfo object.voidcheck()Checks that this object is ready for use with the SAMP toolkit.Returns the value of theSECRET_KEYkey.Returns the value of theVERSION_KEYkey.Returns the value of theXMLRPCURL_KEYkey.static LockInfoReturns the LockInfo read from a given stream.static LockInforeadLockFile(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, putMethods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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_KEYkeyxmlrpcurl- value forXMLRPCURL_KEYkey
-
-
Method Details
-
getXmlrpcUrl
Returns the value of theXMLRPCURL_KEYkey.- Returns:
- hub XML-RPC connection URL
-
getVersion
Returns the value of theVERSION_KEYkey.- Returns:
- version of the SAMP standard profile implemented
-
getSecret
Returns the value of theSECRET_KEYkey.- Returns:
- password for hub connection
-
check
public void check()Description copied from class:SampMapChecks 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 informativeDataExceptionwill 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
-