Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-25-2008, 08:34 PM
New Member
 
Posts: 4
Default Customized MailDocumentHandlers

Hi,

I've been working on a pet project that revolves around performing server-side monitoring of a user's message-related actions (ie reading, deleting, moving, etc). *edit* I should mention this is for ZCS, FRANKLIN build 5.09

The approach I've been taking is to first load a custom extension and add my mail service to the SoapServlet, which then *should* be going about registering the custom MailDocumentHandlers as handlers with the dispatcher. However I see no indication in the logs that the service and my handlers are actually being registered.

I couldn't find much documentation covering this type of work, but I've tried to follow the admin service's lead.
Essentially this is how it's set up to go now:

MonitoringExtension.java
Code:
public void init() throws ServiceException {
SoapServlet.addService("MonitoringService", new MonitoringService());
}
MonitoringService.java
Code:
public class MonitoringService implements DocumentService {
  public void registerHandlers(DocumentDispatcher dispatcher) {
    dispatcher.registerHandler(MailConstants.GET_MSG_REQUEST, new MonitoredGetMsg());
    dispatcher.registerHandler(MailConstants.CONV_ACTION_REQUEST, new MonitoredConvAction());
  }
}


I had also tried leveraging the zclient classes and events, but that did not work either.


Now.. I can achieve the desired effect by hacking away at the com.zimbra.cs.service.mail.{GetConv, ConvAction, GetMsg} classes directly and recompiling the zimbraserver, but I'd much rather be able to implement this as a portable extension.

I get the feeling I may be missing some pieces of the puzzle... or maybe this isn't possible through an extension.
Anyone out there got any suggestions?
Reply With Quote
  #2 (permalink)  
Old 09-27-2008, 10:10 PM
New Member
 
Posts: 4
Default

Well I've taken a bit of a different approach this time..
I'm now adding my own custom Session as a listener to the mailboxes, and then parsing what I need from notifyPendingChanges() whenever it gets called

the following still seems like a bit of a kludge, but it works
Code:
public void init() throws ServiceException {
   for (String accountID : MailboxManager.getInstance().getAccountIds()){
      Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(accountID);
		
      Session s = new MonitoringSession(mbox.getAccountId());
      s.register();
   }
}

Last edited by fuzzydunlop; 09-29-2008 at 11:29 PM..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.