|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.appserv.management.client.prefs.MemoryHashLoginInfoStore
public class MemoryHashLoginInfoStore
A LoginInfoStore
that reads the information from the default file ".asadminpass"
and stores it as a map in the memory. It is not guaranteed that the concurrent
modifications will yield consistent results. This class is not thread safe. The
serial access has to be ensured by the callers.
Field Summary | |
---|---|
static String |
DEFAULT_STORE_NAME
|
Constructor Summary | |
---|---|
MemoryHashLoginInfoStore()
Creates a new instance of MemoryHashLoginInfoStore. |
Method Summary | |
---|---|
boolean |
exists(String host,
int port)
Checks whether a LoginInfo for given host and port exists in this store. |
String |
getName()
Returns the name of the store. |
Collection<LoginInfo> |
list()
A convenience method that returns the Collection of LoginInfo instances stored in this store. |
LoginInfo |
read(String host,
int port)
Returns a LoginInfo corresponding to the given host and port, from this store. |
void |
remove(String host,
int port)
Removes the LoginInfo corresponding to the given host and port, from this store. |
int |
size()
A convenience method that returns the number of LoginInfo instances stored in this store. |
void |
store(LoginInfo login)
Stores the given LoginInfo in this store. |
void |
store(LoginInfo login,
boolean overwrite)
Stores the given LoginInfo in this store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_STORE_NAME
Constructor Detail |
---|
public MemoryHashLoginInfoStore() throws StoreException
StoreException
Method Detail |
---|
public void store(LoginInfo login) throws StoreException
LoginInfoStore
store
in interface LoginInfoStore
login
- a LoginInfo that needs to be stored
StoreException
- if there's any problem or if there is already a LoginInfo
with given host and portpublic void store(LoginInfo login, boolean overwrite) throws StoreException
LoginInfoStore
store
in interface LoginInfoStore
login
- a LoginInfo that needs to be stored
StoreException
- if there's any problem in storing or if overwrite is false and
the LoginInfo with given host and port already existspublic void remove(String host, int port)
LoginInfoStore
LoginInfo
corresponding to the given host and port, from this store.
The host may not be null. If no such LoginInfo exists, StoreException results.
The caller thus must ensure if such a LoginInfo exists before calling this method.
Upon successful return, size of this store decreases by one.
remove
in interface LoginInfoStore
host
- a non null String representing host nameport
- an integer specifying the port numberpublic LoginInfo read(String host, int port)
LoginInfoStore
LoginInfo
corresponding to the given host and port, from this store.
The host may not be null. For a given host and port, there can be at most
one LoginInfo in this store.
read
in interface LoginInfoStore
host
- a non null String representing host nameport
- an integer specifying the port number
public boolean exists(String host, int port)
LoginInfoStore
exists
in interface LoginInfoStore
host
- a non null String representing host nameport
- an integer specifying the port numberpublic int size()
LoginInfoStore
size
in interface LoginInfoStore
public Collection<LoginInfo> list()
LoginInfoStore
list
in interface LoginInfoStore
public String getName()
LoginInfoStore
getName
in interface LoginInfoStore
|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2006 Sun Microsystems, Inc. All rights reserved.