1 15 package org.apache.tapestry.services.impl; 16 17 import java.io.IOException ; 18 19 import org.apache.hivemind.util.Defense; 20 import org.apache.tapestry.IRequestCycle; 21 import org.apache.tapestry.engine.IEngineService; 22 import org.apache.tapestry.engine.ILink; 23 24 33 public class EngineServiceInnerProxy implements IEngineService 34 { 35 private final String _serviceName; 36 37 private final EngineServiceOuterProxy _outerProxy; 38 39 private final EngineServiceSource _source; 40 41 public EngineServiceInnerProxy(String serviceName, EngineServiceOuterProxy outerProxy, 42 EngineServiceSource source) 43 { 44 Defense.notNull(serviceName, "serviceName"); 45 Defense.notNull(outerProxy, "outerProxy"); 46 Defense.notNull(source, "source"); 47 48 _serviceName = serviceName; 49 _outerProxy = outerProxy; 50 _source = source; 51 } 52 53 public String toString() 54 { 55 return ImplMessages.engineServiceInnerProxyToString(_serviceName); 56 } 57 58 private IEngineService resolve() 59 { 60 IEngineService service = _source.resolveEngineService(_serviceName); 61 62 _outerProxy.installDelegate(service); 63 64 return service; 65 } 66 67 public synchronized ILink getLink(IRequestCycle cycle, Object parameter) 68 { 69 return resolve().getLink(cycle, parameter); 70 } 71 72 public synchronized void service(IRequestCycle cycle) throws IOException 73 { 74 resolve().service(cycle); 75 } 76 77 public String getName() 78 { 79 return _serviceName; 80 } 81 82 } | Popular Tags |