Coverage Report - org.kuali.rice.ksb.messaging.RepeatTopicInvokerQueueImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RepeatTopicInvokerQueueImpl
0%
0/14
N/A
2
 
 1  
 /*
 2  
  * Copyright 2007 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.ksb.messaging;
 17  
 
 18  
 import java.lang.reflect.Method;
 19  
 
 20  
 import org.kuali.rice.core.exception.RiceRuntimeException;
 21  
 import org.kuali.rice.core.lifecycle.BaseLifecycle;
 22  
 import org.kuali.rice.ksb.messaging.config.ServiceBasedServiceDefinitionRegisterer;
 23  
 import org.kuali.rice.ksb.service.KSBServiceLocator;
 24  
 
 25  
 
 26  0
 public class RepeatTopicInvokerQueueImpl extends BaseLifecycle implements RepeatTopicInvokerQueue {
 27  
 
 28  
         private ServiceBasedServiceDefinitionRegisterer defRegisterer;
 29  
         
 30  
         public Object invokeTopic(AsynchronousCall methodCall) {
 31  0
                 ServiceInfo serviceInfo = methodCall.getServiceInfo();
 32  0
                 Object service = KSBServiceLocator.getMessageHelper().getServiceAsynchronously(serviceInfo.getQname());
 33  
                 try {
 34  0
                         Method method = service.getClass().getMethod(methodCall.getMethodName(), methodCall.getParamTypes());
 35  0
                         return method.invoke(service, methodCall.getArguments());
 36  0
                 } catch (Throwable t) {
 37  0
                         throw new RiceRuntimeException("Caught Exception invoking repeatable topic", t);
 38  
                 }
 39  
         }
 40  
         
 41  
         public void start() throws Exception {
 42  0
             this.defRegisterer = new ServiceBasedServiceDefinitionRegisterer("repeatTopicInvokerQueueDefinition");
 43  0
             this.defRegisterer.registerServiceDefinition(false);
 44  0
                 setStarted(true);
 45  0
         }
 46  
 
 47  
         public void stop() throws Exception {
 48  0
             this.defRegisterer.unregisterServiceDefinition();
 49  0
                 setStarted(false);
 50  0
         }
 51  
 }