U
- typ objektu uživatelepublic class Session<U> extends java.rmi.server.UnicastRemoteObject implements ExpiringMap.Permanent
Modifier and Type | Field and Description |
---|---|
static SessionProvider<cz.gyarab.util.rmi.server.LocalSession> |
SIMPLE_PROVIDER
Jednoduchá továrna poskytovatele vytvoří instanci
LocalSession.LocalSession(int, java.lang.String, java.lang.String, java.lang.String) . |
Constructor and Description |
---|
Session(int port,
java.lang.String hostName,
java.lang.String userName,
java.lang.String userPassword,
SessionKey key,
U user,
SessionManager<U> manager)
Vytvoří objekt relace.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Odpojí relaci od serveru.
|
<I> RemoteObject<I> |
get(java.lang.Class<I> iface,
java.io.Serializable key)
Vytvoří nebo získá přístup k dříve vytvořenému vzdálenému objektu
zadaného rozhraní.
|
SessionKey |
getKey()
Vrátí klíč identifikace relace.
|
java.util.Date |
getLastUsed()
Vrací časové razítko poslední aktivity relace.
|
java.lang.String |
getRemoteHost()
Vrací název místního počítače.
|
static java.lang.String |
getRemoteHost(RemoteSession session)
Získá název počítače z relace.
|
U |
getUser()
Vrátí objekt uživatele.
|
static <U> U |
getUser(RemoteSession session)
Vrátí objekt uživatele spojeného s relací.
|
java.lang.String |
getUserName()
Vrací jméno uživatele.
|
static java.lang.String |
getUserName(RemoteSession session)
Získá jméno uživatele z relace.
|
java.util.Date |
heartbeat()
Ověří dostupnost relace.
|
protected void |
checkState()
Ověří stav relace.
|
boolean |
isPermanent()
Pokud potřebuje hodnota blokovat vlastní expiraci, musí vrítit
true . |
protected void |
register()
Zaregistruje relaci.
|
void |
unreferenced() |
protected void |
unregister()
Odregistruje relaci.
|
clone, exportObject, exportObject, exportObject, unexportObject
public static final SessionProvider<cz.gyarab.util.rmi.server.LocalSession> SIMPLE_PROVIDER
LocalSession.LocalSession(int, java.lang.String, java.lang.String, java.lang.String)
.public Session(int port, java.lang.String hostName, java.lang.String userName, java.lang.String userPassword, SessionKey key, U user, SessionManager<U> manager) throws java.rmi.RemoteException
port
- číslo portu serveruhostName
- jméno (DNS, hostname, IP adresa apod.) serveruuserName
- uživatelské jménouserPassword
- přístupové heslokey
- klíč identifikace relaceuser
- objekt uživatelemanager
- správce relacíjava.rmi.RemoteException
public static <U> U getUser(RemoteSession session)
U
- typ objektu uživatelesession
- relacepublic SessionKey getKey()
public U getUser()
public <I> RemoteObject<I> get(java.lang.Class<I> iface, java.io.Serializable key) throws java.rmi.RemoteException, java.lang.InstantiationException
RemoteSession
ObjectRegistry.Scope
a v kombinaci s
klíčováním ObjectRegistry.Keying
může
dosáhnout libovolného modelu.get
in interface RemoteSession
I
- požadované rozhraníiface
- požadovné rozhraníkey
- klíč do mapy vzdálených objektů, je-li zpotřebí a server ho
podporuje/vyžadujejava.rmi.RemoteException
- při I/O problémujava.lang.InstantiationException
- nelze-li objekt vytvořitprotected void unregister() throws java.rmi.NoSuchObjectException
java.rmi.NoSuchObjectException
protected void register() throws java.rmi.RemoteException
java.rmi.RemoteException
public boolean isPermanent()
ExpiringMap.Permanent
true
.isPermanent
in interface ExpiringMap.Permanent
public static java.lang.String getRemoteHost(RemoteSession session)
session
- relace""
public static java.lang.String getUserName(RemoteSession session)
session
- relace""
public java.lang.String getRemoteHost()
public java.lang.String getUserName()
public java.util.Date getLastUsed()
public void disconnect() throws java.rmi.RemoteException
RemoteSession
disconnect
in interface RemoteSession
java.rmi.RemoteException
- při I/O problémupublic java.util.Date heartbeat() throws java.rmi.RemoteException
RemoteSession
heartbeat
in interface RemoteSession
java.rmi.RemoteException
- při I/O problémupublic void unreferenced()
unreferenced
in interface java.rmi.server.Unreferenced
protected void checkState() throws java.rmi.RemoteException
java.rmi.RemoteException
- pokud došlo k narušení konzistence relace nebo
pokud se server stal nedostupným