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

Luiz Antonio Falaguasta Barbosa lafbarbosa at gmail.com
Thu Mar 12 14:12:13 PDT 2009


Hi Stephen,

About where and which events, I just need to know when users access and
alter some tools, so I'll put the events for these cases.

Please, take a look at what I did:

I've changed:

- announcement/announcement-api/api/pom.xml putting:

    <dependency>
            <groupId>sakaiproject</groupId>
            <artifactId>sakai-event-api</artifactId>
            <version>${sakai.version}</version>
            <scope>provided</scope>
        </dependency>

- announcement/announcement-api/api/project.xml putting:

<dependency>
            <groupId>sakaiproject</groupId>
            <artifactId>sakai-event-api</artifactId>
            <version>${sakai.version}</version>
        </dependency>

-
announcement/announcement-api/api/src/java/org/sakaiproject/announcement/api/AnnouncementService
putting:

    public void postEvent(String toolAndEvent, String whereEventOccurred,
boolean recordedOrGot);

-
announcement/announcement-api/api/src/java/org/sakaiproject/announcement/cover/AnnouncementService
putting:

    private EventTrackingService eventTrackingService;

    public void setEventTrackingService(EventTrackingService
eventTrackingService) {
        this.eventTrackingService = eventTrackingService;
    }

    public void postEvent(String event,String reference,boolean modify) {

eventTrackingService.post(eventTrackingService.newEvent(event,reference,modify));
    }

        service.postEvent("announcement.add", "/announcement/", true);

-
announcement/announcement-api/api/src/java/org/sakaiproject/announcement/impl/DbAnnouncementService
changing class declaration:

public abstract class DbAnnouncementService extends BaseAnnouncementService

After that, I ran Tomcat and I got this message in catalina.out (and Tomcat
deploying freezed):

