| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.ken.service.ws.impl; |
| 17 | |
|
| 18 | |
import org.apache.log4j.Logger; |
| 19 | |
import org.kuali.rice.core.api.util.xml.XmlException; |
| 20 | |
import org.kuali.rice.ken.bo.NotificationResponse; |
| 21 | |
import org.kuali.rice.ken.service.NotificationMessageContentService; |
| 22 | |
import org.kuali.rice.ken.service.NotificationService; |
| 23 | |
import org.kuali.rice.ken.service.ws.NotificationWebService; |
| 24 | |
import org.kuali.rice.ken.util.NotificationConstants; |
| 25 | |
import org.kuali.rice.ken.util.PerformanceLog; |
| 26 | |
import org.kuali.rice.ken.util.PerformanceLog.PerformanceStopWatch; |
| 27 | |
|
| 28 | |
import java.io.IOException; |
| 29 | |
import java.rmi.RemoteException; |
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | 0 | public class NotificationWebServiceImpl implements NotificationWebService { |
| 40 | 0 | private static final Logger LOG = Logger.getLogger(NotificationWebServiceImpl.class); |
| 41 | |
|
| 42 | |
private NotificationService notificationService; |
| 43 | |
private NotificationMessageContentService notificationMessageContentService; |
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
public String sendNotification(String notificationMessageAsXml) throws RemoteException { |
| 61 | 0 | PerformanceStopWatch watch = PerformanceLog.startTimer("Time to send notification from web service"); |
| 62 | |
|
| 63 | |
NotificationResponse response; |
| 64 | |
try { |
| 65 | 0 | response = notificationService.sendNotification(notificationMessageAsXml); |
| 66 | |
|
| 67 | 0 | } catch(IOException ioe) { |
| 68 | 0 | response = new NotificationResponse(); |
| 69 | 0 | response.setStatus(NotificationConstants.RESPONSE_STATUSES.FAILURE); |
| 70 | 0 | response.setMessage("Failed to process the message content: " + ioe.getMessage()); |
| 71 | 0 | LOG.error("Failed to process the message content", ioe); |
| 72 | 0 | } catch(XmlException ixe) { |
| 73 | 0 | response = new NotificationResponse(); |
| 74 | 0 | response.setStatus(NotificationConstants.RESPONSE_STATUSES.FAILURE); |
| 75 | 0 | response.setMessage("Failed to process the message content because the XML message provided to the system was invalid: " + ixe.getMessage()); |
| 76 | 0 | LOG.error("Failed to process the message content because the XML message provided to the system was invalid", ixe); |
| 77 | 0 | } |
| 78 | |
|
| 79 | 0 | String responseAsXml = notificationMessageContentService.generateNotificationResponseMessage(response); |
| 80 | |
|
| 81 | 0 | watch.recordDuration(); |
| 82 | |
|
| 83 | 0 | LOG.info("Notification response: " + response); |
| 84 | |
|
| 85 | 0 | return responseAsXml; |
| 86 | |
} |
| 87 | |
} |