001 /*
002 @license.text@
003 */
004 package com.hammurapi.util;
005
006 import java.util.Iterator;
007
008 /**
009 * Execution context.
010 * @author Pavel Vlasov
011 * @version $Revision: 1.1 $
012 */
013 public interface Context {
014
015 /**
016 * Context constructed from all available context services.
017 */
018 Context INSTANCE = Util.loadContext();
019
020 /**
021 * Looks up object by name.
022 * @param name Object name.
023 * @return named object or null.
024 */
025 Object lookup(String name);
026
027 /**
028 * Looks up single object (service) by type.
029 * @param <T> Service type.
030 * @param serviceClass Requested service type.
031 * @return Service instance or null.
032 */
033 <T> T lookup(Class<T> serviceClass);
034
035 /**
036 * Looks up all services of given type.
037 * @param <T> Service type.
038 * @param serviceClass Requested service type.
039 * @return Iterator over services of requested type.
040 */
041 <T> Iterator<T> lookupAll(Class<T> serviceClass);
042 }