001 /*
002 * Copyright 2007-2008 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.ken.service.impl;
017
018 import org.kuali.rice.ken.bo.NotificationResponse;
019 import org.kuali.rice.ken.service.NotificationService;
020 import org.kuali.rice.kew.exception.WorkflowRuntimeException;
021 import org.kuali.rice.ksb.messaging.service.KSBXMLService;
022
023
024 /**
025 * This class allows the NotificationService.sendNotification(XML) service
026 * to be invoked as a web service generically from the bus.
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class SendNotificationServiceKewXmlImpl implements KSBXMLService {
030 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
031 .getLogger(SendNotificationServiceKewXmlImpl.class);
032
033 private NotificationService notificationService;
034
035 /**
036 * Constructs a SendNotificationServiceKewXmlImpl instance.
037 * @param notificationService
038 */
039 public SendNotificationServiceKewXmlImpl(NotificationService notificationService) {
040 this.notificationService = notificationService;
041 }
042
043 /**
044 * Actually invokes the sendNotification() service method. The KSB calls
045 * this.
046 * @see org.kuali.rice.ksb.messaging.service.KSBXMLService#invoke(java.lang.String)
047 */
048 public void invoke(String xml) {
049 try {
050 NotificationResponse response = notificationService.sendNotification(xml);
051 LOG.info(response.getMessage());
052 } catch (Exception e) {
053 throw new WorkflowRuntimeException(e);
054 }
055 }
056 }