public AbstractMethodInvokingInstrumenter(ModuleBuilderSource moduleSource, Method method, ServiceResources resources, PlasticProxyFactory proxyFactory) { this.moduleSource = moduleSource; this.method = method; this.resources = resources; this.proxyFactory = proxyFactory; serviceId = resources.getServiceId(); resourcesDefaults.put(String.class, serviceId); resourcesDefaults.put(ObjectLocator.class, resources); resourcesDefaults.put(ServiceResources.class, resources); logger = resources.getLogger(); resourcesDefaults.put(Logger.class, logger); serviceInterface = resources.getServiceInterface(); resourcesDefaults.put(Class.class, serviceInterface); resourcesDefaults.put(OperationTracker.class, resources.getTracker()); }
public Pingable buildPingable(ServiceResources resources) { return resources.autobuild(UnbuildablePingable.class); } }
private Object createProxy(ServiceResources resources, ObjectCreator creator, boolean preventDecoration) { String serviceId = resources.getServiceId(); Class serviceInterface = resources.getServiceInterface(); String toString = format("<Proxy for %s(%s)>", serviceId, serviceInterface.getName()); ServiceProxyToken token = SerializationSupport.createToken(serviceId); final Class serviceImplementation = preventDecoration || serviceInterface == TypeCoercer.class ? null : resources.getServiceImplementation(); return createProxyInstance(creator, token, serviceInterface, serviceImplementation, toString); }
@SuppressWarnings("unchecked") public Object createService(ServiceResources resources, ObjectCreator creator) { ObjectCreator perTestCreator = new PerTestServiceCreator(perTestManager, creator); Class<?> serviceInterface = resources.getServiceInterface(); String toString = format("<PerTest Proxy for %s(%s)>", resources.getServiceId(), serviceInterface.getName()); return proxyFactory.createProxy(serviceInterface, perTestCreator, toString); } }
resourceMap.put(Logger.class, resources.getLogger()); resources.getServiceId(), t, parameterType), injectionResources); injectionResources, resources.getTracker());
@Override public String getServiceId() { return resources.getServiceId(); }
OrderedConfiguration configuration) final OperationTracker tracker = resources.getTracker(); final ApplicationContext context = resources.getService(SERVICE_ID, ApplicationContext.class);
protected final void train_getTracker(ServiceResources resources, OperationTracker tracker) { expect(resources.getTracker()).andReturn(tracker).atLeastOnce(); }
protected final void train_getServiceInterface(ServiceResources resources, Class serviceInterface) { expect(resources.getServiceInterface()).andReturn(serviceInterface).atLeastOnce(); }
protected final void train_getLogger(ServiceResources resources, Logger log) { expect(resources.getLogger()).andReturn(log).atLeastOnce(); }
@Override public Object createService(ServiceResources resources, ObjectCreator creator) { ObjectCreator perThreadCreator = perthreadManager.createValue(creator); Class serviceInterface = resources.getServiceInterface(); return proxyFactory.createProxy(serviceInterface, perThreadCreator, "<PerThread Proxy for " + resources.getServiceId() + "(" + serviceInterface.getName() + ")>"); } }
resourceMap.put(Logger.class, resources.getLogger()); resources.getServiceId(), t, parameterType), injectionResources); injectionResources, resources.getTracker());
public ToStringService buildToString(ServiceResources resources) { final String serviceId = resources.getServiceId(); return new ToStringService() { @Override public String toString() { return "<ToStringService: " + serviceId + ">"; } }; }
OrderedConfiguration configuration) final OperationTracker tracker = resources.getTracker(); final ApplicationContext context = resources.getService(SERVICE_ID, ApplicationContext.class);
protected final void train_getTracker(ServiceResources resources, OperationTracker tracker) { expect(resources.getTracker()).andReturn(tracker).atLeastOnce(); }
protected final void train_getServiceInterface(ServiceResources resources, Class serviceInterface) { expect(resources.getServiceInterface()).andReturn(serviceInterface).atLeastOnce(); }
protected final void train_getLogger(ServiceResources resources, Logger log) { expect(resources.getLogger()).andReturn(log).atLeastOnce(); }
public AbstractMethodInvokingInstrumenter(ModuleBuilderSource moduleSource, Method method, ServiceResources resources, PlasticProxyFactory proxyFactory) { this.moduleSource = moduleSource; this.method = method; this.resources = resources; this.proxyFactory = proxyFactory; serviceId = resources.getServiceId(); resourcesDefaults.put(String.class, serviceId); resourcesDefaults.put(ObjectLocator.class, resources); resourcesDefaults.put(ServiceResources.class, resources); logger = resources.getLogger(); resourcesDefaults.put(Logger.class, logger); serviceInterface = resources.getServiceInterface(); resourcesDefaults.put(Class.class, serviceInterface); resourcesDefaults.put(OperationTracker.class, resources.getTracker()); }
@Override public Object createService(ServiceResources resources, ObjectCreator creator) { ObjectCreator perThreadCreator = perthreadManager.createValue(creator); Class serviceInterface = resources.getServiceInterface(); return proxyFactory.createProxy(serviceInterface, perThreadCreator, "<PerThread Proxy for " + resources.getServiceId() + "(" + serviceInterface.getName() + ")>"); } }
private Object createProxy(ServiceResources resources, ObjectCreator creator, boolean preventDecoration) { String serviceId = resources.getServiceId(); Class serviceInterface = resources.getServiceInterface(); String toString = format("<Proxy for %s(%s)>", serviceId, serviceInterface.getName()); ServiceProxyToken token = SerializationSupport.createToken(serviceId); final Class serviceImplementation = preventDecoration || serviceInterface == TypeCoercer.class ? null : resources.getServiceImplementation(); return createProxyInstance(creator, token, serviceInterface, serviceImplementation, toString); }