[Building Sakai] EventTrackingService documentation & examples

Francois Campbell francois at opencollab.co.za
Tue Mar 11 01:15:28 PDT 2014


Hi Earle,

Thank you so much for your response. This was what I was looking for.


On 10 March 2014 17:59, Earle Nietzel <enietzel at anisakai.com> wrote:

> Hi Francois,
>
> There are many examples in the code that show the use of
> EventTrackingService.
>
> I will direct you to an example in the code:
>
> event-components.xml
>
> Contains the spring configuration that wires the EventTrackingService in
> UsageSessionServiceAdaptor.java
>
> <bean id="org.sakaiproject.event.api.UsageSessionService"
> class="org.sakaiproject.event.impl.UsageSessionServiceAdaptor"
> ....
> <lookup-method name="eventTrackingService"       bean=
> "org.sakaiproject.event.api.EventTrackingService"/>
> ....
> </bean>
>
> You can then create an event and post it:
>
> protected void logoutEvent(UsageSession session)
> {
>      if (session == null)
>      {
>
>      // generate a logout event (current session)
>      eventTrackingService().post(eventTrackingService().newEvent(
> EVENT_LOGOUT, null, true));
>      }
>      else
>     {
>     // generate a logout event (this session)
>
>     eventTrackingService().post(eventTrackingService().newEvent(
> EVENT_LOGOUT, null, true), session);
>     }
> }
>
> There are 100's of events in sakai generally you will want to see if an
> event is already being posted:
>
> SELECT DISTINCT sakai_event.EVENT FROM sakai_event;
> If you need to listen for an event then you can add the interested logic
> as an observer and when events are posted your logic will be notified via
> an update method.
>
> eventTrackingService().addObserver(this);
> You can filter on the specific events you are interested in and perform
> what ever logic you need to for example:
>
> public void update(Observable arg0, Object arg) {
>      if (arg == null || !(arg instanceof Event))
>           return;
>      Event event = (Event) arg;
>
>      // check the event function against the functions we have
> notifications watching for
>
>      String function = event.getEvent();
>      if (SECURE_UPDATE_AUTHZ_GROUP.equals(function)
>           || SECURE_UPDATE_OWN_AUTHZ_GROUP.equals(function)
>           || SECURE_REMOVE_AUTHZ_GROUP.equals(function)
>           || SECURE_JOIN_AUTHZ_GROUP.equals(function)
>           || SECURE_UNJOIN_AUTHZ_GROUP.equals(function)
>           || SECURE_ADD_AUTHZ_GROUP.equals(function)) {
>
>           // Your logic
>      }
> }
>
> Again I would look over the code base as there are many examples of this
> pattern.
>
> Earle
>
>
> On Tue, Mar 4, 2014 at 2:55 AM, Francois Campbell <
> francois at opencollab.co.za> wrote:
>
>> Good day.
>>
>> We are attempting to collate resources and podcast clicks and are hoping
>> to use the events stored to the sakai_events table to do so.
>>
>> If anyone can provide any documentation or guidelines on how this service
>> ( org.sakaiproject.event.api.EventTrackingService ) is to be used, it would
>> be much appreciated.
>>
>>
>> Environment
>> Sakai version :  2.9.3-all
>> DB : MySQL 5
>>
>> --
>> *Francois Campbell*
>>  Java Developer
>>  *opencollab*
>>  *Tel*: +27 21 970 4000 | *Fax*: +27 21 914 3098
>>  *Mobile*: 083 273 3530
>>  *Web*: www.opencollab.co.za
>>
>> ------------------------------
>> See OpenCollab email disclaimer at http://www.opencollab.co.
>> za/email-disclaimer
>>
>> _______________________________________________
>> 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"
>>
>
>


-- 
*Francois Campbell*
 Java Developer
 *opencollab*
 *Tel*: +27 21 970 4000 | *Fax*: +27 21 914 3098
 *Mobile*: 083 273 3530
 *Web*: www.opencollab.co.za

-- 

------------------------------
See OpenCollab email disclaimer at 
http://www.opencollab.co.za/email-disclaimer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140311/4c98bf18/attachment.html 


More information about the sakai-dev mailing list