[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 unregisterDevice(Device device) {
exDevRegister.unregisterDevice(device);
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/OutboundMessage.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/OutboundMessage.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/OutboundMessage.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -115,6 +115,12 @@
return converter;
}
+ /**
+ * Sets message mime type.
+ *
+ * @param contentMimeType mime type to set
+ * @return true if given mime type is supported
+ */
public boolean setContentMimeType(String contentMimeType) {
this.contentMimeType = contentMimeType;
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/ReceiveListener.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/ReceiveListener.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/ReceiveListener.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -29,6 +29,8 @@
public interface ReceiveListener {
/**
* Called when device receives new message.
+ *
+ * @param document received message
*/
void onReceive(InboundMessage document);
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/SendStateChangeListener.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/SendStateChangeListener.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/SendStateChangeListener.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -29,6 +29,9 @@
public interface SendStateChangeListener {
/**
* Called when outgoind message state changes.
+ *
+ * @param messageId messageId of message whose state changed
+ * @param state current state of message
*/
void onSendStateChange(String messageId, OutboundMessage.State state);
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxDevice.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -125,6 +125,12 @@
return new HylaFAXClient();
}
+ /**
+ * Create new connection to HylaFAX server.
+ *
+ * @return new connection to HylaFAX server.
+ * @throws DeviceInitializationFailedException when new connection cannot be created
+ */
public HylaFAXClient getConnection() throws DeviceInitializationFailedException {
HylaFAXClient faxClient = getNewHylaFAXClient();
@@ -155,6 +161,13 @@
return faxClient;
}
+ /**
+ * Closes connection to HylaFAX server.
+ *
+ * @param faxClient conenction to HylaFAX server to close
+ * @throws IOException when closing fails
+ * @throws ServerResponseException when closing fails
+ */
public void closeConnection(HylaFAXClient faxClient) throws IOException, ServerResponseException {
faxClient.quit();
}
@@ -163,7 +176,7 @@
* Connects hylafax server and login as 'root'.
* Throws DeviceInitializationFailedException when start of hylafax failed or when logging failed.
*
- * @throws DeviceInitializationFailedException
+ * @throws DeviceInitializationFailedException when device is already initialized, is initializing or when connection with HylaFAX server failed
*/
public void init() throws DeviceInitializationFailedException {
logger.info("Fax device: " + getName() + " initializing");
@@ -211,6 +224,8 @@
/**
* Closes fax connections.
+ *
+ * @throws DeviceShutdownFailedException when device is not initialized or closing connection fails
*/
public void shutdown() throws DeviceShutdownFailedException {
// not initialized - cannot shutdown
@@ -244,7 +259,7 @@
/**
* Inits receive and send-state-changes notifications. Overrided in polling and clientserver subpackages.
*
- * @throws DeviceInitializationFailedException
+ * @throws DeviceInitializationFailedException never
*/
protected void initNotification() throws DeviceInitializationFailedException {
// Empty implementation
@@ -253,7 +268,7 @@
/**
* Finalizes receive and send-state-changes notifications. Overrided in polling and clientserver subpackages.
*
- * @throws DeviceShutdownFailedException
+ * @throws DeviceShutdownFailedException never
*/
protected void shutdownNotification() throws DeviceShutdownFailedException {
// Empty implementation
@@ -268,7 +283,8 @@
/**
* Returns FaxOutboundMessage for use with this device.
- * Throws OutboundMessageCreateException when creating message failed.
+ *
+ * @throws OutboundMessageCreateException when creating message failed.
*/
public OutboundMessage createOutboundMessage() {
return new FaxOutboundMessage(this);
@@ -277,16 +293,11 @@
/**
* Sends message.
*
- * Throws DeviceInvalidOutboundMessageException when message was created in other Device.
- * Throws OutboundMessageInvalidContentMimeTypeException when device cannot send message of this type.
- * Throws OutboundMessageInvalidContentException when message has no content.
- * Throws OutboundMessageInvalidDestinationAddressException when message has no destination address.
- *
* @arg message message to send
- * @throws DeviceInvalidOutboundMessageException
- * @throws OutboundMessageInvalidContentMimeTypeException
- * @throws OutboundMessageInvalidContentException
- * @throws OutboundMessageInvalidDestinationAddressException
+ * @throws DeviceInvalidOutboundMessageException when message was created in other Device.
+ * @throws OutboundMessageInvalidContentMimeTypeException when device cannot send message of this type.
+ * @throws OutboundMessageInvalidContentException when message has no content.
+ * @throws OutboundMessageInvalidDestinationAddressException when message has no destination address.
*/
public void send(OutboundMessage message) throws
DeviceInvalidOutboundMessageException, OutboundMessageInvalidContentMimeTypeException,
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxInboundMessage.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxInboundMessage.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxInboundMessage.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -48,7 +48,8 @@
/**
* FaxDevice creates it after notification of new received Fax.
- * @throws FaxInboundMessageCreateException
+ *
+ * @throws FaxInboundMessageCreateException when inbound message is invalid, fax server's response is invalid, or fax server's response cannot be convered to pdf
*/
public FaxInboundMessage(FaxDevice device, HylaFAXClient hylaFaxClient, String messageId, String sourceAddress, String destinationAddress, String contentMimeType,
String fileName) throws FaxInboundMessageCreateException {
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/FaxOutboundMessage.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -62,9 +62,7 @@
* Creates new fax outbound message for device faxDevice.
* It creates new HylaFAX job on server and assigns it unique id.
*
- * @param faxDevice
- * @throws ServerResponseException
- * @throws IOException
+ * @param faxDevice device that own this message
*/
public FaxOutboundMessage(FaxDevice device)
{
@@ -74,10 +72,10 @@
/**
* Sends message using faxDevice set in constructor.
*
- * @throws OutboundMessageInvalidContentMimeTypeException
- * @throws OutboundMessageInvalidContentException
- * @throws OutboundMessageInvalidDestinationAddressException
- * @throws OutboundMessageConversionFailedException
+ * @throws OutboundMessageInvalidContentMimeTypeException when message's content type cannot be used with fax device
+ * @throws OutboundMessageInvalidContentException when message content is null
+ * @throws OutboundMessageInvalidDestinationAddressException when destination address is null
+ * @throws OutboundMessageConversionFailedException when message's content's conversion failed
*/
public void send() throws
OutboundMessageInvalidContentMimeTypeException, OutboundMessageInvalidContentException,
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-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/ReceivePollingJob.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -73,6 +73,7 @@
* so it won't be downloaded again in next iteration of job.
*
* @see FaxDevice.notifyReceive
+ * @param context job context, contains FaxDevice
*/
public void execute(JobExecutionContext context) {
final FaxDevice faxDevice = (FaxDevice) (context.getJobDetail().getJobDataMap().get("FaxDevice"));
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/SendStateChangedPollingJob.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/SendStateChangedPollingJob.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/fax/polling/SendStateChangedPollingJob.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -71,6 +71,9 @@
* so Device won't be notified again in next iteration of job.
*
* @see FaxDevice.notifyReceive
+ *
+ * @param context jobContext, containt FaxDevice object
+ * @throws JobExecutionException never
*/
public void execute(JobExecutionContext context) throws JobExecutionException {
final FaxDevicePolling faxDevice = (FaxDevicePolling)(context.getJobDetail().getJobDataMap().get("FaxDevice"));
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/sms/ReceivePollingJob.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -3,14 +3,27 @@
import java.util.LinkedList;
import org.apache.log4j.Logger;
+import org.commsuite.devices.fax.FaxDevice;
import org.quartz.JobExecutionContext;
import org.quartz.StatefulJob;
import org.smslib.CIncomingMessage;
+/**
+ * Quarts job to check for new received messages.
+ *
+ * @since 1.0
+ * @author Rafał Malinowski
+ */
public class ReceivePollingJob implements StatefulJob {
private static final Logger logger = Logger.getLogger(ReceivePollingJob.class);
-
+
+ /**
+ * Executes job instance. This checks device buffer for new sms message. For each SMS message SmsDevice is informed about.
+ *
+ * @see FaxDevice.notifyReceive
+ * @param context job context, contains SmsDevice
+ */
public void execute(JobExecutionContext context) {
// logger.info("execute");
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsDevice.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsDevice.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsDevice.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -153,7 +153,7 @@
/**
- * Disconnects to GSM modem.
+ * Disconnects from GSM modem.
*
* @throws DeviceShutdownFailedException when disconnection failed
*/
@@ -248,6 +248,8 @@
* Set interval in seconds.
*
* By default 30 minutes.
+ *
+ * @int warningsInterval warnings interval in seconds
*/
public void setWarningsInterval(int warningsInterval) {
this.warningsInterval = warningsInterval;
@@ -255,7 +257,8 @@
/**
* Get interval in seconds.
- * @return
+ *
+ * @return warnings interval in seconds
*/
public int getWarningsInterval() {
return warningsInterval;
@@ -368,6 +371,14 @@
}
}
+ /**
+ * Removes polish UTF character and replaces it with latin1 characters.
+ *
+ * @param text string with UTF characters
+ * @return text without UTF characters
+ *
+ * @throws UnsupportedEncodingException never
+ */
private static String removeUTFCharacters(String text) throws UnsupportedEncodingException {
logger.debug("Converting :" + text);
@@ -386,8 +397,13 @@
}
/**
+ * Send SMS message.
+ *
+ * @param text sms message to send
+ * @param phone phone address of receiver
* @return unique message-id of sent SMS
- * @throws OutboundMessageSendException
+ *
+ * @throws OutboundMessageSendException when sms device failed to send message
*/
private String sendSMSMessage(String text, String phone) throws OutboundMessageSendException {
Modified: trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsService.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsService.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/devices/sms/SmsService.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -40,6 +40,15 @@
private SmsDevice device;
+ /**
+ * Creates new SmsService
+ *
+ * @param device SMSDevice to inform about new incoming messages
+ * @param port device port
+ * @param baud device boud rate
+ * @param gsmDeviceManufacturer device gsm manufacturer
+ * @param gsmDeviceModel device gsm moel
+ */
public SmsService(SmsDevice device, String port, int baud,
String gsmDeviceManufacturer, String gsmDeviceModel) {
super(port, baud, gsmDeviceManufacturer, gsmDeviceModel);
@@ -53,6 +62,8 @@
* {@link SmsDevice#notifyReceive(org.commsuite.devices.InboundMessage)} or
* {@link SmsDevice#notifySendStateChange(String, org.commsuite.devices.OutboundMessage.State)}
* appropriately.
+ *
+ * @return true
*/
public boolean received(IIncomingMessage message) {
logger.debug("Received SMS");
Modified: trunk/code/CSMiddleware/src/org/commsuite/messaging/Filter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/messaging/Filter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/messaging/Filter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -34,7 +34,7 @@
* Process message, return true if message can be processes, false if should be canceled.
*
* @param message message to chceck
- * @return true if message can be processes
+ * @return true if message can be processed
*/
public abstract boolean processMessage(Message message);
Modified: trunk/code/CSMiddleware/src/org/commsuite/messaging/filters/SpamFilter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/messaging/filters/SpamFilter.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/messaging/filters/SpamFilter.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -24,6 +24,8 @@
/**
* If message sender is on our spamers list - drop message.
+ *
+ * @return true if message send is not on out spamers list
*/
public boolean processMessage(Message message) {
if (spamers.indexOf(message.getSender()) == -1)
Modified: trunk/code/CSMiddleware/src/org/commsuite/notification/AbstractNotificationConsumer.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/notification/AbstractNotificationConsumer.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/notification/AbstractNotificationConsumer.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -49,6 +49,8 @@
/**
* Consumes Object obj (this object is Notification) from queue and runs consumeNotification method on it.
+ *
+ * @param obj object to consume
*/
public boolean consumeQueueMessage(Object obj) {
// AbstractQueueMessageConsumer:47 - checking for object type
Modified: trunk/code/CSMiddleware/src/org/commsuite/notification/INotificationsManager.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/notification/INotificationsManager.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/notification/INotificationsManager.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -32,6 +32,9 @@
/**
* Sens notification to queue assigned to SAP server.
+ *
+ * @param sapName sap name to notify
+ * @param notification notification to send
*/
public abstract void sendNotification(String sapName, Notification notification);
Modified: trunk/code/CSMiddleware/src/org/commsuite/notification/JMSNotificationsManager.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/notification/JMSNotificationsManager.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/notification/JMSNotificationsManager.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -36,6 +36,12 @@
private final static Logger logger = Logger.getLogger(JMSNotificationsManager.class);
+ /**
+ * Returns queue name for gives sap instance name.
+ *
+ * @param sapName sap instance name
+ * @return queue name for gives sap instance name
+ */
private String queueNameFromSapName(String sapName) {
return sapName;
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/util/IOUtil.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/util/IOUtil.java 2006-09-04 22:34:12 UTC (rev 128)
+++ trunk/code/CSMiddleware/src/org/commsuite/util/IOUtil.java 2006-09-04 23:19:25 UTC (rev 129)
@@ -40,6 +40,13 @@
super();
}
+ /**
+ * Reads all data from input stream and returns byte[].
+ *
+ * @param is inpu stream to read data from
+ * @return byte[] of data from stream
+ * @throws IOException when reading data fails
+ */
public static byte[] convertIS2Bytes(InputStream is) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final byte[] buffer = new byte[1024 * 10];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|