Coverage Report - org.kuali.rice.ksb.messaging.callforwarding.ForwardedCallHandlerImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ForwardedCallHandlerImpl
0%
0/21
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.ksb.messaging.callforwarding;
 18  
 
 19  
 import java.sql.Timestamp;
 20  
 
 21  
 import org.apache.log4j.Logger;
 22  
 import org.kuali.rice.core.util.RiceUtilities;
 23  
 import org.kuali.rice.ksb.messaging.AsynchronousCall;
 24  
 import org.kuali.rice.ksb.messaging.PersistedMessagePayload;
 25  
 import org.kuali.rice.ksb.messaging.PersistedMessage;
 26  
 import org.kuali.rice.ksb.messaging.serviceproxies.MessageSender;
 27  
 import org.kuali.rice.ksb.service.KSBServiceLocator;
 28  
 import org.kuali.rice.ksb.util.KSBConstants;
 29  
 
 30  
 
 31  
 /**
 32  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 33  
  */
 34  0
 public class ForwardedCallHandlerImpl implements ForwardedCallHandler {
 35  
 
 36  0
         private static final Logger LOG = Logger.getLogger(ForwardedCallHandlerImpl.class);
 37  
 
 38  
         public void handleCall(PersistedMessage message) throws Exception {
 39  0
                 LOG.debug("Recieved forwared message from service " + message.getMethodCall().getServiceInfo().getQname());
 40  0
                 PersistedMessage copy = new PersistedMessage();
 41  0
                 copy.setExpirationDate(message.getExpirationDate());
 42  0
                 copy.setIpNumber(RiceUtilities.getIpNumber());
 43  0
                 copy.setServiceNamespace(message.getServiceNamespace());
 44  0
                 copy.setMethodCall(message.getMethodCall());
 45  0
                 copy.setMethodName(message.getMethodName());
 46  0
                 copy.setQueueDate(new Timestamp(System.currentTimeMillis()));
 47  0
                 copy.setQueuePriority(message.getQueuePriority());
 48  0
                 copy.setQueueStatus(KSBConstants.ROUTE_QUEUE_QUEUED);
 49  0
                 copy.setRetryCount(message.getRetryCount());
 50  0
                 AsynchronousCall methodCall = message.getPayload().getMethodCall();
 51  0
                 methodCall.setIgnoreStoreAndForward(true);
 52  0
                 copy.setPayload(new PersistedMessagePayload(methodCall, copy));
 53  0
                 copy.setServiceName(message.getServiceName());
 54  0
                 message.setQueueStatus(KSBConstants.ROUTE_QUEUE_ROUTING);
 55  0
                 KSBServiceLocator.getRouteQueueService().save(message);
 56  0
                 MessageSender.sendMessage(message);
 57  0
         }
 58  
 }