Interface LoginInfoStore
-
- All Known Implementing Classes:
MemoryHashLoginInfoStore
public interface LoginInfoStore
An interface that represents the database of LoginInfo objects. Provides methods to access and mutate the store. The general contract of store update comprises of the following:- The store can contain at the most one LoginInfo for a host and port combination
- There is no guarantee that concurrent modification of this store by two different programs will always be consistent.
- Since:
- Appserver 9.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 aLoginInfo
corresponding to the given host and port, from this store.void
remove(String host, int port)
Removes theLoginInfo
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.
-
-
-
Method Detail
-
read
LoginInfo read(String host, int port) throws StoreException
Returns aLoginInfo
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.- Parameters:
host
- a non null String representing host nameport
- an integer specifying the port number- Returns:
- the corresponding LoginInfo, null if there is none
- Throws:
StoreException
- if there is something wrong with reading the storeIllegalArgumentException
- if the parameter host is null
-
remove
void remove(String host, int port) throws StoreException
Removes theLoginInfo
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.- Parameters:
host
- a non null String representing host nameport
- an integer specifying the port number- Throws:
StoreException
- if there is something wrong with reading the store or if there is no such LoginInfoIllegalArgumentException
- if the parameter host is null
-
store
void store(LoginInfo login) throws StoreException
Stores the given LoginInfo in this store. Given LoginInfo may not be null. Upon successful return, the size of this store increases by one. An exception is thrown if there is already a LoginInfo with given host and port.- Parameters:
login
- a LoginInfo that needs to be stored- Throws:
StoreException
- if there's any problem or if there is already a LoginInfo with given host and portIllegalArgumentException
- if the given LoginInfo is null
-
store
void store(LoginInfo login, boolean overwrite) throws StoreException
Stores the given LoginInfo in this store. Given LoginInfo may not be null. Upon successful return, the size of this store increases by one. An exception is thrown if there is already a LoginInfo with given host and port and overwrite is false. If overwrite is true, the given LoginInfo is stored regardless of whether it already exists in this store. Depending upon the value of overwrite, the store is either unchanged or not.- Parameters:
login
- a LoginInfo that needs to be stored- Throws:
StoreException
- if there's any problem in storing or if overwrite is false and the LoginInfo with given host and port already existsIllegalArgumentException
- if the given LoginInfo is null
-
exists
boolean exists(String host, int port) throws StoreException
Checks whether a LoginInfo for given host and port exists in this store.- Parameters:
host
- a non null String representing host nameport
- an integer specifying the port number- Throws:
StoreException
- if there's any problem reading the store
-
list
Collection<LoginInfo> list() throws StoreException
A convenience method that returns the Collection of LoginInfo instances stored in this store. An empty Collection is returned when there are no LoginInfo items stored.- Returns:
- the Collection of LoginInfo instances
- Throws:
StoreException
- if there's any problem reading the store
-
size
int size() throws StoreException
A convenience method that returns the number of LoginInfo instances stored in this store. Zero is returned when no login information is stored.- Returns:
- an integer representing number of stored login information elements, 0 if none
- Throws:
StoreException
- if there's any problem reading the store
-
getName
String getName()
Returns the name of the store. This is any name that the store implementation wants to use for identification, for instance.
-
-