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.model; 8 9 import org.mule.api.MuleEventContext; 10 11 /** 12 * <code>EntryPointResolver</code> resolves a method to call on the given 13 * service object when an event is received. 14 * This object maintains a set of Resolvers that will be used in order to resolve 15 * an entrypoint on a service object until one is found or until the set is 16 * exhausted. 17 * 18 * Note that there is a one-to-one mapping from component to EntryPointResolverSet. Each component must get a separate set 19 * with {@link org.mule.api.model.EntryPointResolver} instances that are not shared. An EntryPointResolver is allowed to cache state 20 * and can assume the component will always be of the the same type. 21 */ 22 public interface EntryPointResolverSet 23 { 24 25 /** 26 * Will attempt to invoke the component by looping through all {@link org.mule.api.model.EntryPointResolver} instances registered on this set until 27 * a match is found 28 * @param component the component to invoke 29 * @param context the current event context, this is used to figure out which method to call on the component 30 * @return the result of the invocation 31 * @throws Exception if the invocation itself or an {@link EntryPointResolver} fails 32 */ 33 Object invoke(Object component, MuleEventContext context) throws Exception; 34 35 /** 36 * Will add a resolver to the list of resolvers to invoke on a compoent. 37 * Implementations must maintain an ordered list of resolvers 38 * 39 * @param resolver the resolver to add 40 */ 41 void addEntryPointResolver(EntryPointResolver resolver); 42 43 /** 44 * Removes a resolver from the list 45 * 46 * @param resolver the resolver to remove 47 * @return true if the resolver was found and removed from the list 48 */ 49 boolean removeEntryPointResolver(EntryPointResolver resolver); 50 51 }