public class LockInfo extends SampMap
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
ASSIGNMENT_REGEX |
private static java.util.regex.Pattern |
COMMENT_REGEX |
static java.lang.String |
DEFAULT_VERSION_VALUE
SAMP Standard Profile version for this toolkit implementation.
|
private static java.lang.String[] |
KNOWN_KEYS |
private static java.util.logging.Logger |
logger_ |
static java.lang.String |
SECRET_KEY
Key for opaque text string required by the hub for registration.
|
private static java.util.regex.Pattern |
TOKEN_REGEX |
static java.lang.String |
VERSION_KEY
Key for the SAMP Standard Profile version implemented by the hub.
|
static java.lang.String |
XMLRPCURL_KEY
Key for XML-RPC endpoint for communication with the hub.
|
Constructor and Description |
---|
LockInfo()
Constructs an empty LockInfo.
|
LockInfo(java.util.Map map)
Constructs a LockInfo based on an existing map.
|
LockInfo(java.lang.String secret,
java.lang.String xmlrpcurl)
Constructs a LockInfo from a given SAMP secret and XML-RPC URL.
|
Modifier and Type | Method and Description |
---|---|
static LockInfo |
asLockInfo(java.util.Map map)
Returns a given map as a LockInfo object.
|
void |
check()
Checks that this object is ready for use with the SAMP toolkit.
|
java.lang.String |
getSecret()
Returns the value of the
SECRET_KEY key. |
java.lang.String |
getVersion()
Returns the value of the
VERSION_KEY key. |
java.net.URL |
getXmlrpcUrl()
Returns the value of the
XMLRPCURL_KEY key. |
private static java.lang.String |
readLine(java.io.InputStream in)
Returns a line from a lockfile-type input stream.
|
static LockInfo |
readLockFile(java.io.InputStream in)
Returns the LockInfo read from a given stream.
|
static LockInfo |
readLockFile(java.net.URL url)
Returns a LockInfo as read from a lockfile at a given location.
|
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
private static final java.util.logging.Logger logger_
public static final java.lang.String SECRET_KEY
public static final java.lang.String XMLRPCURL_KEY
public static final java.lang.String VERSION_KEY
private static final java.lang.String[] KNOWN_KEYS
public static final java.lang.String DEFAULT_VERSION_VALUE
private static final java.util.regex.Pattern TOKEN_REGEX
private static final java.util.regex.Pattern ASSIGNMENT_REGEX
private static final java.util.regex.Pattern COMMENT_REGEX
public LockInfo()
public LockInfo(java.util.Map map)
map
- map containing initial data for this objectpublic LockInfo(java.lang.String secret, java.lang.String xmlrpcurl)
secret
- value for SECRET_KEY
keyxmlrpcurl
- value for XMLRPCURL_KEY
keypublic java.net.URL getXmlrpcUrl()
XMLRPCURL_KEY
key.public java.lang.String getVersion()
VERSION_KEY
key.public java.lang.String getSecret()
SECRET_KEY
key.public void check()
SampMap
SampUtils.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 informative DataException
will be thrown.public static LockInfo readLockFile(java.net.URL url) throws java.io.IOException
url
- lockfile locationjava.io.IOException
public static LockInfo readLockFile(java.io.InputStream in) throws java.io.IOException
in
- input stream to readjava.io.IOException
public static LockInfo asLockInfo(java.util.Map map)
map
- mapprivate static java.lang.String readLine(java.io.InputStream in) throws java.io.IOException
in
- input streamjava.io.IOException