INFO: init(): hidden tools: sakai.assignment  (2009-03-12 17:46:50,715
main_org.sakaiproject.tool.impl.ToolComponent)
WARN: Servlet 2.4 or below detected.  Unable to find getContextPath on
ServletContext. (2009-03-12 17:46:50,723
main_org.apache.pluto.core.PortletContextManager)
INFO: Building new Hibernate SessionFactory (2009-03-12 17:46:53,149
main_org.sakaiproject.springframework.orm.hibernate.AddableSessionFactoryBean)
INFO: Updating database schema for Hibernate SessionFactory (2009-03-12
17:47:01,887
main_org.sakaiproject.springframework.orm.hibernate.AddableSessionFactoryBean)
INFO: init() (2009-03-12 17:47:04,507
main_org.theospi.portfolio.worksite.mgt.impl.WorksiteListGenerator)
INFO: init() (2009-03-12 17:47:04,551
main_org.sakaiproject.thread_local.impl.ThreadLocalComponent)
INFO: init(): vendor: mysql autoDDL: true deadlockRetries: 5 (2009-03-12
17:47:04,713 main_org.sakaiproject.db.impl.BasicSqlService)
INFO:
org.sakaiproject.event.impl.ClusterEventTracking$$EnhancerByCGLIB$$e6858577 at 1ba92bb.init()
(2009-03-12 17:47:04,715
main_org.sakaiproject.event.impl.BaseEventTrackingService)
INFO:
org.sakaiproject.event.impl.ClusterEventTracking$$EnhancerByCGLIB$$e6858577 at 1ba92bb.init()
- period: 5 batch: true checkDb: true (2009-03-12 17:47:04,715
main_org.sakaiproject.event.impl.ClusterEventTracking)
INFO: init() (2009-03-12 17:47:04,715
main_org.sakaiproject.memory.impl.BasicMemoryService)
INFO: init() - caching minutes: 3 (2009-03-12 17:47:04,726
main_org.sakaiproject.authz.impl.SakaiSecurity)
INFO: init() (2009-03-12 17:47:04,730
main_org.sakaiproject.entity.impl.EntityManagerComponent)
INFO: init() (2009-03-12 17:47:04,794
main_org.sakaiproject.authz.impl.FunctionManagerComponent)
INFO: init() - caching minutes: 5 - cache cleaner minutes: 15 (2009-03-12
17:47:04,794 main_org.sakaiproject.alias.impl.BaseAliasService)
INFO: init(): table: SAKAI_ALIAS external locks: true checkOld: false
(2009-03-12 17:47:04,794 main_org.sakaiproject.alias.impl.DbAliasService)
INFO: init() - caching minutes: 3 (2009-03-12 17:47:04,860
main_org.sakaiproject.site.impl.BaseSiteService)
INFO: init(): site table: SAKAI_SITE external locks: true (2009-03-12
17:47:04,860 main_org.sakaiproject.site.impl.DbSiteService)
INFO:
org.sakaiproject.event.impl.DbNotificationService$$EnhancerByCGLIB$$781a4c43 at 1681629.init()
(2009-03-12 17:47:04,889
main_org.sakaiproject.event.impl.BaseNotificationService)
INFO:
org.sakaiproject.event.impl.DbNotificationService$$EnhancerByCGLIB$$781a4c43 at 1681629.init()
(2009-03-12 17:47:04,900
main_org.sakaiproject.event.impl.BaseNotificationService)
INFO: .init(): table: SAKAI_NOTIFICATION locks-in-db: false (2009-03-12
17:47:04,900 main_org.sakaiproject.event.impl.DbNotificationService)
INFO: Initializing
org.sakaiproject.coursemanagement.impl.CourseManagementServiceHibernateImpl
(2009-03-12 17:47:05,306
main_org.sakaiproject.coursemanagement.impl.CourseManagementServiceHibernateImpl)
INFO: initializing
org.sakaiproject.coursemanagement.impl.provider.CourseManagementGroupProvider
(2009-03-12 17:47:05,343
main_org.sakaiproject.coursemanagement.impl.provider.CourseManagementGroupProvider)
INFO: init(): provider: $Proxy7 (2009-03-12 17:47:05,349
main_org.sakaiproject.authz.impl.BaseAuthzGroupService)
INFO: init(): table: SAKAI_REALM external locks: true (2009-03-12
17:47:05,387 main_org.sakaiproject.authz.impl.DbAuthzGroupService)
INFO: init() (2009-03-12 17:47:05,394
main_org.sakaiproject.content.impl.DbResourceTypeRegistry)
INFO: init() (2009-03-12 17:47:05,423
main_org.sakaiproject.content.impl.ResourceTypeRegistryImpl)
INFO: init(): site quota: 1048576 body path: null volumes:  (2009-03-12
17:47:05,474 main_org.sakaiproject.content.impl.BaseContentService)
INFO: init(): provider: none - caching minutes: 5 - cache cleaner minutes:
15 separateIdEid: true (2009-03-12 17:47:05,550
main_org.sakaiproject.user.impl.BaseUserDirectoryService)
INFO: init(): table: SAKAI_USER external locks: true (2009-03-12
17:47:05,550 main_org.sakaiproject.user.impl.DbUserService)
INFO: init(): tables: CONTENT_COLLECTION CONTENT_RESOURCE
CONTENT_RESOURCE_BODY_BINARY CONTENT_ENTITY_GROUPS locks-in-db: false
bodyPath: null (2009-03-12 17:47:05,616
main_org.sakaiproject.content.impl.DbContentService)
INFO: init() (2009-03-12 17:47:05,647
main_org.theospi.portfolio.guidance.impl.GuidanceEntityProducer)
INFO: init() (2009-03-12 17:47:05,672
main_org.theospi.portfolio.style.impl.StyleManagerImpl)
INFO: init() (2009-03-12 17:47:05,918
main_org.theospi.portfolio.security.model.DefaultRealmManagerImpl)
INFO: init(): interval: 3600 refresh: 60 (2009-03-12 17:47:05,938
main_org.sakaiproject.tool.impl.SessionComponent)
INFO: init() (2009-03-12 17:47:05,945
main_org.sakaiproject.id.impl.UuidV4IdComponent)
INFO: init() (2009-03-12 17:47:05,968
main_org.sakaiproject.time.api.TimeService)
INFO: init() (2009-03-12 17:47:05,995
main_org.theospi.portfolio.security.model.DefaultRealmManagerImpl)
INFO: init() (2009-03-12 17:47:06,001
main_org.theospi.portfolio.security.model.DefaultRealmManagerImpl)
INFO: init() (2009-03-12 17:47:06,015
main_org.theospi.portfolio.security.model.SakaiDefaultPermsManager)
INFO: init() (2009-03-12 17:47:06,080
main_org.sakaiproject.event.impl.UsageSessionServiceAdaptor)
INFO: init() (2009-03-12 17:47:06,170
main_org.sakaiproject.taggable.impl.TaggingManagerImpl)
INFO: init() (2009-03-12 17:47:06,356
main_org.theospi.portfolio.help.model.DbGlossary)
INFO: init() (2009-03-12 17:47:06,452
main_org.theospi.portfolio.help.impl.GlossaryEntityProducer)
INFO: init() (2009-03-12 17:47:06,631
main_org.sakaiproject.metaobj.shared.mgt.impl.StructuredArtifactDefinitionManagerImpl)
INFO: init() (2009-03-12 17:47:06,790
main_org.sakaiproject.content.impl.BasicContentTypeImageService)
INFO: init() (2009-03-12 17:47:07,741
main_org.theospi.portfolio.presentation.model.impl.PresentationManagerImpl)
INFO: afterPropertiesSet() (2009-03-12 17:47:08,524
main_org.theospi.portfolio.admin.service.SakaiIntegrationServiceImpl)
INFO: init() (2009-03-12 17:47:08,845
main_org.theospi.portfolio.matrix.model.impl.MatrixContentEntityProducer)
INFO: init() (2009-03-12 17:47:08,859
main_org.theospi.portfolio.workflow.impl.WorkflowEntityProducer)
INFO: init() (2009-03-12 17:47:08,920
main_org.theospi.portfolio.presentation.model.impl.LayoutEntityProducer)
INFO: init() (2009-03-12 17:47:08,933
main_org.theospi.portfolio.presentation.model.impl.PresentationContentEntityProducer)
INFO: init() (2009-03-12 17:47:08,956
main_org.theospi.portfolio.presentation.model.impl.PresentationListGenerator)
INFO: init() ReportsManagerImpl (2009-03-12 17:47:08,977
main_org.theospi.portfolio.reports.model.impl.ReportsManagerImpl)
INFO: init() (2009-03-12 17:47:09,347
main_org.theospi.portfolio.reports.model.impl.ReportsEntityProducer)
INFO: init() (2009-03-12 17:47:09,356
main_org.theospi.portfolio.security.model.SakaiDefaultPermsManager)
INFO: init() (2009-03-12 17:47:09,484
main_org.sakaiproject.assignment.impl.BaseAssignmentService)
INFO: init: assignments table: ASSIGNMENT_ASSIGNMENT contents table:
ASSIGNMENT_CONTENT submissions table: ASSIGNMENT_SUBMISSION locks-in-dbfalse
(2009-03-12 17:47:09,498
main_org.sakaiproject.assignment.impl.DbAssignmentService)
INFO: init() (2009-03-12 17:47:09,508
main_org.theospi.portfolio.warehouse.sakai.assignment.AssignmentWarehouseTask)
INFO: init() (2009-03-12 17:47:09,979
main_org.theospi.portfolio.warehouse.sakai.resource.ContentResourceWarehouseTask)
INFO: init() (2009-03-12 17:47:10,172
main_org.theospi.portfolio.warehouse.sakai.resource.ContentResourceCollectionWarehouseTask)
INFO: init() (2009-03-12 17:47:10,244
main_org.theospi.portfolio.wizard.mgt.impl.WizardManagerImpl)
INFO: init() (2009-03-12 17:47:10,287
main_org.theospi.portfolio.warehouse.osp.wizard.WizardWarehouseTask)
INFO: init() (2009-03-12 17:47:10,454
main_org.theospi.portfolio.warehouse.osp.matrix.WizardPageWarehouseTask)
INFO: init() (2009-03-12 17:47:10,633
main_org.theospi.portfolio.warehouse.osp.presentation.PresentationTemplateWarehouseTask)
INFO: init() (2009-03-12 17:47:10,640
main_org.theospi.portfolio.warehouse.osp.presentation.PresentationLayoutWarehouseTask)
INFO: init() (2009-03-12 17:47:10,645
main_org.theospi.portfolio.warehouse.osp.presentation.PresentationWarehouseTask)
INFO: init() (2009-03-12 17:47:10,850
main_org.theospi.portfolio.warehouse.osp.matrix.ScaffoldingWarehouseTask)
INFO: init() (2009-03-12 17:47:10,999
main_org.theospi.portfolio.warehouse.osp.matrix.MatrixWarehouseTask)
INFO: init() (2009-03-12 17:47:11,142
main_org.theospi.portfolio.warehouse.osp.presentation.GuidanceWarehouseTask)
INFO: init() (2009-03-12 17:47:11,299
main_org.theospi.portfolio.warehouse.osp.common.ReviewItemsWarehouseTask)
INFO: init() (2009-03-12 17:47:11,386
main_org.theospi.portfolio.warehouse.sakai.site.WorksiteWarehouseTask)
INFO: init() (2009-03-12 17:47:11,493
main_org.theospi.portfolio.warehouse.sakai.session.SessionWarehouseTask)
INFO: init() (2009-03-12 17:47:11,568
main_org.theospi.portfolio.warehouse.osp.style.StyleWarehouseTask)
INFO: init() (2009-03-12 17:47:11,898
main_org.theospi.portfolio.warehouse.sakai.user.UserWarehouseTask)
INFO: init() (2009-03-12 17:47:12,001
main_org.theospi.portfolio.wizard.impl.WizardEntityProducer)
INFO: init() (2009-03-12 17:47:12,005
main_org.theospi.portfolio.wizard.taggable.impl.WizardActivityProducerImpl)
INFO: init() (2009-03-12 17:47:12,042
main_org.sakaiproject.user.impl.BasePreferencesService)
INFO: init(): table: SAKAI_PREFERENCES locks-in-db: false (2009-03-12
17:47:12,042 main_org.sakaiproject.user.impl.DbPreferencesService)
INFO: Registering producer: Assistente (2009-03-12 17:47:12,048
main_org.sakaiproject.taggable.impl.TaggingManagerImpl)
INFO: init() (2009-03-12 17:47:12,060
main_org.theospi.portfolio.wizard.WizardListGenerator)
INFO: init() (2009-03-12 17:47:12,063
main_org.theospi.portfolio.wizard.WizardListGenerator)
INFO: init() (2009-03-12 17:47:12,065
main_org.theospi.portfolio.wizard.WizardListGenerator)
INFO: destroy() (2009-03-12 17:47:12,068
main_org.sakaiproject.content.impl.BaseContentService)
INFO: destroy() (2009-03-12 17:47:12,069
main_org.sakaiproject.assignment.impl.BaseAssignmentService)
INFO: destroy() (2009-03-12 17:47:12,069
main_org.sakaiproject.component.impl.BasicConfigurationService)
INFO: destroy() (2009-03-12 17:47:12,069
main_org.sakaiproject.log.impl.Log4jConfigurationManager)
INFO: destroy() (2009-03-12 17:47:12,069
main_org.sakaiproject.tool.impl.ToolComponent)
INFO: destroying
org.sakaiproject.coursemanagement.impl.provider.CourseManagementGroupProvider
(2009-03-12 17:47:12,069
main_org.sakaiproject.coursemanagement.impl.provider.CourseManagementGroupProvider)
INFO: Destroying
org.sakaiproject.coursemanagement.impl.CourseManagementServiceHibernateImpl
(2009-03-12 17:47:12,070
main_org.sakaiproject.coursemanagement.impl.CourseManagementServiceHibernateImpl)
INFO: Closing Hibernate SessionFactory (2009-03-12 17:47:12,070
main_org.sakaiproject.springframework.orm.hibernate.AddableSessionFactoryBean)
INFO: destroy() (2009-03-12 17:47:12,071
main_org.sakaiproject.content.impl.ResourceTypeRegistryImpl)
INFO: destroy() (2009-03-12 17:47:12,071
main_org.sakaiproject.db.impl.BasicSqlService)
INFO: destroy() (2009-03-12 17:47:12,074
main_org.sakaiproject.thread_local.impl.ThreadLocalComponent)
INFO:
org.sakaiproject.event.impl.ClusterEventTracking$$EnhancerByCGLIB$$e6858577 at 1ba92bb.destroy()
(2009-03-12 17:47:12,074
main_org.sakaiproject.event.impl.BaseEventTrackingService)
INFO: init() (2009-03-12 17:47:12,265
main_org.sakaiproject.thread_local.impl.ThreadLocalComponent)
INFO: init(): vendor: mysql autoDDL: true deadlockRetries: 5 (2009-03-12
17:47:12,332 main_org.sakaiproject.db.impl.BasicSqlService)
INFO:
org.sakaiproject.event.impl.ClusterEventTracking$$EnhancerByCGLIB$$e6858577 at cfe446.init()
(2009-03-12 17:47:12,334
main_org.sakaiproject.event.impl.BaseEventTrackingService)
INFO:
org.sakaiproject.event.impl.ClusterEventTracking$$EnhancerByCGLIB$$e6858577 at cfe446.init()
- period: 5 batch: true checkDb: true (2009-03-12 17:47:12,334
main_org.sakaiproject.event.impl.ClusterEventTracking)
INFO: destroy() (2009-03-12 17:47:12,335
main_org.sakaiproject.memory.impl.BasicMemoryService)
INFO: destroy() (2009-03-12 17:47:12,335
main_org.sakaiproject.authz.impl.SakaiSecurity)
INFO: destroy() (2009-03-12 17:47:12,335
main_org.sakaiproject.entity.impl.EntityManagerComponent)
INFO: destroy() (2009-03-12 17:47:12,335
main_org.sakaiproject.authz.impl.FunctionManagerComponent)
INFO: destroy() (2009-03-12 17:47:12,335
main_org.sakaiproject.alias.impl.BaseAliasService)
INFO: destroy() (2009-03-12 17:47:12,335
main_org.sakaiproject.site.impl.BaseSiteService)
INFO:
org.sakaiproject.event.impl.DbNotificationService$$EnhancerByCGLIB$$781a4c43 at 1681629.destroy()
(2009-03-12 17:47:12,335
main_org.sakaiproject.event.impl.BaseNotificationService)
INFO: destroy() (2009-03-12 17:47:12,336
main_org.sakaiproject.authz.impl.BaseAuthzGroupService)
INFO: destroy() (2009-03-12 17:47:12,336
main_org.sakaiproject.user.impl.BaseUserDirectoryService)

If you or somebody else could give some tip, I thank you 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"
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090312/f397157a/attachment-0001.html 


More information about the sakai-dev mailing list