public class FedoraSessionImpl extends Object implements FedoraSession
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_TIMEOUT |
static String |
FCREPO_TX_ID
A key for looking up the transaction id in a session key-value pair
|
static String |
TIMEOUT_SYSTEM_PROPERTY |
Constructor and Description |
---|
FedoraSessionImpl(javax.jcr.Session session)
Create a Fedora session with a JCR session
|
Modifier and Type | Method and Description |
---|---|
void |
addSessionData(String key,
String value)
Add session data
|
void |
commit()
Commit any batch operations
|
void |
expire()
Expire the session
|
Instant |
getCreated()
Get the date this session was created
|
Optional<Instant> |
getExpires()
Get the date this session expires
|
String |
getId()
Get the session identifier
|
javax.jcr.Session |
getJcrSession()
Get the internal JCR session
|
static javax.jcr.Session |
getJcrSession(FedoraSession session)
Get the internal JCR session from an existing FedoraSession
|
Map<String,String> |
getNamespaces()
Get a mapping of registered namespaces
|
Collection<String> |
getSessionData(String key)
Retrieve the session data for a given key
|
String |
getUserId()
Get the user identifier associated with this session
|
static Duration |
operationTimeout()
Retrieve the default operation timeout value
|
void |
removeSessionData(String key)
Remove all session data for a particular key
|
void |
removeSessionData(String key,
String value)
Remove a particular session key-value pair
|
Instant |
updateExpiry(Duration amountToAdd)
Update the expiry by the provided amount
|
public static final String DEFAULT_TIMEOUT
public static final String TIMEOUT_SYSTEM_PROPERTY
public static final String FCREPO_TX_ID
public FedoraSessionImpl(javax.jcr.Session session)
session
- the JCR sessionpublic void commit()
FedoraSession
commit
in interface FedoraSession
public void expire()
FedoraSession
expire
in interface FedoraSession
public Instant updateExpiry(Duration amountToAdd)
FedoraSession
updateExpiry
in interface FedoraSession
amountToAdd
- the amount of time to addpublic Instant getCreated()
FedoraSession
getCreated
in interface FedoraSession
public Optional<Instant> getExpires()
FedoraSession
getExpires
in interface FedoraSession
public String getId()
FedoraSession
getId
in interface FedoraSession
public String getUserId()
FedoraSession
getUserId
in interface FedoraSession
public Map<String,String> getNamespaces()
FedoraSession
getNamespaces
in interface FedoraSession
public void addSessionData(String key, String value)
addSessionData
in interface FedoraSession
key
- the data keyvalue
- the data value
Note: while the FedoraSession interface permits multi-valued
session data, this implementation constrains that to be single-valued.
That is, calling obj.addSessionData("key", "value1") followed by
obj.addSessionData("key", "value2") will result in only "value2" being associated
with the given key.public Collection<String> getSessionData(String key)
FedoraSession
getSessionData
in interface FedoraSession
key
- the keypublic void removeSessionData(String key, String value)
FedoraSession
removeSessionData
in interface FedoraSession
key
- the data keyvalue
- the data valuepublic void removeSessionData(String key)
FedoraSession
removeSessionData
in interface FedoraSession
key
- the data keypublic javax.jcr.Session getJcrSession()
public static javax.jcr.Session getJcrSession(FedoraSession session)
session
- the FedoraSessionpublic static Duration operationTimeout()
Copyright © 2013–2018 DuraSpace, Inc.. All rights reserved.