Thread: [Comsuite-svn] SF.net SVN: comsuite: [129] trunk/code/CSMiddleware/src/org/commsuite
Brought to you by:
zduniak
|
From: <mal...@us...> - 2006-09-04 23:20:07
|
Revision: 129
http://svn.sourceforge.net/comsuite/?rev=129&view=rev
Author: malinowskirafal
Date: 2006-09-04 16:19:25 -0700 (Mon, 04 Sep 2006)
Log Message:
-----------
more javaDoc
Modified Paths:
--------------
trunk/code/CSMiddleware/src/org/commsuite/converter/CalcToPdfConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/Converter.java
trunk/code/CSMiddleware/src/org/commsuite/converter/ConverterBuilder.java
trunk/code/CSMiddleware/src/org/commsuite/converter/DrawToPdfConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/HtmlToPdfConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverter.java
trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/ImpressToPdfConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/OpenOfficeToPdfConverter.java
trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverter.java
trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverter.java
trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/WriterToPdfConverterDescriptor.java
trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OpenOfficeRunner.java
trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OutputStreamToXOutputStreamAdapter.java
trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java
trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java
trunk/code/CSMiddleware/src/org/commsuite/devices/OutboundMessage.java
trunk/code/CSMiddleware/src/org/commsuite/devices/ReceiveListener.java
trunk/code/CSMiddleware/src/org/commsuite/devices/SendStateChangeListener.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxInboundMessage.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/ReceivePollingJob.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/SendStateChangedPollingJob.java
trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java
trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsDevice.java
trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsService.java
trunk/code/CSMiddleware/src/org/commsuite/messaging/Filter.java
trunk/code/CSMiddleware/src/org/commsuite/messaging/filters/SpamFilter.java
trunk/code/CSMiddleware/src/org/commsuite/notification/AbstractNotificationConsumer.java
trunk/code/CSMiddleware/src/org/commsuite/notification/INotificationsManager.java
trunk/code/CSMiddleware/src/org/commsuite/notification/JMSNotificationsManager.java
trunk/code/CSMiddleware/src/org/commsuite/util/IOUtil.java
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/CalcToPdfConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/CalcToPdfConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/CalcToPdfConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -34,6 +34,9 @@
*/
public class CalcToPdfConverterDescriptor extends SimpleConverterDescriptor {
+ /**
+ * List of mime types accepted by this converter.
+ */
private static List<String> inMimeTypes;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/Converter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/Converter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/Converter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -54,7 +54,14 @@
public class Converter {
private static final Logger logger = Logger.getLogger(Converter.class);
+ /**
+ * Chain of converters used to perfom complicated (multi-step) conversions.
+ */
private List<SimpleConverter> simpleConvertersChain;
+
+ /**
+ * Whole conversion quality.
+ */
private double quality;
/**
@@ -98,7 +105,7 @@
*
* @param content content to convert
* @return converted content
- * @throws ConversionFailedException when anything fails in piped streams or in output stream
+ * @throws ConversionFailedException when anything fails in any simple converter in chains or in output stream
*/
public byte[] convert(byte[] content) throws ConversionFailedException {
if (simpleConvertersChain == null) {
@@ -150,7 +157,7 @@
* any exception that conversion thrown. This function returns first found exception (it searchs for
* exceptions from first element in chain to last).
*
- * @return Exception thorwn during conversion or null if everything was ok.
+ * @return Throwable thorwn during conversion or null if everything was ok.
*/
public Throwable getThrowable() {
if (simpleConvertersChain == null) {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/ConverterBuilder.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/ConverterBuilder.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/ConverterBuilder.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -44,15 +44,28 @@
* Node in graph of converters.
*/
private class ConvertersGraphNode {
- // Converter descrived by node.
+ /**
+ * Converter descrived by node.
+ */
private SimpleConverterDescriptor converter;
- // Quality of conversion from given mimetype to the node, 0 if none
+ /**
+ * Quality of conversion from given mimetype to the node, 0 if none
+ */
private double quality;
- // In search mode it pointers to previous node in best path from given mimetype to this node.
+ /**
+ * In search mode it pointers to previous node in best path from given mimetype to this node.
+ */
private ConvertersGraphNode prevNode;
- // Used to prevent cycles: true, if node is in current path.
+ /**
+ * Used to prevent cycles: true, if node is in current path.
+ */
private boolean locked;
+ /**
+ * Creates node for converter. Node's parameters are reseted.
+ *
+ * @param converter converted to made node from
+ */
private ConvertersGraphNode(SimpleConverterDescriptor converter) {
this.converter = converter;
reset();
@@ -74,22 +87,40 @@
* Wraper around chain of converters, contains also quality of conversion.
*/
private class ConverterInfo {
+ /**
+ * Convertes chain.
+ */
private List<SimpleConverterDescriptor> converterChain;
+ /**
+ * Convertes quality.
+ */
private double quality;
+ /**
+ * Creates ConverterInfo instance with chain and quality.
+ *
+ * @param converterChain converterChain described by ConvertedInfo
+ * @param quality quality of converterChain
+ */
private ConverterInfo(List<SimpleConverterDescriptor> converterChain, double quality) {
this.converterChain = converterChain;
this.quality = quality;
}
}
- // List of available convertes joined into a directed graph.
+ /**
+ * List of available convertes joined into a directed graph.
+ */
private List<ConvertersGraphNode> converters;
- // for each node ancestor is a node which accepts output from given node
+ /**
+ * For each node ancestor is a node which accepts output from given node
+ */
private Map<ConvertersGraphNode, List<ConvertersGraphNode>> ancestors;
- // cache: already computed ConvertedInfo's for given Conversions
+ /**
+ * Cache: already computed ConvertedInfo's for given Conversions
+ */
private Map<Conversion, ConverterInfo> cache;
/**
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/DrawToPdfConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/DrawToPdfConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/DrawToPdfConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -32,6 +32,10 @@
* @author Rafał Malinowski
*/
public class DrawToPdfConverterDescriptor extends SimpleConverterDescriptor {
+
+ /**
+ * List of mime types accepted by this converter.
+ */
private static List<String> inMimeTypes;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/HtmlToPdfConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/HtmlToPdfConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/HtmlToPdfConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -33,6 +33,9 @@
*/
public class HtmlToPdfConverterDescriptor extends SimpleConverterDescriptor {
+ /**
+ * List of mime types accepted by this converter.
+ */
private static List<String> inMimeTypes;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -51,6 +51,8 @@
/**
* Do the conversion. Conversion's input and output streams are set in SimpleConverter.setStreams.
* If input image is transparent, then int output transparency is converted to white color.
+ *
+ * @throws Exception if any exception occurred during conversion
*/
public void convert() throws Exception {
BufferedImage image = ImageIO.read(getContentStream());
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/ImageToImageConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -38,7 +38,15 @@
* @author Rafał Malinowski
*/
public class ImageToImageConverterDescriptor extends SimpleConverterDescriptor {
+
+ /**
+ * List of mime types accepted by this converter.
+ */
private static List<String> inMimeTypes;
+
+ /**
+ * Image type produced by this converer (BMP, PNG, JPEG - any accepted by ImageIO).
+ */
private String outType;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/ImpressToPdfConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/ImpressToPdfConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/ImpressToPdfConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -32,6 +32,10 @@
* @author Rafał Malinowski
*/
public class ImpressToPdfConverterDescriptor extends SimpleConverterDescriptor {
+
+ /**
+ * List of mime types accepted by this converter.
+ */
private static List<String> inMimeTypes;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/OpenOfficeToPdfConverter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/OpenOfficeToPdfConverter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/OpenOfficeToPdfConverter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -38,7 +38,7 @@
private String filterName;
/**
- * Creates converter for OpenOffice.org using filterName as filter name.
+ * Creates converter for OpenOffice.org using filterName as OOo's filter name.
*
* @param filterName filter name for OpenOffice.org
*/
@@ -49,6 +49,8 @@
/**
* Converts document using OpenOfficeRunner.performConversion method. Content and result stream of conversion are
* set in SimpleConverer:setStreams.
+ *
+ * @throws Exception if any exception occured during conversion
*/
public void convert() throws Exception {
InputStream content = getContentStream();
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -35,10 +35,19 @@
public abstract class SimpleConverter extends Thread {
private static final Logger logger = Logger.getLogger(SimpleConverter.class);
+ /**
+ * Input data stream.
+ */
private InputStream contentStream;
+
+ /**
+ * Output (converted) data stream.
+ */
private OutputStream resultStream;
- // exception thorwn during conversion
+ /**
+ * Exception thorwn during conversion
+ */
private Throwable throwable;
/**
@@ -98,7 +107,9 @@
}
/**
- * Perfrom actual conversion
+ * Perfrom actual conversion.
+ *
+ * @throws Excepton if any exception occured during conversion
*/
public abstract void convert() throws Exception;
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/SimpleConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -33,8 +33,20 @@
* @author Rafał Malinowski
*/
public abstract class SimpleConverterDescriptor {
+
+ /**
+ * List of mime types accepted by this converter.
+ */
private List<String> inMimeTypes;
+
+ /**
+ * Mime type produced by this converter.
+ */
private String outMimeType;
+
+ /**
+ * Quality of converter. Quality is a real number in range [0.0, 1.0]. 0.0 means no conversion, 1.0 means conversion without loss of information.
+ */
private double quality;
/**
@@ -54,7 +66,7 @@
* Empty init method. To override. Implementations should initialize all external object needed to perform
* conversions.
*/
- public void init() {
+ public void init() {
}
/**
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -90,7 +90,7 @@
/**
* Initialization.
*
- * @throws IOException
+ * @throws IOException when input stream of converter is invalid and cannot be decoded into valid tiff object
*/
private void prepareData() throws IOException {
inputStream = new MemoryCacheSeekableStream(getContentStream());
@@ -107,7 +107,7 @@
* @param directory tiff directory
* @param tags list of all tags
* @param tag resolution tag
- * @return tag data
+ * @return tag data with tag index within directory
*/
private String getStringTagFromTiff(TIFFDirectory directory, List<Integer> tags, int tag) {
if (tags.contains(tag)) {
@@ -118,12 +118,12 @@
}
/**
- * Read resolution tag from Tiff directory.
+ * Read resolution value from Tiff directory.
*
* @param directory tiff directory
* @param tags list of all tags
* @param tag resolution tag
- * @return resolution
+ * @return tiff resolution
*/
private double getResolutionTagFromTiff(TIFFDirectory directory, List<Integer> tags, int tag) {
if (tags.contains(tag)) {
@@ -140,9 +140,9 @@
}
/**
- * Reads all needed tags - Tiff description and keywords (from hylafax it means: source of Tiff and keywords).
+ * Reads all needed tags- Tiff description and keywords (from hylafax it means: source of Tiff and keywords).
*
- * @throws IOException when get tag from Tiff file fails.
+ * @throws IOException when getting any of tags from Tiff file fails.
*/
private void readTags() throws IOException {
TIFFDirectory directory = new TIFFDirectory(inputStream, 0);
@@ -180,8 +180,8 @@
* Converts tiff subimage (page) to PDF page and joins it to PDF document.
*
* @param image tiff subimage (page)
- * @throws FileNotFoundException
- * @throws IOException
+ * @throws FileNotFoundException if error occured during JAI operations
+ * @throws IOException if error occured during JAI operations
*/
private void convertPage(RenderedImage image) throws FileNotFoundException, IOException {
PDFPage page = new PDFPage();
@@ -214,6 +214,8 @@
/**
* Converts tiff to pdf - uses streams set in setStreams.
+ *
+ * @throws Exception if any exception occured during conversion
*/
public void convert() throws Exception {
prepareData();
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/TiffToPdfConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -30,6 +30,10 @@
* @author Rafał Malinowski
*/
public class TiffToPdfConverterDescriptor extends SimpleConverterDescriptor {
+
+ /**
+ * List of mime types accepted by this converter.
+ */
private static List<String> inMimeTypes;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/WriterToPdfConverterDescriptor.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/WriterToPdfConverterDescriptor.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/WriterToPdfConverterDescriptor.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -32,6 +32,10 @@
* @author Rafał Malinowski
*/
public class WriterToPdfConverterDescriptor extends SimpleConverterDescriptor {
+
+ /**
+ * List of mime types accepted by this converter.
+ */
private final static List<String> inMimeTypes;
static {
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OpenOfficeRunner.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OpenOfficeRunner.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OpenOfficeRunner.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -50,9 +50,20 @@
*/
public class OpenOfficeRunner {
private static final Logger logger = Logger.getLogger(OpenOfficeRunner.class);
+
+ /**
+ * Count of requests to use OOo instance.
+ */
private static int count = 0;
+ /**
+ * UNO component context.
+ */
private static XComponentContext xRemoteContext = null;
+
+ /**
+ * UNO component loader.
+ */
private static XComponentLoader xComponentLoader = null;
/**
@@ -74,6 +85,13 @@
}
}
+ /**
+ * Creates properties to use as input properties to UNO/OOo.
+ *
+ * @param source input data stream
+ * @return PropertyValue array of properties needed by UNO/OOo
+ * @throws IOException when source input stream cannot be convert to byte array (it is needed becouse of unknow bug in UNO wrappers)
+ */
private static PropertyValue[] makeInProperties(InputStream source) throws IOException {
PropertyValue inProperties[] = new PropertyValue[3];
@@ -92,7 +110,15 @@
return inProperties;
}
-
+
+ /**
+ * Creates properties to use as output properties to UNO/OOo.
+ *
+ * @param source output data stream
+ * @param String filterName filterName to use by OOo (like Writer_pdf_filter or Calc_pdf_filter)
+ * @return PropertyValue array of properties needed by UNO/OOo
+ * @throws IOException when any IOException occured during writing/flushing or closing destination
+ */
private static PropertyValue[] makeOutProperties(OutputStream destination, String filterName) {
PropertyValue outProperties[] = new PropertyValue[3];
@@ -109,6 +135,12 @@
return outProperties;
}
+ /**
+ * Creates XComponentLoader instance needed for UNO wrapper.
+ *
+ * @return XComponentLoader instance
+ * @throws Exception if any UNO exception occured during requesting XComponentLoader
+ */
private static XComponentLoader getComponentLoader() throws Exception {
if (null != xComponentLoader) {
return xComponentLoader;
@@ -160,6 +192,11 @@
}
}
+ /**
+ * Returns XComponentContext instance needed by UNO wrapper. Use cached instance, so only one is used in whole system.
+ *
+ * @return XComponentContext instance or null if none can be created.
+ */
private synchronized static XComponentContext getXRemoteContext() {
if (null == xRemoteContext) {
try {
@@ -172,11 +209,17 @@
return xRemoteContext;
}
+ /**
+ * Resets xRemoteContext and xComponentLoader after each crach (Exception) so UNO/OOo will reinitialize these objects.
+ */
private static void reset() {
xRemoteContext = null;
xComponentLoader = null;
}
+ /**
+ * Shutdowns OOo instance (if runned).
+ */
private synchronized static void stop() {
logger.info("Terminate OORunner");
Modified: trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OutputStreamToXOutputStreamAdapter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OutputStreamToXOutputStreamAdapter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/converter/utils/openoffice/OutputStreamToXOutputStreamAdapter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -50,6 +50,9 @@
* Writes buffer's data to outputStream.
*
* @param buffer data to write
+ * @throws NotConnectedException when application is not connected to OOo server
+ * @throws BufferSizeExceededException when buffer size was exceeded in output stream
+ * @throws IOException when an error occured during writing to outputStream
*/
public void writeBytes(byte[] buffer) throws NotConnectedException, BufferSizeExceededException, IOException {
try {
@@ -61,6 +64,9 @@
/**
* Flushes buffer's data to outputStream.
+ * @throws NotConnectedException when application is not connected to OOo server
+ * @throws BufferSizeExceededException when buffer size was exceeded in output stream
+ * @throws IOException when an error occured during flushing outputStream
*/
public void flush() throws NotConnectedException, BufferSizeExceededException, IOException {
try {
@@ -72,6 +78,9 @@
/**
* Closes output stream.
+ * @throws NotConnectedException when application is not connected to OOo server
+ * @throws BufferSizeExceededException when buffer size was exceeded in output stream
+ * @throws IOException when an error occured during closing outputStream
*/
public void closeOutput() throws NotConnectedException, BufferSizeExceededException, IOException {
try {
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -107,11 +107,15 @@
/**
* Initialize device. Returns true if operation succesed.
+ *
+ * @throws DeviceInitializationFailedException if device initialization failed
*/
public abstract void init() throws DeviceInitializationFailedException;
/**
* Shutdowns device. Returns true if operation succesed.
+ *
+ * @throws DeviceShutdownFailedException if device shutdown failed
*/
public abstract void shutdown() throws DeviceShutdownFailedException;
@@ -122,6 +126,13 @@
/**
* Sends message to receiver.
+ *
+ * @throws DeviceInvalidOutboundMessageException if message was created by another device
+ * @throws OutboundMessageInvalidContentMimeTypeException if device cannot send messages with gived mime type
+ * @throws OutboundMessageInvalidContentException if device cannot send messages with given content
+ * @throws OutboundMessageInvalidDestinationAddressException if message cannot send messages to given destination
+ * @throws OutboundMessageSendException if any error occured during sending mesages
+ * @throws OutboundMessageConversionFailedException if any error occured dugins conversion of message content to acceptable format
*/
public abstract void send(OutboundMessage message)
throws DeviceInvalidOutboundMessageException,
@@ -135,6 +146,8 @@
* REFACTOR: wydaje mi sie, ze zarowno ta metoda jak i nastepna powinny znaleźć się w jakiejś
* klasie proxy między klasą Device a interfejsem SAP-CS. Po prostu nie wydaje mi się, aby to
* była dobra enkapsulacja.
+ *
+ * @param message message to send
*/
public void send(Message message) {
final List<SentContent> sentContents = message.getSentContents();
@@ -147,6 +160,12 @@
}
}
+ /**
+ * Sends simpel message to receiver. Saves send status into database.
+ *
+ * @param sentContent sentContent to send
+ * @param receiver destination address
+ */
private void sendSimpleMessage(SentContent sentContent, String receiver) {
// final SentContentManager sentContentManager = SpringMiddlewareContext
// .getSentContentManager();
@@ -289,8 +308,8 @@
* Returns system-unique id of message with messageId. It consists of name of device, type of
* message and message id.
*
- * @param inbound
- * @param messageId
+ * @param inbound true if message is inbound, false if it is outbound
+ * @param messageId messageId to convert
* @return System unique message id.
*/
public String getInternallId(boolean inbound, String messageId) {
@@ -326,6 +345,9 @@
/**
* If notifications says that message failed and it was send less that 3 times try to sent it one more time.
* Else, notifies all listeners about SendStateChange event.
+ *
+ * @param messageId messageId of message whose send state changes
+ * @param state current state of message
*/
public void notifySendStateChange(String messageId, OutboundMessage.State state) {
logger.debug("send state changed");
@@ -359,6 +381,8 @@
/**
* Notifies all listeners about Receive event.
+ *
+ * @param message received message
*/
public void notifyReceive(InboundMessage message) {
logger.debug("message received from " + message.getSourceAddress() + " to " + message.getDestinationAddress());
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -198,6 +198,8 @@
/**
* Adds new listener of receiving messages.
+ *
+ * @param receiveListener listener to add
*/
public void addReceiveListener(ReceiveListener receiveListener) {
synchronized (receiveListeners) {
@@ -207,6 +209,8 @@
/**
* Removes listener of receiving messages.
+ *
+ * @param receiveListener listener to remove
*/
public void removeReceiveListener(ReceiveListener receiveListener) {
synchronized (receiveListeners) {
@@ -216,6 +220,8 @@
/**
* Adds new listener of chaning outbound message state.
+ *
+ * @param sendStateChangeListener listener to add
*/
public void addSendStateChangeListener(SendStateChangeListener sendStateChangeListener) {
synchronized (sendStateChangeListeners) {
@@ -225,6 +231,8 @@
/**
* Removes listener of chaning outbound message state.
+ *
+ * @param sendStateChangeListener listener to remove
*/
public void removeSendStateChangeListener(SendStateChangeListener sendStateChangeListener) {
synchronized (sendStateChangeListeners) {
@@ -235,6 +243,8 @@
/**
* Function invoked when one of devices managed by this manager receives message.
* This function calls all receive listeners onReceive functions.
+ *
+ * @param document received message
*/
public void onReceive(InboundMessage document) {
synchronized (receiveListeners) {
@@ -247,6 +257,9 @@
/**
* Function invoked when one of devices managed by this manager receives status changednotification.
* This function calls all receive listeners onSendStateChange functions.
+ *
+ * @param messageId messageId of message whose send state changed
+ * @param state current state of message
*/
public void onSendStateChange(String messageId, State state) {
synchronized (sendStateChangeListeners) {
@@ -256,10 +269,21 @@
}
}
+ /**
+ * Registers device in exDevRegister.
+ *
+ * @param device device to register.
+ */
private void registerDevice(Device device) {
exDevRegister.registerNewDevice(device);
}
+
+ /**
+ * Unegisters device from exDevRegister.
+ *
+ * @param device device to unregister.
+ */
private void unregisterDe...
[truncated message content] |
|
From: <mal...@us...> - 2006-09-19 18:21:25
|
Revision: 137
http://svn.sourceforge.net/comsuite/?rev=137&view=rev
Author: malinowskirafal
Date: 2006-09-19 11:21:14 -0700 (Tue, 19 Sep 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java
trunk/code/CSMiddleware/src/org/commsuite/messaging/JMSMessageManager.java
trunk/code/CSMiddleware/src/org/commsuite/sap/SAPComm.java
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java 2006-09-19 12:37:26 UTC (rev 136)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java 2006-09-19 18:21:14 UTC (rev 137)
@@ -113,6 +113,7 @@
Throwable t = getConverter().getThrowable();
if (t != null) {
+ faxDevice.closeConnection(hylaFAXClient);
throw new OutboundMessageConversionFailedException(t);
}
@@ -129,6 +130,7 @@
hylafaxJob.setKilltime("000159");
hylaFAXClient.submit(hylafaxJob);
+ faxDevice.closeConnection(hylaFAXClient);
}
catch (IOException e) {
logger.error("cannot send, IOException", e);
Modified: trunk/code/CSMiddleware/src/org/commsuite/messaging/JMSMessageManager.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/messaging/JMSMessageManager.java 2006-09-19 12:37:26 UTC (rev 136)
+++ trunk/code/CSMiddleware/src/org/commsuite/messaging/JMSMessageManager.java 2006-09-19 18:21:14 UTC (rev 137)
@@ -56,7 +56,8 @@
return;
}
- final Queue queue = createQueue(queueName);
+// final Queue queue = createQueue(queueName);
+ final Queue queue = getQueueByName(queueName);
final JmsTemplate template = getTemplate();
template.send(queue, new MessageCreator() {
Modified: trunk/code/CSMiddleware/src/org/commsuite/sap/SAPComm.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/sap/SAPComm.java 2006-09-19 12:37:26 UTC (rev 136)
+++ trunk/code/CSMiddleware/src/org/commsuite/sap/SAPComm.java 2006-09-19 18:21:14 UTC (rev 137)
@@ -53,6 +53,10 @@
* @author Agnieszka Wiśniewska
*/
public class SAPComm implements ISAPComm {
+
+ private MessageManager msgManager;
+
+ private JMSMessageManager jmsManager;
private long SX_OBJECT_RECEIVE_functionsNumber;
@@ -203,8 +207,13 @@
final Message[] messages = JCoFunctionTranslator.getMessagesFromJCOFunction(
function, charset);
- final MessageManager msgManager = SpringMiddlewareContext.getMessageManager();
- final JMSMessageManager jmsManager = SpringMiddlewareContext.getJMSManager();
+ if (null == msgManager) {
+ msgManager = SpringMiddlewareContext.getMessageManager();
+ }
+
+ if (null == jmsManager) {
+ jmsManager = SpringMiddlewareContext.getJMSManager();
+ }
final Date currentDate = new Date();
for (Message msg : messages) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zd...@us...> - 2006-09-23 12:42:36
|
Revision: 150
http://svn.sourceforge.net/comsuite/?rev=150&view=rev
Author: zduniak
Date: 2006-09-23 05:42:16 -0700 (Sat, 23 Sep 2006)
Log Message:
-----------
Some other small improvements in code (preparation to implementation of incoming messages simulator)
Modified Paths:
--------------
trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java
trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/FaxDevicePolling.java
trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/ReceivePollingJob.java
trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java
trunk/code/CSMiddleware/src/org/commsuite/notification/ReceiveNotifier.java
trunk/code/CSMiddleware/src/org/commsuite/util/SpringMiddlewareBeansConstants.java
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/Device.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -33,7 +33,6 @@
import org.commsuite.model.Message;
import org.commsuite.model.SentContent;
import org.commsuite.util.RandomGUID;
-//import org.commsuite.util.SpringMiddlewareContext;
/**
* Device for sending/receiving messages.
@@ -385,7 +384,7 @@
* @param message received message
*/
public void notifyReceive(InboundMessage message) {
- logger.debug("message received from " + message.getSourceAddress() + " to " + message.getDestinationAddress());
+ logger.debug("Message received from " + message.getSourceAddress() + " to " + message.getDestinationAddress());
messagesReceived++;
synchronized (receiveListeners) {
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/DeviceManager.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -72,8 +72,8 @@
/**
* @see IDeviceManager.setDevices(List<Device>)
*/
- public void setDevices(List<Device> devices) {
- for (final Device device : devices) {
+ public void setDevices(List<Device> localDevices) {
+ for (final Device device : localDevices) {
if (device.getName() == null) {
logger.error("Null device name");
// REVIEW: [RM] Maybe some exception should be thrown here?
@@ -81,7 +81,7 @@
}
if (!deviceNames.contains(device.getName())) {
- this.devices.add(device);
+ devices.add(device);
device.addReceiveListener(this);
device.addSendStateChangeListener(this);
deviceNames.add(device.getName());
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -72,6 +72,7 @@
* @param args
* @throws Exception
*/
+ @Deprecated
public static void main(String[] args) throws Exception {
Device device = new FaxDevicePolling("fax001");
@@ -178,6 +179,7 @@
*
* @throws DeviceInitializationFailedException when device is already initialized, is initializing or when connection with HylaFAX server failed
*/
+ @Override
public void init() throws DeviceInitializationFailedException {
logger.info("Fax device: " + getName() + " initializing");
@@ -191,15 +193,23 @@
setState(Device.State.INITIALIZING);
- faxClient = getNewHylaFAXClient();
+// faxClient = getNewHylaFAXClient();
+//
+// try {
+// faxClient.open(getHost());
+// faxClient.user(getUser());
+//
+// faxClient.type(HylaFAXClient.TYPE_IMAGE);
+// faxClient.mode(HylaFAXClient.MODE_ZLIB);
+// faxClient.jparm("NOTIFY", HylaFAXClient.NOTIFY_NONE);
+// } catch (Exception e) {
+// logger.fatal("", e);
+// setState(Device.State.OFF);
+// throw new DeviceInitializationFailedException(e);
+// }
try {
- faxClient.open(getHost());
- faxClient.user(getUser());
-
- faxClient.type(HylaFAXClient.TYPE_IMAGE);
- faxClient.mode(HylaFAXClient.MODE_ZLIB);
- faxClient.jparm("NOTIFY", HylaFAXClient.NOTIFY_NONE);
+ faxClient = getConnection();
} catch (Exception e) {
logger.fatal("", e);
setState(Device.State.OFF);
@@ -227,6 +237,7 @@
*
* @throws DeviceShutdownFailedException when device is not initialized or closing connection fails
*/
+ @Override
public void shutdown() throws DeviceShutdownFailedException {
// not initialized - cannot shutdown
if (getState() != Device.State.ON) {
@@ -244,7 +255,7 @@
}
try {
- faxClient.quit();
+ closeConnection(faxClient);
} catch (Exception e) {
faxClient = null;
logger.error(getName() + ": faxClient.quit() failed", e);
@@ -299,6 +310,7 @@
* @throws OutboundMessageInvalidContentException when message has no content.
* @throws OutboundMessageInvalidDestinationAddressException when message has no destination address.
*/
+ @Override
public void send(OutboundMessage message) throws
DeviceInvalidOutboundMessageException, OutboundMessageInvalidContentMimeTypeException,
OutboundMessageInvalidContentException, OutboundMessageInvalidDestinationAddressException,
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/FaxDevicePolling.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/FaxDevicePolling.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/FaxDevicePolling.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -55,6 +55,7 @@
*
* @throws DeviceInitializationFailedException when quarts fails
*/
+ @Override
protected void initNotification() throws DeviceInitializationFailedException {
final SchedulerFactory shedulerFactory = new org.quartz.impl.StdSchedulerFactory();
final JobDetail receivePollingJobDetail = new JobDetail(getName() + "_receivePollingJobDetail", null, ReceivePollingJob.class);
@@ -88,6 +89,7 @@
*
* @throws DeviceInitializationFailedException when quarts fails
*/
+ @Override
protected void shutdownNotification() throws DeviceShutdownFailedException {
try {
scheduler.shutdown(true);
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/ReceivePollingJob.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/ReceivePollingJob.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/ReceivePollingJob.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -35,6 +35,7 @@
import org.commsuite.devices.fax.FaxInboundMessage;
import org.commsuite.devices.fax.FaxInboundMessageCreateException;
import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;
/**
@@ -72,11 +73,11 @@
* FaxInboundMessage is created and FaxDevice is notified about it (notifyReceive). After downloading file is deleted from server
* so it won't be downloaded again in next iteration of job.
*
- * @see FaxDevice.notifyReceive
+ * @see FaxDevice#notifyReceive(org.comsuite.devices.InboundMessage)
* @param context job context, contains FaxDevice
*/
- public void execute(JobExecutionContext context) {
- final FaxDevice faxDevice = (FaxDevice) (context.getJobDetail().getJobDataMap().get("FaxDevice"));
+ public void execute(JobExecutionContext context) throws JobExecutionException {
+ final FaxDevice faxDevice = (FaxDevice) context.getJobDetail().getJobDataMap().get("FaxDevice");
final HylaFAXClient hylafaxClient;
try {
@@ -105,33 +106,31 @@
if (m.matches()) {
// ignore receiving faxes
// only notify about received
- if (m.group(1).trim().equals("*")) {
+ if ("*".equals(m.group(1).trim())) {
continue;
}
final String faxFileName = m.group(2).trim();
-
- final int receivedFaxId = Integer.valueOf(m.group(3).trim()).intValue();
+ final String receivedFaxIdStr = m.group(3).trim();
final String faxFileAddress = m.group(4).trim();
try {
-
- logger.info("new fax: " + faxFileDescription + ", notify");
+ logger.info("New fax: " + faxFileDescription + ", notify");
// logger.info(faxDevice.getName() + ": new fax: " + faxFileDescription
// + ", notify");
// unable to set anyting useful to destinationAddress here
// needs hylafax update ?
final FaxInboundMessage inboundMessage = new FaxInboundMessage(faxDevice, hylafaxClient,
- Integer.toString(receivedFaxId), faxFileAddress, null, "image/tiff",
+ receivedFaxIdStr, faxFileAddress, null, "image/tiff",
"recvq/" + faxFileName);
faxDevice.notifyReceive(inboundMessage);
} catch (FaxInboundMessageCreateException e) {
- logger.fatal("creating FaxInboundMessage failed, it is impossible", e);
+ logger.fatal("Creating FaxInboundMessage failed, it is impossible", e);
}
} else {
- logger.warn("wrong file description: " + faxFileDescription);
+ logger.warn("Wrong file description: " + faxFileDescription);
// logger.warn(faxDevice.getName() + ": wrong file description: " +
// faxFileDescription);
}
@@ -140,16 +139,16 @@
logger.fatal("Directory recvq not found!", e);
// logger.fatal(faxDevice.getName() + ": directory recvq not found!", e);
} catch (IOException e) {
- logger.error(faxDevice.getName(), e);
+ logger.error("Fax: " + faxDevice.getName(), e);
} catch (ServerResponseException e) {
- logger.error(faxDevice.getName(), e);
+ logger.error("Fax: " + faxDevice.getName(), e);
} finally {
try {
faxDevice.closeConnection(hylafaxClient);
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("Fax: " + faxDevice.getName(), e);
} catch (ServerResponseException e) {
- e.printStackTrace();
+ logger.error("Fax: " + faxDevice.getName(), e);
}
}
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -3,8 +3,6 @@
import java.util.LinkedList;
import java.util.List;
-import javolution.util.FastList;
-
import org.apache.log4j.Logger;
import org.commsuite.devices.fax.FaxDevice;
import org.quartz.JobExecutionContext;
Modified: trunk/code/CSMiddleware/src/org/commsuite/notification/ReceiveNotifier.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/notification/ReceiveNotifier.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/notification/ReceiveNotifier.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -113,11 +113,11 @@
// priority 4 is the default one:
message.setPriority(Priority.LEVEL_4);
- if (null == document.getDestinationAddress())
+ if (null == document.getDestinationAddress()) {
message.setReceiver("(unknown)");
- else
+ } else {
message.setReceiver(document.getDestinationAddress());
-
+ }
message.setSapID(RandomGUID.getGUID());
// TODO: [RM] dla SMSow data odebrania SMSa przez nas system wcale nie musi byc zblizona
@@ -145,10 +145,6 @@
return;
}
- // TODO: [MM] Message should be send to MSAPIN JMS queue hera, and this consumer
- // of this queue should be responsible of invoking sendMessageToDefault() method.
- // See Mantis issue 1464 for further details.
- // DONE
jmsMessageManager.sendMessage(SpringMiddlewareBeansConstants.M_SAP_IN_QUEUE_NAME, message);
}
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/util/SpringMiddlewareBeansConstants.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/util/SpringMiddlewareBeansConstants.java 2006-09-23 12:11:16 UTC (rev 149)
+++ trunk/code/CSMiddleware/src/org/commsuite/util/SpringMiddlewareBeansConstants.java 2006-09-23 12:42:16 UTC (rev 150)
@@ -21,7 +21,7 @@
package org.commsuite.util;
/**
- * class with String contains some names
+ * Class with String contains some names.
*
* @since 1.0
* @author Marek Musielak
@@ -29,40 +29,10 @@
*/
public class SpringMiddlewareBeansConstants {
-// public final static String ACEGI_MEMORY_AUTHENTICATION = "memoryAuthentication";
-
-// public final static String ACEGI_DAO_AUTHENTICATION_PROVIDER = "daoAuthenticationProvider";
-
-// public final static String ACEGI_AUTHENTICATION_MANAGER = "authenticationManager";
-
-// public final static String ACEGI_AUTHENTICATION_PROCESSING_FILTER = "authenticationProcessingFilter";
-
-// public final static String ACEGI_ROLE_VOTER = "roleVoter";
-
-// public final static String ACEGI_ACCESS_DECISION_MANAGER = "accessDecisionManager";
-
-// public final static String ACEGI_EXCEPTION_TRANSLATION_FILTER = "exceptionTranslationFilter";
-
-// public final static String ACEGI_HTTP_SESSION_CONTEXT_INTEGRATION_FILTER = "httpSessionContextIntegrationFilter";
-
-// public final static String ACEGI_AUTHENTICATION_ENTRY_POINT = "authenticationEntryPoint";
-
-// public final static String ACEGI_FILTER_INVOCATION_INTERCEPTOR = "filterInvocationInterceptor";
-
-// public final static String ACEGI_FILTER_CHAIN_PROXY = "filterChainProxy";
-
-// public final static String ACTIVEMQ_BROKER = "activeMQBroker";
-
-// public final static String ACTIVEMQ_JMS_FACTORY = "jmsFactory";
-
public final static String ACTIVEMQ_JMS_TEMPLATE = "jmsTemplate";
public final static String ACTIVEMQ_JMS_MESSAGES_MANAGER = "jmsMessagesManager";
-// public final static String APPLICATION_CONTEXT_PROPERTY_CONFIGURER = "propertyConfigurer";
-
-// public final static String DATA_SOURCE = "dataSource";
-
public final static String DEVICE_MANAGER = "deviceManager";
public final static String HIBERNATE_USER_DAO = "userDao";
@@ -81,48 +51,24 @@
public final static String HIBERNATE_SENT_CONTENT_DAO = "sentContentDao";
-// public final static String HIBERNATE_USER_MANAGER_TARGET = "userManagerTarget";
-
public final static String HIBERNATE_USER_MANAGER = "userManager";
-// public final static String HIBERNATE_ACTION_MANAGER_TARGET = "actionManagerTarget";
-
public final static String HIBERNATE_ACTION_MANAGER = "actionManager";
-// public final static String HIBERNATE_CONTENTS_MANAGER_TARGET = "contentsManagerTarget";
-
public final static String HIBERNATE_CONTENTS_MANAGER = "contentsManager";
-// public final static String HIBERNATE_SENT_CONTENT_MANAGER_TARGET = "sentContentManagerTarget";
-
public final static String HIBERNATE_SENT_CONTENT_MANAGER = "sentContentManager";
-// public final static String HIBERNATE_ROLE_MANAGER_TARGET = "roleManagerTarget";
-
public final static String HIBERNATE_ROLE_MANAGER = "roleManager";
-// public final static String HIBERNATE_GROUP_MANAGER_TARGET = "groupManagerTarget";
-
public final static String HIBERNATE_GROUP_MANAGER = "groupManager";
-// public final static String HIBERNATE_MESSAGE_MANAGER_TARGET = "messageManagerTarget";
-
public final static String HIBERNATE_MESSAGE_MANAGER = "messageManager";
-// public final static String HIBERNATE_SAP_INSTANCE_DEF_MANAGER_TARGET = "sapInstanceDefManagerTarget";
-
public final static String HIBERNATE_SAP_INSTANCE_DEF_MANAGER = "sapInstanceDefManager";
public final static String HIBERNATE_SESSION_FACTORY = "sessionFactory";
-// public final static String HIBERNATE_TRANSACTION_MANAGER = "transactionManager";
-
-// public final static String HIBERNATE_MATCH_ALL_WITH_PROP_REQ = "matchAllWithPropReq";
-
-// public final static String HIBERNATE_MATCH_ALL_TX_INTERCEPTOR = "matchAllTxInterceptor";
-
-// public final static String HIBERNATE_AUTO_PROXY_CREATOR = "autoProxyCreator";
-
public final static String SAP_COMM_MANAGER = "sapCommManager";
public final static String EX_DEV_REGISTER = "exDevRegister";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <zd...@us...> - 2006-10-04 01:41:43
|
Revision: 172
http://svn.sourceforge.net/comsuite/?rev=172&view=rev
Author: zduniak
Date: 2006-09-30 16:38:56 -0700 (Sat, 30 Sep 2006)
Log Message:
-----------
- Sorting performance improved a little bit
- Generated Message.hbm.xml file corrected
Modified Paths:
--------------
trunk/code/CSMiddleware/src/org/commsuite/model/Message.hbm.xml
trunk/code/CSMiddleware/src/org/commsuite/model/Message.java
trunk/code/CSMiddleware/src/org/commsuite/ws/services/MessagesService.java
Modified: trunk/code/CSMiddleware/src/org/commsuite/model/Message.hbm.xml
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/model/Message.hbm.xml 2006-09-30 23:28:51 UTC (rev 171)
+++ trunk/code/CSMiddleware/src/org/commsuite/model/Message.hbm.xml 2006-09-30 23:38:56 UTC (rev 172)
@@ -7,7 +7,7 @@
<id name="id">
<generator class="native">
<param name="sequence">CS_MESSAGES_SEQ</param>
- <param name="parameters">INCREMENT BY 1 START</param>
+ <param name="parameters">INCREMENT BY 1 START WITH 100</param>
</generator>
</id>
<property name="creationDate" not-null="true" type="timestamp" column="CREATION_DATE"/>
Modified: trunk/code/CSMiddleware/src/org/commsuite/model/Message.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/model/Message.java 2006-09-30 23:28:51 UTC (rev 171)
+++ trunk/code/CSMiddleware/src/org/commsuite/model/Message.java 2006-09-30 23:38:56 UTC (rev 172)
@@ -219,14 +219,16 @@
final List<SentContent> scList = new FastTable<SentContent>();
for (final SentContent sc : sentContents) {
- logger.debug("sc.getContent().getData(): " + sc.getContent().getData());
+ logger.debug("sc.getContent().getData(): "
+ + sc.getContent().getData());
final SentContent clonedSc = new SentContent();
clonedSc.setContent(sc.getContent());
clonedSc.setInternalId(RandomGUID.getGUID());
clonedSc.setState(sc.getState());
clonedSc.setMessage(this);
scList.add(clonedSc);
- logger.debug("clonedSc.getContent().getData(): " + clonedSc.getContent().getData());
+ logger.debug("clonedSc.getContent().getData(): "
+ + clonedSc.getContent().getData());
}
msg.setSentContents(scList);
@@ -236,8 +238,7 @@
/**
* @hibernate.id generator-class="native"
* @hibernate.generator-param name="sequence" value="CS_MESSAGES_SEQ"
- * @hibernate.generator-param name="parameters" value="INCREMENT BY 1 START
- * WITH 100"
+ * @hibernate.generator-param name="parameters" value="INCREMENT BY 1 START WITH 100"
*/
public Long getId() {
return super.id;
Modified: trunk/code/CSMiddleware/src/org/commsuite/ws/services/MessagesService.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/ws/services/MessagesService.java 2006-09-30 23:28:51 UTC (rev 171)
+++ trunk/code/CSMiddleware/src/org/commsuite/ws/services/MessagesService.java 2006-09-30 23:38:56 UTC (rev 172)
@@ -52,6 +52,24 @@
* @author Szymon Kuzniak
*/
public class MessagesService {
+
+ /**
+ * TODO: JavaDoc
+ */
+ private static final Comparator<Message> MESSAGES_COMPARATOR = new Comparator<Message>() {
+ public int compare(Message m1, Message m2) {
+ // Comparing m1 with m2 descending == m2 with m1 ascending:
+ final int comparisonByLastProcessDate = m2.getLastProcessDate()
+ .compareTo(m1.getLastProcessDate());
+ if (0 == comparisonByLastProcessDate) {
+ final int comparisonBySendDate = m1.getSendDate()
+ .compareTo(m1.getSendDate());
+ return comparisonBySendDate;
+ } else {
+ return comparisonByLastProcessDate;
+ }
+ }
+ };
private final MessageManager messageManager;
@@ -120,22 +138,10 @@
}
return result;
}
-
+
private void sortMessagesList(final List<Message> list) {
- Collections.sort(list, new Comparator<WSMessage>() {
- public int compare(WSMessage m1, WSMessage m2) {
- final int comparisonByLastProcessDate = m2.getLastProcessDate()
- .compareTo(m1.getLastProcessDate());
- if (0 == comparisonByLastProcessDate) {
- final int comparisonBySendDate = m1.getSendDate()
- .compareTo(m1.getSendDate());
- return comparisonBySendDate;
- } else {
- return comparisonByLastProcessDate;
- }
- }
- });
-}
+ Collections.sort(list, MESSAGES_COMPARATOR);
+ }
/**
* TODO: JavaDoc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|