Package org.exoplatform.bluemind.client
Class BlueMindSession
java.lang.Object
org.exoplatform.bluemind.client.BlueMindSession
- All Implemented Interfaces:
AutoCloseable
An open session, as a job of
BlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>) or the holder
of BlueMindRestClient.open(org.exoplatform.bluemind.client.BlueMindAccountSource) sees it: the
REST root and the key every call carries, and who BlueMind says the session
is — never the key itself. Paths are given relative to the root and must
start with /api/; a query may follow, and is never named in a
message. Any other path is refused before anything is sent, and so is one
whose address would not be the session's own scheme, host and port: the key
the request carries goes to the server the session was opened at, and to no
other.
Not thread-safe, and not to be kept past the job or the operation it was opened for: it is one view of one session, closed when that ends.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the session when this holder is the only one that ever held it: the source could not be keyed, the store had no room for it, or another thread's session took its place.A DELETE.The uid of the domain the authenticated account belongs to: the{domainUid}segment of BlueMind's per-user REST paths.A GET.latd()The account BlueMind says the session belongs to, for diagnosis — never compared with the login that was asked for.The address a message may name for a path: root and path, without the query.A POST with a body.A PUT with a body.timeZone()The authenticated user's time zone, as BlueMind's login answered it.toString()Names the session without its key — safe in logs.userUid()The directory entry uid BlueMind authenticated this session as, the segment of the account's DAV principal/dav/principals/__uids__/<uid>/and of its mailbox path.
-
Method Details
-
userUid
The directory entry uid BlueMind authenticated this session as, the segment of the account's DAV principal/dav/principals/__uids__/<uid>/and of its mailbox path.- Returns:
- the uid, or null when the login answer named none
-
domainUid
The uid of the domain the authenticated account belongs to: the{domainUid}segment of BlueMind's per-user REST paths.- Returns:
- the domain uid, or null when the login answer named none
-
latd
The account BlueMind says the session belongs to, for diagnosis — never compared with the login that was asked for.- Returns:
- the account in BlueMind's own spelling, or null
-
timeZone
The authenticated user's time zone, as BlueMind's login answered it.- Returns:
- the zone id, or null when the answer named none
-
get
A GET.- Parameters:
path- the path under the root, query included if any- Returns:
- the answer
-
post
A POST with a body.- Parameters:
path- the path under the rootbody- the body textcontentType- its media type, sent exactly as given- Returns:
- the answer
-
put
A PUT with a body.- Parameters:
path- the path under the rootbody- the body textcontentType- its media type, sent exactly as given- Returns:
- the answer
-
delete
A DELETE.- Parameters:
path- the path under the root, query included if any- Returns:
- the answer
-
named
The address a message may name for a path: root and path, without the query.- Parameters:
path- the path under the root- Returns:
- the address, query stripped
- Throws:
BlueMindException- when the path is not one of the REST API's on this session's server
-
toString
Names the session without its key — safe in logs. -
close
public void close()Closes the session when this holder is the only one that ever held it: the source could not be keyed, the store had no room for it, or another thread's session took its place. A session the store keeps is left open for the next caller, and a session BlueMind refused is already closed on its side. A second close sends nothing.- Specified by:
closein interfaceAutoCloseable
-