de.fhg.igd.atlas.lsp
Class LSPEntry

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended bycodec.asn1.ASN1AbstractCollection
                  extended bycodec.asn1.ASN1Sequence
                      extended byde.fhg.igd.atlas.lsp.LSPEntry
All Implemented Interfaces:
ASN1Collection, ASN1Type, Cloneable, Collection, List, RandomAccess, Serializable

public class LSPEntry
extends ASN1Sequence

Represents a LSP_Entry structure of the Location Service Protocol (LSP). It contains all infomation stored in a Location Service Server (LSServer) used to locate the identified mobile object. There exists a mapping between this class and StorageDBEntry respectivley StorageDBImmutableEntry.

The ASN.1 structure of this entry is as follows

 LSP_Entry ::= SEQUENCE
 {
   implicitName     ImplicitName,
   contactaddress   ContactAddress,
   cookie           Cookie,
   timestamp        Timestamp
 }
 
 ImplicitName   ::= OCTET STRING
 ContactAddress ::= OCTET STRING
 Cookie         ::= OCTET STRING
 Timestamp      ::= INTEGER
 
The implicit name is the unique identifier of an mobile object for instance the hashcode of its static part. The contact address should consist of a URL string that specifies the protocol, address, and port of a management service provided by the server, which is in possession of the specified object. The cookie is used as authorisation mechanism by the LS-Server permitting a client to update or delete an entry. The timestamp represents the last modification time in milliseconds since January 1, 1970, 00:00:00 GMT.

Version:
"$Id: LSPEntry.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Peters
See Also:
LSServerService, StorageDBEntry, StorageDBImmutableEntry, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
protected  ASN1OctetString contactAddress_
          The contact address of this entry.
protected  ASN1OctetString cookie_
          The cookie of this entry.
protected  ASN1OctetString implicitName_
          The implicit name of this entry.
protected  ASN1Integer timestamp_
          The timestamp of this entry.
 
Fields inherited from class codec.asn1.ASN1AbstractCollection
 
Fields inherited from class java.util.ArrayList
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
LSPEntry()
          Creates an instance ready for decoding.
LSPEntry(byte[] implicitName, URL contactAddress, byte[] cookie, long timestamp)
          Creates an instance with the given parameters.
LSPEntry(StorageDBEntry entry)
          Creates an instance from the given entry.
LSPEntry(StorageDBImmutableEntry entry)
          Creates an instance from the given entry.
 
Method Summary
static LSPEntry createEntry(byte[] code)
          Creates a new entry from the given encoded entry.
 URL getContactAddress()
          Returns the contact address or an empty URL, if the encoded contact address is not well-formed.
 byte[] getCookie()
          Returns the cookie.
 byte[] getEncoded()
          Returns the DER encoded entry.
 byte[] getImplicitName()
          Returns the implicit name.
 long getTimestamp()
          Returns the timestamp in milliseconds since January 1, 1970, 00:00:00 GMT.
 String toString()
          Returns the string representation of this entry.
 
Methods inherited from class codec.asn1.ASN1Sequence
getTag
 
Methods inherited from class codec.asn1.ASN1AbstractCollection
checkConstraints, decode, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Field Detail

implicitName_

protected ASN1OctetString implicitName_
The implicit name of this entry.


contactAddress_

protected ASN1OctetString contactAddress_
The contact address of this entry.


cookie_

protected ASN1OctetString cookie_
The cookie of this entry.


timestamp_

protected ASN1Integer timestamp_
The timestamp of this entry.

Constructor Detail

LSPEntry

public LSPEntry()
Creates an instance ready for decoding.


LSPEntry

public LSPEntry(StorageDBEntry entry)
         throws NullPointerException
Creates an instance from the given entry.

Parameters:
entry - The entry.
Throws:
NullPointerException - if entry is null (RuntimeException).

LSPEntry

public LSPEntry(StorageDBImmutableEntry entry)
         throws NullPointerException
Creates an instance from the given entry.

Parameters:
entry - The entry.
Throws:
NullPointerException - if entry is null (RuntimeException).

LSPEntry

public LSPEntry(byte[] implicitName,
                URL contactAddress,
                byte[] cookie,
                long timestamp)
Creates an instance with the given parameters.

Parameters:
implicitName - The implicit name of the entry.
contactAddress - The contact address of the entry.
cookie - The cookie of the entry.
timestamp - The timestamp of the entry.
Method Detail

createEntry

public static LSPEntry createEntry(byte[] code)
                            throws CorruptedCodeException,
                                   IllegalStateException,
                                   NullPointerException
Creates a new entry from the given encoded entry.

Parameters:
code - The encoded entry.
Returns:
The decoded entry.
Throws:
CorruptedCodeException - if the code is bad.
IllegalStateException - if an error occurs while decoding with DERDecoder (RuntimeException).
NullPointerException - if code is null (RuntimeException).

getImplicitName

public byte[] getImplicitName()
Returns the implicit name.

Returns:
The implicit name.

getContactAddress

public URL getContactAddress()
Returns the contact address or an empty URL, if the encoded contact address is not well-formed.

Returns:
The contact address.

getCookie

public byte[] getCookie()
Returns the cookie.

Returns:
The cookie.

getTimestamp

public long getTimestamp()
Returns the timestamp in milliseconds since January 1, 1970, 00:00:00 GMT.

Returns:
The timestamp.

getEncoded

public byte[] getEncoded()
                  throws IllegalStateException
Returns the DER encoded entry.

Returns:
The encoded entry.
Throws:
IllegalStateException - if an exception occures during ASN1 encoding (RuntimeException).

toString

public String toString()
Returns the string representation of this entry. This is done in following manner
 ASN1StructureName {
 Property  : Value
 }
 

Returns:
The string representation.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.