|
From: <mic...@us...> - 2003-12-04 00:44:46
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker
In directory sc8-pr-cvs1:/tmp/cvs-serv11279/src/com/babeldoc/scanner/worker
Modified Files:
MailboxScanner.java
Log Message:
Mailbox scanner updated to correctly use the filtering capabilities provided
by the superclass.
Scanner classes updated to cater for upgraded jmx scanner.
Build.xml updated to correct the project name and exclude the jboss-service.xml
file, as it's now included in the .sarfile built at the top level.
Index: MailboxScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/MailboxScanner.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** MailboxScanner.java 13 Oct 2003 07:24:39 -0000 1.29
--- MailboxScanner.java 4 Dec 2003 00:44:42 -0000 1.30
***************
*** 79,83 ****
import javax.mail.Folder;
import javax.mail.Message;
- import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Part;
--- 79,82 ----
***************
*** 85,91 ****
import javax.mail.Store;
- import java.util.regex.Pattern;
- import java.util.regex.Matcher;
-
import com.babeldoc.core.I18n;
import com.babeldoc.core.option.ConfigOption;
--- 84,87 ----
***************
*** 116,124 ****
public static final String SUBJECT_FILTER = "subjectFilter";
! //Values for getFrom attribute
public static final String BODY = "body";
public static final String ATTACHMENT = "attachment";
! //default values
public static String DEFAULT_PROTOCOL = "pop3";
public static String DEFAULT_FOLDER = "INBOX";
--- 112,120 ----
public static final String SUBJECT_FILTER = "subjectFilter";
! /** Values for getFrom attribute */
public static final String BODY = "body";
public static final String ATTACHMENT = "attachment";
! /** Default values */
public static String DEFAULT_PROTOCOL = "pop3";
public static String DEFAULT_FOLDER = "INBOX";
***************
*** 149,156 ****
* Do the scan
*
! * @throws ScannerException DOCUMENT ME!
*/
public void doScan() throws ScannerException {
- //Folder folder = null;
Folder folder = null;
Store store = null;
--- 145,153 ----
* Do the scan
*
! * @throws ScannerException
! *
! * @see ScannerWorker
*/
public void doScan() throws ScannerException {
Folder folder = null;
Store store = null;
***************
*** 206,212 ****
* @param message the message to be tested against the current
* set of filters
* @return boolean true if the message matches any of the
* current filters
! * @see Message ScannerWorker
*/
private boolean matchMessage(Message m) throws javax.mail.MessagingException {
--- 203,213 ----
* @param message the message to be tested against the current
* set of filters
+ *
* @return boolean true if the message matches any of the
* current filters
! *
! * @throws MessagingException
! *
! * @see Message
*/
private boolean matchMessage(Message m) throws javax.mail.MessagingException {
***************
*** 216,220 ****
boolean subjectMatch = false;
! // Check for a match in the recipients
Address[] from = m.getFrom();
for (int j = 0; j < from.length; j++) {
--- 217,221 ----
boolean subjectMatch = false;
! // Check for a match in the senders
Address[] from = m.getFrom();
for (int j = 0; j < from.length; j++) {
***************
*** 244,247 ****
--- 245,249 ----
}
+ // Check for a match in the subject
if (getLog().isDebugEnabled()) {
getLog().logDebug("Testing " + m.getSubject().toString() + " against " + getFilter(SUBJECT_FILTER));
***************
*** 287,291 ****
/**
! * release the held resource. Do nothing - no held resources.
*/
public void relinquishResources() {
--- 289,293 ----
/**
! * Release held resources. Do nothing - no held resources.
*/
public void relinquishResources() {
***************
*** 300,306 ****
* @return StringBuffer with content of the message
*
! * @throws Exception
*/
! private StringBuffer getMailContent(Part part) throws Exception {
// Code donated by Hans Benedict.
BufferedReader reader =
--- 302,308 ----
* @return StringBuffer with content of the message
*
! * @throws IOException, MessagingException
*/
! private StringBuffer getMailContent(Part part) throws java.io.IOException, javax.mail.MessagingException {
// Code donated by Hans Benedict.
BufferedReader reader =
***************
*** 310,314 ****
while ((line = reader.readLine()) != null) {
- //System.out.println( "appending: "+line);
result.append(line).append("\n");
}
--- 312,315 ----
***************
*** 323,340 ****
* @param message
*
! * @throws MessagingException DOCUMENT ME!
*/
! private void deleteMessage(Message message) throws MessagingException {
message.setFlag(Flags.Flag.DELETED, true);
}
/**
! * DOCUMENT ME!
*
* @param message
*
! * @throws Exception DOCUMENT ME!
*/
! private void processMessage(Message message) throws Exception {
//process as multipart
if (message.getContent() instanceof Multipart) {
--- 324,343 ----
* @param message
*
! * @throws MessagingException
*/
! private void deleteMessage(Message message) throws javax.mail.MessagingException {
message.setFlag(Flags.Flag.DELETED, true);
}
/**
! * Place the specified message in a queue.
! * <p>
! * Multipart messages need to be handled slightly differently.
*
* @param message
*
! * @throws IOException, MessagingException
*/
! private void processMessage(Message message) throws java.io.IOException, javax.mail.MessagingException {
//process as multipart
if (message.getContent() instanceof Multipart) {
***************
*** 346,358 ****
/**
! * DOCUMENT ME!
*
* @param multipart
* @param originalMessage DOCUMENT ME!
*
! * @throws Exception DOCUMENT ME!
*/
private void processMultipart(Multipart multipart, Message originalMessage)
! throws Exception {
int numberOfParts = multipart.getCount();
--- 349,365 ----
/**
! * Processes multiparts of a multipart message.
! * <p>
! * This method is recursive, unravelling the (possibly) nested multiparts
! * of a message. Each multipart is broken down into its constituent parts
! * which are enqueued, before the entire multipart is enqueued.
*
* @param multipart
* @param originalMessage DOCUMENT ME!
*
! * @throws IOException, MessagingException
*/
private void processMultipart(Multipart multipart, Message originalMessage)
! throws java.io.IOException, javax.mail.MessagingException {
int numberOfParts = multipart.getCount();
***************
*** 366,370 ****
originalMessage);
}
!
processPart(part, originalMessage);
}
--- 373,377 ----
originalMessage);
}
! // Should this be here, or in the else portion of the above if statement?
processPart(part, originalMessage);
}
***************
*** 372,384 ****
/**
! * This method is used for processing message part
*
! * @param part
! * @param originalMessage DOCUMENT ME!
*
! * @throws Exception DOCUMENT ME!
*/
private void processPart(Part part, Message originalMessage)
! throws Exception {
String disposition = part.getDisposition();
String path = protocol + "://" + username + "@" + host + "/" + folder_;
--- 379,393 ----
/**
! * This method is used for processing a message part.
! * <p>
! * This method processes a part, either a base part, or multipart.
*
! * @param part Part of message to process
! * @param originalMessage Reference to original message for certain properties
*
! * @throws IOException, MessagingException
*/
private void processPart(Part part, Message originalMessage)
! throws java.io.IOException, javax.mail.MessagingException {
String disposition = part.getDisposition();
String path = protocol + "://" + username + "@" + host + "/" + folder_;
***************
*** 392,398 ****
attrs.put(SCAN_FROM_KEY, originalMessage.getFrom());
attrs.put(SCAN_REPLYTO_KEY, originalMessage.getReplyTo());
!
! //attrs.put("to" , originalMessage.getAllRecipients());
! //attrs.put(SCAN_TO_KEY, originalMessage.getSubject());
if (disposition == null) {
--- 401,405 ----
attrs.put(SCAN_FROM_KEY, originalMessage.getFrom());
attrs.put(SCAN_REPLYTO_KEY, originalMessage.getReplyTo());
! //attrs.put(SCAN_TO_KEY , originalMessage.getAllRecipients());
if (disposition == null) {
***************
*** 408,412 ****
//store all attributes
! //TODO: This should be done more clever then this
attrs.put("contentType", "text/plain");
attrs.put(ScannerWorker.FILE_NAME_KEY, originalMessage.getSubject());
--- 415,419 ----
//store all attributes
! //TODO: This should be done more clever than this
attrs.put("contentType", "text/plain");
attrs.put(ScannerWorker.FILE_NAME_KEY, originalMessage.getSubject());
|