org.qtunes.auth
Class SessionMatcher

java.lang.Object
  extended by org.qtunes.core.util.AbstractMatcher<Session>
      extended by org.qtunes.auth.SessionMatcher
All Implemented Interfaces:
Serializable

public class SessionMatcher
extends AbstractMatcher<Session>

A AbstractMatcher which can be used to match a Session object. Tests include

servicethe name of the service that created this Session
ttlthe number of seconds until this Service expires
agethe number of seconds since this Service was created
idlethe number of seconds this Service has been idle
trafficthe number of bytes this Session has transmitted
tracksStartedthe number of tracks this Session has started
tracksCompletedthe number of tracks this Session has completed
ipif appropriate, the IP address of the session. This can be tested as ip="192.168.1.2", ip="192.168.0.0/16", ip="*.local" or a regular expression match
or any property specified in the Session properties. So as an example, service="AppleServer" and (remote="Mike's Remote" or ip="10.0.0.16") could be used to scrobble tracks played by a certain remote or streamed to a certain host.

See Also:
Serialized Form

Constructor Summary
SessionMatcher(String filter)
           
 
Method Summary
 Object getProperty(Session session, String property)
          Return the specified Property from the source object being tested
 boolean test(String key, String op, String testval, Object propval)
          Compare two values
 
Methods inherited from class org.qtunes.core.util.AbstractMatcher
equals, getFilter, hashCode, isUniversal, matches, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SessionMatcher

public SessionMatcher(String filter)
Method Detail

getProperty

public Object getProperty(Session session,
                          String property)
Description copied from class: AbstractMatcher
Return the specified Property from the source object being tested

Specified by:
getProperty in class AbstractMatcher<Session>

test

public boolean test(String key,
                    String op,
                    String testval,
                    Object propval)
Description copied from class: AbstractMatcher
Compare two values

Overrides:
test in class AbstractMatcher<Session>
Parameters:
key - the key the values are stored under
op - the operation, one of "=", "!=", "<", ">", "<=", ">=", "=~" or "!~"
testval - the value specified in the test
propval - the property value that we're testing, as returned from AbstractMatcher.getProperty(E, java.lang.String)