[Comsuite-svn] SF.net SVN: comsuite: [150] trunk/code/CSMiddleware/src/org/commsuite
Brought to you by:
zduniak
|
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.
|