Coverage Report - org.mule.api.service.Service
 
Classes in this File Line Coverage Branch Coverage Complexity
Service
N/A
N/A
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.api.service;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.MuleEvent;
 11  
 import org.mule.api.MuleException;
 12  
 import org.mule.api.NamedObject;
 13  
 import org.mule.api.component.Component;
 14  
 import org.mule.api.construct.FlowConstruct;
 15  
 import org.mule.api.exception.MessagingExceptionHandler;
 16  
 import org.mule.api.lifecycle.Lifecycle;
 17  
 import org.mule.api.lifecycle.LifecycleManager;
 18  
 import org.mule.api.model.Model;
 19  
 import org.mule.api.processor.MessageProcessor;
 20  
 import org.mule.api.routing.OutboundRouterCollection;
 21  
 import org.mule.api.source.MessageSource;
 22  
 import org.mule.management.stats.ServiceStatistics;
 23  
 import org.mule.service.ServiceAsyncReplyCompositeMessageSource;
 24  
 
 25  
 import java.io.Serializable;
 26  
 
 27  
 /**
 28  
  * <code>Service</code> is the internal representation of a Mule Managed service. It
 29  
  * is responsible for managing the interaction of events to and from the service as
 30  
  * well as managing pooled resources.
 31  
  */
 32  
 public interface Service extends Serializable, FlowConstruct, Lifecycle, NamedObject
 33  
 {
 34  
     /**
 35  
      * Makes an asynchronous event call to the service.
 36  
      *
 37  
      * @param event the event to consume
 38  
      * @throws MuleException if the event fails to be processed
 39  
      * @deprecated
 40  
      */
 41  
     @Deprecated
 42  
     void dispatchEvent(MuleEvent event) throws MuleException;
 43  
 
 44  
     /**
 45  
      * Makes a synchronous event call to the service. This event will be consumed by
 46  
      * the service and a result returned.
 47  
      *
 48  
      * @param event the event to consume
 49  
      * @return a MuleMessage containing the resulting message and properties
 50  
      * @throws MuleException if the event fails to be processed
 51  
      * @deprecated
 52  
      */
 53  
     @Deprecated
 54  
     MuleEvent sendEvent(MuleEvent event) throws MuleException;
 55  
 
 56  
     /**
 57  
      * Determines whether this service has been started
 58  
      *
 59  
      * @return true is the service is started and ready to receive events
 60  
      */
 61  
     boolean isStarted();
 62  
 
 63  
     boolean isStopped();
 64  
 
 65  
     /**
 66  
      * Pauses event processing for a single Mule Service. Unlike <code>stop()</code>, a paused
 67  
      * service will still consume messages from the underlying transport, but those
 68  
      * messages will be queued until the service is resumed.
 69  
      */
 70  
     void pause() throws MuleException;
 71  
 
 72  
     /**
 73  
      * Resumes a single Mule Service that has been paused. If the service is not
 74  
      * paused nothing is executed.
 75  
      */
 76  
     void resume() throws MuleException;
 77  
 
 78  
     /**
 79  
      * @return true if the service is in a paused state, false otherwise
 80  
      */
 81  
     boolean isPaused();
 82  
 
 83  
     MessageSource getMessageSource();
 84  
 
 85  
     /**
 86  
      * Outbound Routers control how events are published by a service once. the
 87  
      * event has been processed. If no router is set. A default will be used that
 88  
      * uses the outboundProvider set on his descriptor to route the event.
 89  
      *
 90  
      * @return the outbound router for this service
 91  
      * @see OutboundRouterCollection
 92  
      */
 93  
     MessageProcessor getOutboundMessageProcessor();
 94  
 
 95  
     /**
 96  
      * Returns the initial state of this service
 97  
      *
 98  
      * @return the initial state of this service
 99  
      */
 100  
     String getInitialState();
 101  
 
 102  
     /**
 103  
      * Returns the name of the model that this descriptor is registered with.
 104  
      * @return the name of the model that this descriptor is registered with or null
 105  
      *         if this descriptor has not been registered with a model yet
 106  
      */
 107  
     Model getModel();
 108  
 
 109  
     void setMessageSource(MessageSource messageSource);
 110  
 
 111  
     /**
 112  
      * Outbound message processor controls how events are published by a service once the
 113  
      * event has been processed. If no router is set a default will be used that
 114  
      * uses the outboundProvider set on his descriptor to route the event.
 115  
      */
 116  
     void setOutboundMessageProcessor(MessageProcessor processor);
 117  
 
 118  
     /**
 119  
      * Sets the initial state of this service
 120  
      *
 121  
      * @param state the initial state of this service
 122  
      */
 123  
     void setInitialState(String state);
 124  
 
 125  
     void setModel(Model model);
 126  
 
 127  
     /**
 128  
      * Returns the Component that is a invoked by a {@link Service} for each incoming
 129  
      * {@link MuleEvent} routed on by the inbound routers.
 130  
      */
 131  
     Component getComponent();
 132  
 
 133  
     /**
 134  
      * Sets the Component that is a invoked by a {@link Service} for each incoming
 135  
      * {@link MuleEvent} routed on by the inbound routers.
 136  
      */
 137  
     void setComponent(Component component);
 138  
 
 139  
     /**
 140  
      * Returns the Service statistics.  This provides Service router and component statistics.
 141  
      */
 142  
     ServiceStatistics getStatistics();
 143  
 
 144  
     MuleContext getMuleContext();
 145  
 
 146  
     LifecycleManager getLifecycleManager();
 147  
 
 148  
     void setAsyncReplyMessageSource(ServiceAsyncReplyCompositeMessageSource asyncReplyMessageSource);
 149  
 
 150  
     ServiceAsyncReplyCompositeMessageSource getAsyncReplyMessageSource();
 151  
 
 152  
     MessagingExceptionHandler getExceptionListener();
 153  
 
 154  
     void setExceptionListener(MessagingExceptionHandler exceptionListener);
 155  
 }