|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.qtunes.core.Session
public abstract class Session
A Session is a single login session and one must be in place for most ControlMethod
objects to be run. Each Session has a unique ID, a record of the Service that created it
and a number of "allowances", which determine what the Session can do. These can be checked
by calling the isAllowed(java.lang.String)
method.
When the session is created a set of Properties can be specified, which can be
retrieved later with the getProperties()
method. Please see the API docs for that method
to get a list of standard properties.
Field Summary | |
---|---|
static Session |
NONE
A Session placeholder to mark "no session". |
Constructor Summary | |
---|---|
Session()
|
Method Summary | |
---|---|
void |
bumpTracksCompleted()
Increase the number of tracks completed by this Session by 1 |
void |
bumpTracksStarted()
Increase the number of tracks started by this Session by 1 |
void |
bumpTraffic(long v)
Increase the amount of net traffic used by this session by the specified amount |
void |
expire()
Mark this Session as expired. |
abstract java.util.Collection<java.lang.String> |
getAllowances()
Return the Set of allowances for this Session |
abstract int |
getCreated()
Return the time this session was created, in seconds since epoch |
static Session |
getCurrentSession()
Return the current Session for this Thread |
abstract int |
getExpiryTime()
Return the time this session should be expired, in seconds since epoch |
abstract int |
getId()
Return the unique numeric ID of this Session |
abstract int |
getLastActivity()
Return the last time any activity occurred on this session, in seconds since epoch |
abstract java.util.Map |
getProperties()
Get the Properties specified when this Session was created. |
abstract Service |
getService()
Return the Service that created this Session |
int |
getTracksCompleted()
Return the number of tracks completed by this Session |
int |
getTracksStarted()
Return the number of tracks started by this Session |
long |
getTraffic()
Return the amount of net traffic used by this Session |
abstract boolean |
isAllowed(java.lang.String test)
Return whether this Session has the specified allowance. |
boolean |
isExpired()
Return whether this session is expired |
static void |
setCurrentSession(Session session)
Set the current Session for this Thread |
abstract void |
touch()
Mark the session as active as of this point in time |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Session NONE
getCurrentSession()
when
no session is in place
Constructor Detail |
---|
public Session()
Method Detail |
---|
public abstract int getId()
public abstract Service getService()
public abstract java.util.Map getProperties()
ip | The IP address or Hostname for the session, if it was created remotely |
---|---|
user | The username of the user that created the session |
public abstract void touch()
public abstract int getCreated()
public abstract int getLastActivity()
public abstract int getExpiryTime()
public abstract boolean isAllowed(java.lang.String test)
Authorizer
objects that have been registered with
the Auth.addAuthorizer(org.qtunes.auth.Authorizer)
method - an Authorizer that grants "*"
will allow any action, and passing the value "*" in as the test will
check for any allowance. The NONE
Session does not allow
anything.
test
- the allowance we're testing for, or "*" for any allowancepublic abstract java.util.Collection<java.lang.String> getAllowances()
public boolean isExpired()
public void expire()
Auth.logout(org.qtunes.core.Session)
.
public void bumpTracksStarted()
public void bumpTracksCompleted()
public void bumpTraffic(long v)
public long getTraffic()
public int getTracksStarted()
public int getTracksCompleted()
public static final Session getCurrentSession()
NONE
to indicate no active sessionpublic static final void setCurrentSession(Session session)
session
- the current Session, or NONE
to indicate no active session
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |