[Building Sakai] Events

Stephen Marquard stephen.marquard at uct.ac.za
Wed Feb 24 21:35:16 PST 2010


In 2.6+, you can explicitly pass the context when posting the event.

Regards
Stephen 
 
>>> Steve Swinsburg <steve.swinsburg at gmail.com> 2/25/2010 1:12 AM >>> 
Hi Adrian,

It looks like it's set in BaseEvent which implements Event:

kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java

// Find the context using the reference (let the service that it belongs to parse it) 
			if (resource != null && !"".equals(resource)) {
				Reference ref = entityManager().newReference(resource);
				if (ref != null) {
					m_context = ref.getContext();
				}
			}
			
			// If we still need to find the context, try the tool placement 
			if (m_context == null) {
				Placement placement = toolManager().getCurrentPlacement();
				if (placement != null) {
					m_context = placement.getContext();
				}
			}


So the context comes from either the entity reference or from the tool placement. I'll take a stab and assume you are working on events for the system wide chat? You probably don't have either so its null and SiteStats can't determine where they came from. Might need to extend Event to take a context parameter in its constructor, or run a regular quartz job over it to fix all of the null context events (any from <2.5 will be null also) so they can be collected in SiteStats.

cheers,
Steve



On 25/02/2010, at 4:09 AM, Adrian Fish wrote:

> I'm hoping someone can shed some light on a little problem I'm having. The events generated by my tool (snigger) are getting rejected by site stats due to Event.getContext returning null.
> 
> Does anybody know how the EventTrackingService populates the context field in the Events that it creates?
> 
> Cheers,
> 
> Adrian.
> 
> -- 
> ==================================
> Adrian Fish
> Software Engineer
> Centre for e-Science
> Bowland Tower South C Floor
> Lancaster University
> Lancaster
> LA1 4YW
> email: a.fish at lancaster.ac.uk
> 
> http://confluence.sakaiproject.org/display/YAFT/Yaft
> http://confluence.sakaiproject.org/display/BLOG/Home
> http://confluence.sakaiproject.org/display/AGORA/Home
> 
> <a_fish.vcf>_______________________________________________
> 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"





More information about the sakai-dev mailing list