[Building Sakai] Count user online in Sakai.

Aaron Zeckoski azeckoski at unicon.net
Wed Apr 4 04:54:40 PDT 2012


What Steve said... Definitely.
-AZ


On Wed, Apr 4, 2012 at 7:28 AM, Steve Swinsburg
<steve.swinsburg at gmail.com>wrote:

> A quicker way to do this across the entire environment (since
> PresenceService is site based) is to use the ActivityService:
>
> org.sakaiproject.event.api
> Interface ActivityService
> ------------------------------
>
> public interface *ActivityService*
>
> ActivityService provides the ability to check if users are online and when
> they were last active.
>
> Users are registered and updated each time they publish an event. As such
> you can tell *if* a user is active and *when* they were last active (last
> event time).
>
> For clustered environments, you may experience discrepancies when a new
> node comes online as the cache will start afresh so users will only be
> repopulated into the cache once they start publishing events.
> ------------------------------
>
> *Method Summary*  List<http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html?is-external=true>
> <String<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true>
> > *getActiveUsers*(List<http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html?is-external=true>
> <String<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true>
> > userIds)
>           Get the list of users with active Sakai sessions, given the
> supplied list of userIds.  Long<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Long.html?is-external=true>
> *getLastEventTimeForUser*(String<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true>
>  userId)
>           Get last event time for the given user  Map<http://download.oracle.com/javase/1.5.0/docs/api/java/util/Map.html?is-external=true>
> <String<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true>
> ,Long<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Long.html?is-external=true>
> > *getLastEventTimeForUsers*(List<http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html?is-external=true>
> <String<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true>
> > userIds)
>           Get last event time for the given list of users  boolean*
> isUserActive*(String<http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true>
>  userId)
>           Check if a userId has an active Sakai session.
>
>
> cheers,
> Steve
>
> On 04/04/2012, at 7:10 PM, David Wafula wrote:
>
> I usually inject PresenceService into the tool then:
>
> List<String> locationIds = presenceService.getLocations();
>
>        for (String locationId : locationIds) {
>            List<UsageSession> usageSessions =
> presenceService.getPresence(locationId);
>            for (UsageSession usageSession : usageSessions) {
>                String userEid = usageSession.getUserEid();   //or
> userid
>              //i then total up the unique users somewhere from here.
>             }
>         }
>
> Regards,
> dww.
>
> On Wed, Apr 4, 2012 at 9:59 AM, Tram Bao <baotram144 at gmail.com> wrote:
>
> Dear all,
>
>
> I want to count user online in Sakai.
>
> Does Sakai has a API to do that?
>
>
> Thanks,
>
> TramBao.
>
>
> _______________________________________________
>
> sakai-dev mailing list
>
> sakai-dev at collab.sakaiproject.org
>
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org
>
> with a subject of "unsubscribe"
>
>
>
>
> --
> David Wafula
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>



-- 
Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120404/de0da138/attachment.html 


More information about the sakai-dev mailing list