@PreventServiceDecoration public class LoggingAdvisorImpl implements LoggingAdvisor { private final ExceptionTracker exceptionTracker; public LoggingAdvisorImpl(ExceptionTracker exceptionTracker) { this.exceptionTracker = exceptionTracker; } @Override public void addLoggingAdvice(Logger logger, MethodAdviceReceiver receiver) { MethodAdvice advice = new LoggingAdvice(logger, exceptionTracker); receiver.adviseAllMethods(advice); } }
@PreventServiceDecoration public class LoggingAdvisorImpl implements LoggingAdvisor { private final ExceptionTracker exceptionTracker; public LoggingAdvisorImpl(ExceptionTracker exceptionTracker) { this.exceptionTracker = exceptionTracker; } @Override public void addLoggingAdvice(Logger logger, MethodAdviceReceiver receiver) { MethodAdvice advice = new LoggingAdvice(logger, exceptionTracker); receiver.adviseAllMethods(advice); } }
@PreventServiceDecoration public class LoggingDecoratorImpl implements LoggingDecorator { private final AspectDecorator aspectDecorator; private final LoggingAdvisor advisor; public LoggingDecoratorImpl(AspectDecorator aspectDecorator, LoggingAdvisor advisor) { this.aspectDecorator = aspectDecorator; this.advisor = advisor; } @Override public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, final Logger logger) { AspectInterceptorBuilder<T> builder = aspectDecorator.createBuilder(serviceInterface, delegate, String.format( "<Logging interceptor for %s(%s)>", serviceId, serviceInterface.getName())); advisor.addLoggingAdvice(logger, builder); return builder.build(); } }
@PreventServiceDecoration public class LoggingDecoratorImpl implements LoggingDecorator { private final AspectDecorator aspectDecorator; private final LoggingAdvisor advisor; public LoggingDecoratorImpl(AspectDecorator aspectDecorator, LoggingAdvisor advisor) { this.aspectDecorator = aspectDecorator; this.advisor = advisor; } @Override public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, final Logger logger) { AspectInterceptorBuilder<T> builder = aspectDecorator.createBuilder(serviceInterface, delegate, String.format( "<Logging interceptor for %s(%s)>", serviceId, serviceInterface.getName())); advisor.addLoggingAdvice(logger, builder); return builder.build(); } }
@PreventServiceDecoration public class ServiceOverrideImpl implements ServiceOverride { private final Map<Class, Object> configuration; public ServiceOverrideImpl(Map<Class, Object> configuration) { this.configuration = configuration; } @Override public ObjectProvider getServiceOverrideProvider() { return new ObjectProvider() { @Override public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { return objectType.cast(configuration.get(objectType)); } }; } }
@PreventServiceDecoration public class ServiceOverrideImpl implements ServiceOverride { private final Map<Class, Object> configuration; public ServiceOverrideImpl(Map<Class, Object> configuration) { this.configuration = configuration; } @Override public ObjectProvider getServiceOverrideProvider() { return new ObjectProvider() { @Override public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { return objectType.cast(configuration.get(objectType)); } }; } }
@PreventServiceDecoration public class UpdateListenerHubImpl implements UpdateListenerHub
@PreventServiceDecoration public class UpdateListenerHubImpl implements UpdateListenerHub
@PreventServiceDecoration public class MasterObjectProviderImpl implements MasterObjectProvider
@PreventServiceDecoration public class MasterObjectProviderImpl implements MasterObjectProvider
@PreventServiceDecoration public class AspectDecoratorImpl implements AspectDecorator
@PreventServiceDecoration public class LazyAdvisorImpl implements LazyAdvisor
@PreventServiceDecoration public class LazyAdvisorImpl implements LazyAdvisor
@PreventServiceDecoration public class AspectDecoratorImpl implements AspectDecorator
@PreventServiceDecoration public class RocketImpl implements Rocket { @Override public String getCountdown() { return "3, 2, 1, Launch!"; } }
@Scope(ScopeConstants.PERTHREAD) @PreventServiceDecoration public class ExceptionTrackerImpl implements ExceptionTracker { private final Set<Throwable> exceptions = CollectionFactory.newSet(); @Override public boolean exceptionLogged(Throwable exception) { boolean result = exceptions.contains(exception); exceptions.add(exception); return result; } }
@Scope(ScopeConstants.PERTHREAD) @PreventServiceDecoration public class ExceptionTrackerImpl implements ExceptionTracker { private final Set<Throwable> exceptions = CollectionFactory.newSet(); @Override public boolean exceptionLogged(Throwable exception) { boolean result = exceptions.contains(exception); exceptions.add(exception); return result; } }
/** * Provides access to additional service lifecycles. One lifecycle is built in ("singleton") but additional ones are * accessed via this service (and its mapped configuration). Only proxiable services (those with explicit service * interfaces) can be managed in terms of a lifecycle. */ @PreventServiceDecoration public static ServiceLifecycleSource build(Map<String, ServiceLifecycle> configuration) { final Map<String, ServiceLifecycle2> lifecycles = CollectionFactory.newCaseInsensitiveMap(); for (Entry<String, ServiceLifecycle> entry : configuration.entrySet()) { lifecycles.put(entry.getKey(), InternalUtils.toServiceLifecycle2(entry.getValue())); } return new ServiceLifecycleSource() { @Override public ServiceLifecycle get(String scope) { return lifecycles.get(scope); } }; }
/** * Provides access to additional service lifecycles. One lifecycle is built in ("singleton") but additional ones are * accessed via this service (and its mapped configuration). Only proxiable services (those with explicit service * interfaces) can be managed in terms of a lifecycle. */ @PreventServiceDecoration public static ServiceLifecycleSource build(Map<String, ServiceLifecycle> configuration) { final Map<String, ServiceLifecycle2> lifecycles = CollectionFactory.newCaseInsensitiveMap(); for (Entry<String, ServiceLifecycle> entry : configuration.entrySet()) { lifecycles.put(entry.getKey(), InternalUtils.toServiceLifecycle2(entry.getValue())); } return new ServiceLifecycleSource() { @Override public ServiceLifecycle get(String scope) { return lifecycles.get(scope); } }; }
@PreventServiceDecoration public StringTransformer buildStringTransformer() { return new UppercaseStringTransformer(); }