|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.atlas.core.ServerInfo
Encapsulates the functionality needed to map implicit names of mobile
objects to a corresponding Location Service Server
(LSServer
), which is responsible for storing their
current locations then.
The location service defines a plain infrastructure of different
LSServer
which can be described through the three properties
prefix mask, distinguished name and URL. Moreover a certificate for
each server is needed which supports encryption of Location Service
Protocol (LSP) messages. To initialize these server properties a
a LDAP server or a server configuration file is used.
The server on which the location of a certain mobile object will be registered depends on its implicit name in following manner:
LSServer
has to exist
for each possible prefix).
TreeMaps
.
TreeMaps
.
CertFinder
.
An examples of an server configuration file follows now:
### LS-Server configuration file # # SeMoA Shell variables are available within this # configuration file as ${An examples of an LDIF file for a LDAP server follows next. The entries have the same meaning as in the case of a configuration file.}. # # With PrefixBitLength you set the number of bits, # which are used to map implicit names to their corresponding LS-Server # # PrefixBitLength = 3, means that the first three bits of an # implicit name (from the left) are used # to map it to its corresponding LS-Server # # In this case you need to specify 2^3=8 LS-Server. PrefixBitLength = 1 # A new LS-Server is specified with following entries # # x.ServerPrefix = up to 20 bytes long (hex), seperated by spaces # x.ServerDN = the distinguished name of the server # x.ServerURL = the url of the server (the potocol must be "lsp") # 1.ServerPrefix = 00 1.ServerDN = CN=LSServer1,OU=SeMoA-NET,O=SeMoA,L=Darmstadt,ST=Hessen,C=DE 1.ServerURL = lsp://LSServer1.igd.fhg.de:50000 2.ServerPrefix = 80 2.ServerDN = CN=LSServer2,OU=SeMoA-NET,O=SeMoA,L=Darmstadt,ST=Hessen,C=DE 2.ServerURL = lsp://LSServer2.igd.fhg.de:50000
# Example of an ATLAS server configuration dn: cn=PrefixBitLength,ou=ATLAS,o=SeMoA,l=Darmstadt,st=Hessen,c=DE objectClass: prefixBitLength length: 1 dn: cn=Atlas-Server-1,ou=ATLAS,o=SeMoA,l=Darmstadt,st=Hessen,c=DE objectClass: atlasServer labeledURI: lsp://lsserver1.igd.fhg.de:50000 distinguishedName: CN=LSServer1,OU=SeMoA-NET,O=SeMoA,L=Darmstadt,ST=Hessen,C=DE description: Server1 serverPrefix: 00 dn: cn=Atlas-Server-2,ou=ATLAS,o=SeMoA,l=Darmstadt,st=Hessen,c=DE objectClass: atlasServer labeledURI: lsp://capricornus.igd.fhg.de:50000 distinguishedName: CN=LSServer2,OU=SeMoA-NET,O=SeMoA,L=Darmstadt,ST=Hessen,C=DE description: Server2 serverPrefix: 40
CertFinder
,
LSClientService
,
LSPRequest
Field Summary | |
static byte[] |
BIT_MASK
An array of bytes with following content, depending on the index (used to generate the serverPrefixBitMask_ ). |
static int |
DATA_ENCIPHERMENT
The key usage mask for data encipherment, which is used to find the right encryption key (see SERVER_KEY ). |
static int |
IMPLICIT_NAME_LENGTH
The length of the implicit name (depends on the result of the hash algorithm, which is used to generate it). |
static String |
LDAP_ATLAS_SERVER
The prefix of the RDNs of the entries where the configuration data for each ATLAS server is stored. |
static String |
LDAP_CONFIG_ROOT
The root of the ATLAS configuration entries in the LDAP server. |
static String |
LDAP_DN
The name of the attribute where the distinguished name of an ATLAS server is stored. |
static String |
LDAP_LENGTH
The name of the attribute where the prefix bit length is stored. |
static String |
LDAP_PREFIX_BIT_LENGTH
The RDN of the entry where the prefix bit length is stored. |
static String |
LDAP_SERVER_PREFIX
The name of the attribute where the prefix of an ATLAS server is stored. |
static String |
LDAP_URL
The name of the attribute where the URL of an ATLAS server is stored. |
protected Name |
localDN_
The distinguished name of a local server. |
private static Logger |
log_
The Logger instance for this class |
static String |
SERVER_CODE_SUFFIX
The common suffix of the server code properties in the server configuration file. |
static String |
SERVER_DN_SUFFIX
The common suffix of the server DN properties in the server configuration file. |
static String |
SERVER_KEY
The alias of the server key, which is used to encrypt LSP messages (see LSPRegisterEncrypted) |
static String |
SERVER_PREFIX_BIT_LENGTH
The name for the server prefix bit length property in the server configuration file. |
static String |
SERVER_URL_SUFFIX
The common suffix of the server URL properties in the server configuration file. |
protected SortedMap |
serverDN_
The sorted map of initialized server DNs (see SERVER_DN_SUFFIX ). |
protected int |
serverPrefixBitLength_
The length of the server prefix counted in bits (see SERVER_PREFIX_BIT_LENGTH ). |
protected byte[] |
serverPrefixBitMask_
The server prefix bit mask (see BIT_MASK ). |
protected SortedMap |
serverURL_
The sorted map of initialized server URLs (see SERVER_URL_SUFFIX ). |
Constructor Summary | |
ServerInfo()
Creates an instance of this class. |
Method Summary | |
LSServerService |
getLocalServer()
Tries to locate a local LSServerService interface |
X509Certificate |
getServerCert(byte[] implicitName)
Returns the server certificate of the LSServer
corresponding to the given implicitName . |
Principal |
getServerDN(byte[] implicitName)
Returns the server DN of the LSServer
corresponding to the given implicitName . |
byte[] |
getServerPrefix(byte[] implicitName)
Returns the server prefix of the LSServer
corresponding to the given implicitName . |
protected byte[] |
getServerPrefixBitMask(int length)
Generates the server prefix bit mask for the given server prefix bit length
(see SERVER_PREFIX_BIT_LENGTH
and BIT_MASK ). |
URL |
getServerURL(byte[] implicitName)
Returns the server URL of the LSServer
corresponding to the given implicitName . |
boolean |
isLocal(byte[] implicitName)
Checks if the LSServer corresponding to the
given implicitName is a local server. |
protected boolean |
loadServerMappings(String filename)
Parses the server configuration file of the given filename and replaces the current
server settings with the new ones, if the file
contains valid data and the constraints have been
fulfilled. |
protected boolean |
loadServerMappings(URL ldapurl)
Retrieves the server settings from the LDAP server with the given ldapurl and replaces the current
server settings with the new ones, if the file
contains valid data and the constraints have been
fulfilled. |
protected boolean |
setServerPrefixLength(int length)
Sets the server prefix bit length and
generates the serverPrefixBitMask_
(see SERVER_PREFIX_BIT_LENGTH
and BIT_MASK ). |
String |
toString()
Returns the string representation of this instance. |
String |
toStringServer()
Returns the string representation of all initialized LSServer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static Logger log_
Logger
instance for this class
public static final String LDAP_CONFIG_ROOT
public static final String LDAP_PREFIX_BIT_LENGTH
public static final String LDAP_LENGTH
public static final String LDAP_ATLAS_SERVER
public static final String LDAP_SERVER_PREFIX
public static final String LDAP_DN
public static final String LDAP_URL
public static final String SERVER_KEY
public static final int DATA_ENCIPHERMENT
SERVER_KEY
).
public static final byte[] BIT_MASK
serverPrefixBitMask_
).
BIT_MASK[i] = [ i times 1 | (8-i) times 0 ]
public static final int IMPLICIT_NAME_LENGTH
public static final String SERVER_PREFIX_BIT_LENGTH
Following constraint has to be fulfilled:
0 <= serverPrefixBitLength <= IMPLICIT_NAME_LENGTH
public static final String SERVER_CODE_SUFFIX
public static final String SERVER_DN_SUFFIX
public static final String SERVER_URL_SUFFIX
protected int serverPrefixBitLength_
SERVER_PREFIX_BIT_LENGTH
).
protected byte[] serverPrefixBitMask_
BIT_MASK
).
protected SortedMap serverURL_
SERVER_URL_SUFFIX
).
protected SortedMap serverDN_
SERVER_DN_SUFFIX
).
protected Name localDN_
Constructor Detail |
public ServerInfo()
serverURL_
)
and server DNs (serverDN_
),
loadServerMappings()
has to be called.
Method Detail |
protected boolean loadServerMappings(URL ldapurl)
ldapurl
and replaces the current
server settings with the new ones, if the file
contains valid data and the constraints have been
fulfilled.
ldapurl
- The URL of the LDAP server with the server
configuration data.
true
if server setting have been
initialized successfully; false
otherwise.protected boolean loadServerMappings(String filename)
filename
and replaces the current
server settings with the new ones, if the file
contains valid data and the constraints have been
fulfilled.
filename
- The name of the server configuration file.
true
if server setting have been
initialized successfully; false
otherwise.protected boolean setServerPrefixLength(int length)
length
and
generates the serverPrefixBitMask_
(see SERVER_PREFIX_BIT_LENGTH
and BIT_MASK
).
length
- The server prefix bit length.
true
if length
is valid;
false
otherwise.protected byte[] getServerPrefixBitMask(int length)
length
(see SERVER_PREFIX_BIT_LENGTH
and BIT_MASK
).
length
- The server prefix bit length.
null
if length
is not valid.public byte[] getServerPrefix(byte[] implicitName) throws IllegalArgumentException
LSServer
corresponding to the given implicitName
.
implicitName
- The implicit name.
IllegalArgumentException
- if the
implicitName
does not have the right length.public Principal getServerDN(byte[] implicitName)
LSServer
corresponding to the given implicitName
.
implicitName
- The implicit name.
null
if an error occured.public URL getServerURL(byte[] implicitName)
LSServer
corresponding to the given implicitName
.
implicitName
- The implicit name.
null
if an error occured.public X509Certificate getServerCert(byte[] implicitName)
LSServer
corresponding to the given implicitName
.
implicitName
- The implicit name.
null
if an error occured.public boolean isLocal(byte[] implicitName)
LSServer
corresponding to the
given implicitName
is a local server.
This is done by comparing the local DN with the server DN
(It is possible that the LSServer
runs within
another SeMoA-Platform: isLocal
returns true,
but getLocalServer
returns null
).
implicitName
- The implicit name.
true
if the LSServer
corresponding to implicitName
is a local server;
false
otherwise.public LSServerService getLocalServer()
LSServerService
interface
LSServerService
interface if found;
null
otherwise.public String toStringServer()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |