[Building Sakai] How difficult is to implement event registering for other tools?

Aaron Zeckoski aaronz at vt.edu
Mon Mar 16 10:44:01 PDT 2009


On Mon, Mar 16, 2009 at 5:17 PM, Luiz Antonio Falaguasta Barbosa
<lafbarbosa at gmail.com> wrote:
> Hi guys,
>
> Aaron:
>
> - Thanks for tip about to make callings from tool and not from api, I
> changed the calling, putting the it into AnnouncementAction class (in
> initState method) and it worked fine. Thanks!

That's reasonable.

> - What should I do to don't need to put dependencies?

You will have to add the dependency to the tool or services (impl) but
you want to be sure that you are not adding it to the api. That is
almost never needed.


> Stephen:
>
> I just need to put events related to the visit of users in a tool (when user
> click on tool name in menu).
>
> Thanks in advance!
>
> Luiz
>
> 2009/3/16 Steve Swinsburg <s.swinsburg at lancaster.ac.uk>
>>
>> Hi Luiz,
>> What kinds of events are you trying to add support for? Announcements
>> already publishes events (annc.new), so does Resources/ Content
>> (content.new, content.delete, content.revise).
>> Perhaps with this info we can guide you a bit better.
>>
>> cheers,
>> Steve
>> ---
>> Steve Swinsburg
>> Portal Systems Developer
>> Centre for e-Science
>> Lancaster University
>> Lancaster
>> LA1 4YT
>> email: s.swinsburg at lancaster.ac.uk
>> phone: +44 (0) 1524 594870
>>
>>
>>
>>
>>
>>
>> On 16 Mar 2009, at 14:17, Luiz Antonio Falaguasta Barbosa wrote:
>>
>> Hi people,
>>
>> I got to put it into Announcement tool, only doing the following:
>>
>> Putting it in a method of
>> org.sakaiproject.announcement.cover.AnnouncementService:
>>
>> EventTrackingService.post(EventTrackingService.newEvent("sakai.announcement",
>> "/announcement", true));
>>
>> Putting it into announcement/announcement-api/api/project.xml:
>>
>> <dependency>
>>             <groupId>sakaiproject</groupId>
>>             <artifactId>sakai-event-api</artifactId>
>>             <version>${sakai.version}</version>
>> </dependency>
>>
>> Putting it into announcement/announcement-api/api/pom.xml:
>>
>> <dependency>
>>       <groupId>org.sakaiproject</groupId>
>>       <artifactId>sakai-event-api</artifactId>
>>       <version>${sakai.version}</version>
>>       <scope>provided</scope>
>>     </dependency>
>>
>> Now, I've been trying to do the same thing with content tool, but I didn't
>> get to obtain an event from none method of ContentHostingService and
>> ContentHostingService classes.
>>
>> Please, does anybody know how could I get to do this?
>>
>> Thanks in advance!
>>
>> Regards,
>>
>> Luiz
>>
>> 2009/3/11 Stephen Swinsburg <s.swinsburg at lancaster.ac.uk>
>>>
>>> No problem. One thing though, you mentioned in your last post that you
>>> wnted to add event publishing to other tools:
>>>>
>>>> - Repository
>>>> - Wiki
>>>> - Members
>>>> - Blogger
>>>> - Weblog
>>>> - etc
>>>
>>> You will find that many other Sakai tools publish events, you just need
>>> to know what events to look for, have a trawl through the SAKAI_EVENT table
>>> after creating some files in Resources, or editing a few pages in the wiki,
>>> posting some blog posts etc. If you find that a specific tool isn't
>>> publishing events then you can search for or file a Jira
>>> (http://jira.sakaiproject.org/jira) feature request for those tools to add
>>> event publishing.
>>> If you figure out where the event support should go in particular tools
>>> that lack it, create some patches and attach to the Jira tickets.
>>> Best of luck!
>>> cheers,
>>> Steve
>>> ---
>>> Steve Swinsburg
>>> Portal Systems Developer
>>> Centre for e-Science
>>> Lancaster University
>>> Lancaster
>>> LA1 4YT
>>>
>>> email: s.swinsburg at lancaster.ac.uk
>>> phone: +44 (0) 1524 594870
>>> On 11/03/2009, at 7:11 PM, Luiz Antonio Falaguasta Barbosa wrote:
>>>
>>> Fine!
>>>
>>> Now, I need to discover where I should make calls for
>>> someLogic.postEvent(...); in each tool.
>>>
>>> Thanks Steve!
>>>
>>> Regards,
>>>
>>> Luiz
>>>
>>> 2009/3/11 Stephen Swinsburg <s.swinsburg at lancaster.ac.uk>
>>>>
>>>> Hi Luiz,
>>>> An event is just a notification that someone did something somewhere. If
>>>> you have a tool that you want to register events into the Sakai Event table,
>>>> then you just need to inject the EventTrackingService like this:
>>>> private EventTrackingService eventTrackingService;
>>>> public void setEventTrackingService(EventTrackingService
>>>> eventTrackingService) {
>>>> this.eventTrackingService = eventTrackingService;
>>>> }
>>>> then have a method in your API/IMPL (lets call it someLogic) that post's
>>>> the event:
>>>> public void postEvent(String event,String reference,boolean modify) {
>>>>
>>>> eventTrackingService.post(eventTrackingService.newEvent(event,reference,modify));
>>>> }
>>>> then in your tool, when appropriate, ie after said event has just
>>>> occurred, post the event:
>>>> someLogic.postEvent("my.tool.event", "whereverTheEventOccurred", true);
>>>> true for modify type events, ie if something was changed, false for just
>>>> viewing/accessing something.
>>>> cheers,
>>>> Steve
>>>> ---
>>>> Steve Swinsburg
>>>> Portal Systems Developer
>>>> Centre for e-Science
>>>> Lancaster University
>>>> Lancaster
>>>> LA1 4YT
>>>>
>>>> email: s.swinsburg at lancaster.ac.uk
>>>> phone: +44 (0) 1524 594870
>>>> On 11/03/2009, at 6:40 PM, Luiz Antonio Falaguasta Barbosa wrote:
>>>>
>>>> Hi people,
>>>>
>>>> I've been looking for a way to implement event storing for other tools,
>>>> like these:
>>>>
>>>> - Repository
>>>> - Wiki
>>>> - Members
>>>> - Blogger
>>>> - Weblog
>>>> - etc
>>>>
>>>> What I could see is that I need to call newEvent method from
>>>> EventTrackingService class, as described in this mail list by Steve
>>>> Swingsburg.
>>>>
>>>> But, besides to call this method, what more may I do to give support to
>>>> event registering for old tools (I don't need to show results into sitestats
>>>> because I'm inserting events in a database of other tool, my own tool; I
>>>> just need send the event to be registered by calling writeBatchEvents
>>>> method)?
>>>>
>>>> Thanks in advance!
>>>>
>>>> Regards,
>>>>
>>>> Luiz
>>>> _______________________________________________
>>>> 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 (aaronz at vt.edu)
Senior Research Engineer - CARET - Cambridge University
[http://bugs.sakaiproject.org/confluence/display/~aaronz/]
Sakai Fellow - [http://aaronz-sakai.blogspot.com/]


More information about the sakai-dev mailing list