1 /* 2 * $Id: MuleProxy.java 7976 2007-08-21 14:26:13Z dirk.olmes $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.impl.model; 12 13 import org.mule.management.stats.ComponentStatistics; 14 import org.mule.umo.UMOEvent; 15 import org.mule.umo.UMOException; 16 import org.mule.umo.UMOImmutableDescriptor; 17 import org.mule.umo.lifecycle.Lifecycle; 18 import org.mule.util.queue.QueueSession; 19 20 import javax.resource.spi.work.Work; 21 22 /** 23 * <code>MuleProxy</code> is a proxy to a UMO. It is a poolable object that that 24 * can be executed in it's own thread. 25 */ 26 27 public interface MuleProxy extends Work, Lifecycle 28 { 29 30 /** 31 * Sets the current event being processed 32 * 33 * @param event the event being processed 34 */ 35 void onEvent(QueueSession session, UMOEvent event); 36 37 ComponentStatistics getStatistics(); 38 39 void setStatistics(ComponentStatistics stat); 40 41 /** 42 * Makes a synchronous call on the UMO 43 * 44 * @param event the event to pass to the UMO 45 * @return the return event from the UMO 46 * @throws UMOException if the call fails 47 */ 48 Object onCall(UMOEvent event) throws UMOException; 49 50 /** 51 * When an exception occurs this method can be called to invoke the configured 52 * UMOExceptionStrategy on the UMO 53 * 54 * @param exception If the UMOExceptionStrategy implementation fails 55 */ 56 void handleException(Exception exception); 57 58 /** 59 * Determines if the proxy is suspended 60 * 61 * @return true if the proxy (and the UMO) are suspended 62 */ 63 boolean isSuspended(); 64 65 /** 66 * Controls the suspension of the UMO event processing 67 */ 68 void suspend(); 69 70 /** 71 * Triggers the UMO to resume processing of events if it is suspended 72 */ 73 void resume(); 74 75 /* 76 * (non-Javadoc) 77 * 78 * @see org.mule.umo.UMOLifecycleAdapter#getDescriptor() 79 */ 80 UMOImmutableDescriptor getDescriptor(); 81 }