1 /** 2 * Copyright 2005-2013 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.krms.framework.engine; 17 18 import java.util.Map; 19 20 import org.kuali.rice.krms.api.engine.ExecutionOptions; 21 import org.kuali.rice.krms.api.engine.SelectionCriteria; 22 import org.kuali.rice.krms.api.engine.Term; 23 24 /** 25 * Loads a {@link Context} for the given set of criteria. Applications who 26 * want to provide their own means for creating a context and supplying it to 27 * the KRMS engine can do so by implementing a custom ContextProvider. 28 * 29 * @see Context 30 * 31 * @author Kuali Rice Team (rice.collab@kuali.org) 32 * 33 */ 34 public interface ContextProvider { 35 36 /** 37 * Loads the context for the given selection criteria, facts, and execution 38 * options. If no context can be located based on the given criteria, then 39 * this method should return null. 40 * 41 * <p>In the case where multiple Contexts could potentially be identified 42 * from the same set of selection criteria, it is up to the implementer 43 * of the ContextProvider to ensure that the most appropriate Context is 44 * returned. Or alternatively, an exception could be thrown indicating 45 * context ambiguity. 46 * 47 * <p>The sectionCriteria, facts, and executionOptions which are passed to 48 * this method should never be null. However, they might be empty. 49 * 50 * @param selectionCriteria the criteria to use during the selection phase of engine operation 51 * @param facts the set of facts that are supplied to the engine at execution time 52 * @param executionOptions a collection of options that can be used to customize engine execution behavior 53 * 54 * @return the context which matches the given criteria, or null if no context matches 55 */ 56 public Context loadContext(SelectionCriteria selectionCriteria, Map<Term, Object> facts, ExecutionOptions executionOptions); 57 58 }