View Javadoc

1   /*
2    * Copyright 2007-2008 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ken.service.impl;
17  
18  import org.kuali.rice.ken.bo.NotificationResponse;
19  import org.kuali.rice.ken.service.NotificationService;
20  import org.kuali.rice.kew.exception.WorkflowRuntimeException;
21  import org.kuali.rice.ksb.messaging.service.KSBXMLService;
22  
23  
24  /**
25   * This class allows the NotificationService.sendNotification(XML) service 
26   * to be invoked as a web service generically from the bus.
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class SendNotificationServiceKewXmlImpl implements KSBXMLService {
30      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
31  	.getLogger(SendNotificationServiceKewXmlImpl.class);
32      
33      private NotificationService notificationService;
34  
35      /**
36       * Constructs a SendNotificationServiceKewXmlImpl instance.
37       * @param notificationService
38       */
39      public SendNotificationServiceKewXmlImpl(NotificationService notificationService) {
40  	this.notificationService = notificationService;
41      }
42  
43      /**
44       * Actually invokes the sendNotification() service method.  The KSB calls 
45       * this.
46       * @see org.kuali.rice.ksb.messaging.service.KSBXMLService#invoke(java.lang.String)
47       */
48      public void invoke(String xml) {
49      	try {
50      	   NotificationResponse response = notificationService.sendNotification(xml);
51      	   LOG.info(response.getMessage());
52      	} catch (Exception e) {
53      	    throw new WorkflowRuntimeException(e);
54      	}
55      }
56  }