|
From: <tr...@us...> - 2003-09-17 17:13:44
|
Update of /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/scanner/worker
In directory sc8-pr-cvs1:/tmp/cvs-serv31076/src/com/babeldoc/j2ee/scanner/worker
Modified Files:
JmsScanner.java
Log Message:
More work on the j2ee module - added message driven bean - missing configuration files. jms helper functions moved to new class.
Index: JmsScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/scanner/worker/JmsScanner.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** JmsScanner.java 8 Sep 2003 22:28:06 -0000 1.2
--- JmsScanner.java 17 Sep 2003 17:07:15 -0000 1.3
***************
*** 67,70 ****
--- 67,71 ----
import com.babeldoc.core.LogService;
+ import com.babeldoc.core.pipeline.feeder.FeedDocument;
import com.babeldoc.core.option.ConfigOption;
import com.babeldoc.core.option.IConfigOptionType;
***************
*** 72,75 ****
--- 73,77 ----
import com.babeldoc.scanner.ScannerWorker;
import com.babeldoc.scanner.ScannerWorkerInfo;
+ import com.babeldoc.j2ee.JmsHelper;
import javax.jms.*;
***************
*** 179,234 ****
Message m = receiver.receive(1);
if (m != null) {
! handleMessage(m);
}
}
} catch (Exception e) {
! LogService.getInstance().logError("[doScan]", e);
} finally {
try {
receiver.close();
} catch (Exception e) {
! LogService.getInstance().logError("[doScan]", e);
! }
! }
! }
!
! /**
! * Only handles text messages at the moment.
! *
! * @param m
! * @throws JMSException
! */
! private void handleMessage(Message m)
! throws JMSException {
! Map map = handleMessageMap(m);
!
! if (m instanceof TextMessage) {
! enqueue(((TextMessage)m).getText().getBytes(), map);
! } else if(m instanceof BytesMessage) {
! // Not implemented
! }
! }
!
! /**
! * Get the message map off the message.
! *
! * @param m the message in question
! * @return message map
! *
! * @throws JMSException
! */
! private Map handleMessageMap(Message m) throws JMSException {
! Map map = new HashMap();
! for(Enumeration e = m.getPropertyNames(); e.hasMoreElements();) {
! String name = (String)e.nextElement();
! String value = null;
! try {
! value = m.getStringProperty(name);
! } catch (JMSException e1) {
! LogService.getInstance().logError(e1);
}
- map.put(name, value);
}
- return map;
}
}
--- 181,197 ----
Message m = receiver.receive(1);
if (m != null) {
! FeedDocument fdoc = JmsHelper.getFeedDocument("dummy", m);
! enqueue(fdoc.getData(), fdoc.getAttributes());
}
}
} catch (Exception e) {
! LogService.getInstance().logError(e);
} finally {
try {
receiver.close();
} catch (Exception e) {
! LogService.getInstance().logError(e);
}
}
}
}
|