SlideShare a Scribd company logo
1 of 68
Download to read offline
prepare for…..
Proxy Deep Dive
JUG Saxony Day 2015
1
@SvenRuppert
@SvenRuppert
has been coding java since 1996
Fellow / Senior Manager
reply Group
Germany - Munich
2
@SvenRuppert
has been coding java since 1996
Projects in the field of:
•Automobile-industry
•Energy
•Finance / Leasing
•Space- Satellit-
•Government / UN / World-bank
Where?
•Europe
•Asia - from India up to Malaysia
3
Why a Proxy ?
4
@SvenRuppert
Proxies you can use them for :
generic parts inside your application
hiding technical stuff
decouple parts of your applications
Why a Proxy ?
5
@SvenRuppert
final InnerDemoClass original = new InnerDemoClass();
final InnerDemoInterface demoLogic =
ProxyBuilder.createBuilder(InnerDemoInterface.class, original)

.addLogging()
.addMetrics()
.addSecurityRule(() -> true)
.addSecurityRule(() -> true)
.build();
but it must be easy to use like…
Why a Proxy ?
6
@SvenRuppert
@Inject
@Proxy(virtual = true, metrics = true)
Service service;
Adapter v Proxy - Pattern Hello World
7
@SvenRuppert
Difference between Proxy and Adapter
Adapter v Proxy - Pattern Hello World
Adapter - or called Wrapper
maybe : Use an Adapter if you have to use an incompatible
interface between two systems.
In detail I am using/talking about an Adapter with Delegator.
8
@SvenRuppert
Adapter v Proxy - Pattern Hello World
public class LegacyWorker {

public void writeTheStrings(String[] strArray){

Arrays.stream(strArray).forEach(System.out::println);

}

}
9
public interface WorkerAdapter {

public void workOnSomething(List<String> stringListe);

}
public class Adapter implements WorkerAdapter {

private LegacyWorker worker = new LegacyWorker();

@Override

public void workOnSomething(List<String> stringListe) {

final String[] strings = stringListe.toArray(new String[0]);

worker.writeTheStrings(strings);

}

}
@SvenRuppert
Adapter v Proxy - Pattern Hello World
public class Main {

public static void main(String[] args) {

final ArrayList<String> strings = new ArrayList<>();

Collections.addAll(strings, „A","B","C","D");


new Adapter().workOnSomething(strings);

}

}
10
• No need to know the LegacyWorker
• No inheritance between LegacyWorker and Adapter
• only a transformation of an interface
• same creation time for Delegator and Adapter
@SvenRuppert
Proxy - the easiest version
11
• We need to know the LegacyWorker
• Inheritance between LegacyWorker and Adapter
• do not use it like an Adapter !
@SvenRuppert
We need a few steps to come from an Adapter with
Delegator to a Proxy
please show the code
Proxy - the easiest version - (Delegator)
public interface Service {

String work(String txt);

}
12
@SvenRuppert
public class ServiceImpl implements Service {

public String work(String txt) {

return "ServiceImpl - " + txt;

}

}
public class ServiceProxy implements Service {

private Service service = new ServiceImpl();

public String work(String txt) { return service.work(txt); }

}
Security Proxy
13
@SvenRuppert
public class ServiceProxy implements Service {

private Service service = new ServiceImpl();

public String work(String txt) { return service.work(txt); }

}
What could we
change now ?
SecurityProxy:
execute only if it is allowed
public class ServiceSecurityProxy implements Service {

private Service service = new ServiceImpl();

private String code; //who will set this ?

public String work(String txt) {

if(code.equals(„hoppel")) { return service.work(txt); }

else { return "nooooop"; }

}

}
Remote Proxy - JDK only
14
@SvenRuppert
public class ServiceProxy implements Service {

private Service service = new ServiceImpl();

public String work(String txt) { return service.work(txt); }

}
What could we
change now ?
RemoteProxy:
execute outside of my process
Service proxy = new ServiceRemoteProxy();

String hello = proxy.work(„Hello");
some work needed
Remote Proxy - JDK only
15
@SvenRuppert
Proxy
Remote
Service
Interface
Interface
remote communication
client server
Remote Proxy - JDK only
16
@SvenRuppert
@WebService

@SOAPBinding(style = SOAPBinding.Style.RPC)

public interface Service {

@WebMethod

public String work(String txt);

}
Remote Proxy - JDK only
17
@SvenRuppert
Proxy
Remote
Service
Interface
Interface
remote communication
client server
Remote Proxy - JDK only
18
@SvenRuppert
@SOAPBinding(style = SOAPBinding.Style.RPC)

@WebService(endpointInterface = "org.rapidpm.Service")

public class ServiceImpl implements Service {

@Override

public String work(String txt) {

return "ServiceImpl - " + txt;

}

}
Remote Proxy - JDK only
19
@SvenRuppert
Proxy
Remote
Service
Interface
Interface
remote communication
client server
Remote Proxy - JDK only
20
@SvenRuppert
final String address = "http://localhost:9999/ws/service";

final ExecutorService threadPool = Executors.newFixedThreadPool(10);

final Endpoint endpoint = Endpoint.create(new ServiceImpl());

endpoint.setExecutor(threadPool);

endpoint.publish(address);

System.out.println("endpoint = " + endpoint.isPublished());
Remote Proxy - JDK only
21
@SvenRuppert
Proxy Remote
Service
Interface
Interface
remote communication
client server
Remote Proxy - JDK only
22
@SvenRuppert
public class ServiceRemoteProxy implements Service {



private URL url;

private Service realSubject;

final String namespaceURI = "http://rapidpm.org/";

final String localPart = "ServiceImplService";



public ServiceRemoteProxy() {

try {

url = new URL("http://localhost:9999/ws/service?wsdl");

QName qname = new QName(namespaceURI, localPart);

javax.xml.ws.Service service = javax.xml.ws.Service.create(url, qname);

realSubject = service.getPort(Service.class);

} catch (MalformedURLException e) {

e.printStackTrace();

}

}

public String work(String txt){

return realSubject.work(txt);

}

}
Remote Proxy - JDK only
23
@SvenRuppert
Proxy
Remote
Service
Interface
Interface
remote communication
client server
• remote communication
• most of this is technology based work
• goal: developer will see no remote
communication
Virtual Proxy
24
@SvenRuppert
public class ServiceProxy implements Service {

private Service service = new ServiceImpl();

public String work(String txt) { return service.work(txt); }

}
What could we
change now ?
Virtual Proxy:
create the Delegator later
public class VirtualService implements Service {

private Service service = null;

public String work(String txt) {

if(service == null) { service = new ServiceImpl(); }

return service.work(txt);

}

}
Virtual Proxy
25
@SvenRuppert
public class VirtualService implements Service {

private Service service = null;

public String work(String txt) {

if(service == null) { service = new ServiceImpl(); }


return service.work(txt);

}

}
This is NOT ThreadSave
fixed decision for
an implementation
how to combine it with
a FactoryPattern ?
Virtual Proxy
26
@SvenRuppert
if(service == null) { service = new ServiceImpl(); }

public interface ServiceFactory {

Service createInstance();

}
public interface ServiceStrategyFactory {

Service realSubject(ServiceFactory factory);

}
Virtual Proxy - Not - ThreadSave
27
@SvenRuppert
if(service == null) { service = new ServiceImpl(); }

public class ServiceStrategyFactoryImpl implements ServiceStrategyFactory {

Service realSubject;

public Service realSubject(final ServiceFactory factory) {

if (realSubject == null) {

realSubject = factory.createInstance();

}

return realSubject;

}

}
private ServiceFactory serviceFactory = ServiceImpl::new;
Virtual Proxy - Not - ThreadSave
28
@SvenRuppert
if(service == null) { service = new ServiceImpl(); }

public class ServiceProxy implements Service {
private ServiceFactory serviceFactory = ServiceImpl::new;
private ServiceStrategyFactory strategyFactory = new ServiceStrategyFactoryImpl();
public String work(String txt) {
return strategyFactory .realSubject(serviceFactory).work(txt);
}

}
Virtual Proxy - Synchronized
29
@SvenRuppert
if(service == null) { service = new ServiceImpl(); }

public class ServiceStrategyFactorySynchronized implements ServiceStrategyFactory {

Service realSubject;

public synchronized Service realSubject(final ServiceFactory factory) {

if (realSubject == null) {

realSubject = factory.createInstance();

}

return realSubject;

}

}
private ServiceFactory serviceFactory = ServiceImpl::new;
This is ThreadSave
Combining Proxies
30
@SvenRuppert
Security Proxy Virtual ProxyRemote Proxy
Security ProxyVirtual ProxyRemote Proxy
Security ProxyVirtual Proxy Remote Proxy
VirtualProxies are mostly the last one
combining Proxies is easy
SecurityProxies are mostly the first one ?
Combining Proxies - SecureVirtualProxy
31
@SvenRuppert
Security Proxy Virtual Proxy
public class VirtualProxy implements Service {

public VirtualProxy() { out.println("VirtualProxy " + now()); }

private Service service = null;

public String work(String txt) {

if(service == null) { service = new ServiceImpl(); }

return service.work(txt);

}

}
public class SecureVirtualProxy implements Service {

public SecureProxy() { out.println("SecureProxy " + now()); }

private Service service = new VirtualProxy();

//SNIPP….

public String work(String txt) {

if(code.equals("hoppel")) { return service.work(txt); }

return { return "nooooop"; }

}

}
hard wired proxies
What could we
change now ?
Combining Proxies - SecureVirtualProxy
32
@SvenRuppert
Security Proxy Virtual Proxy
hard wired proxies
What could we
change now ?
we need a Generic Proxy
since JDK1.3 we have it
the DynamicProxy
Dynamic Proxy - Hello World
33
@SvenRuppert
How to use it ?
java.lang.reflect.Proxy
we need an interface : here Service
we need an implementation : here ServiceImpl
Service proxyInstance = Service.class.cast( Proxy.newProxyInstance(

Service.class.getClassLoader(),

new Class<?>[]{Service.class},

new InvocationHandler() {

private final ServiceImpl service = new ServiceImpl();

@Override

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

return method.invoke(service, args);

}

}

)

);
OK, step by step , please
Dynamic Proxy - Hello World
34
@SvenRuppert
Proxy.newProxyInstance (
Service.class.getClassLoader(),
new Class<?>[]{Service.class},
Service proxyInstance = Service.class.cast (
new InvocationHandler() {

private final ServiceImpl service = new ServiceImpl();

@Override

public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {

return m.invoke(service, args);

}

}

)

);
how to make a VirtualProxy ?
Dynamic Virtual Proxy
35
@SvenRuppert
Proxy.newProxyInstance (
Service.class.getClassLoader(),
new Class<?>[]{Service.class},
Service proxyInstance = Service.class.cast (
new InvocationHandler() {

private final ServiceImpl service;

@Override

public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {

if(service == null) { service = new ServiceImpl(); }
return m.invoke(service, args);

}

}

)

);
Dynamic Proxy - make it generic
36
@SvenRuppert
Proxy.newProxyInstance (
Service.class.getClassLoader(),
new Class<?>[]{Service.class},
Service proxyInstance = Service.class.cast (
new InvocationHandler() {

private final ServiceImpl service = new ServiceImpl();

@Override

public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {

return m.invoke(service, args);

}

}

)

);
get it from outside
we will remove it
we will get it from outside
and finally we will call it ProxyGenerator
Dynamic Proxy - make it generic
37
@SvenRuppert
public class ProxyGenerator {

public static <P> P makeProxy(Class<P> subject, P realSubject) {

Object proxyInstance = Proxy.newProxyInstance(

subject.getClassLoader(),

new Class<?>[]{subject},

new InvocationHandler() {

@Override

public Object invoke(final Object proxy, final Method m, final Object[] args) throws Throwable {

return m.invoke(realSubject, args);

}

}

);

return subject.cast(proxyInstance);

}

}
Dynamic Proxy - make it generic
38
@SvenRuppert
public class ProxyGenerator {

public static <P> P makeProxy(Class<P> subject, P realSubject) {

Object proxyInstance = Proxy.newProxyInstance(

subject.getClassLoader(),

new Class<?>[]{subject},

(proxy, m, args) -> m.invoke(realSubject, args)

);

return subject.cast(proxyInstance);

}

}
Dynamic Proxy - make it generic
39
@SvenRuppert
with DynamicProxies
- we are writing less (more generic) code
- we can create Virtual-/Remote-/Security Proxies
but how to combine Proxies more generic ?
Dynamic Proxy - make it generic
40
@SvenRuppert
but how to combine Proxies more generic ?
for this we have to switch from
Factory-Method-Pattern
Builder-Pattern
DynamicProxyBuilder
41
@SvenRuppert
but how to combine Proxies more generic ?
Security Proxy Virtual ProxySecurity Proxy
let´s think about Two possible ways:
1 Security Proxy with 2 Rules and 1 VirtualProxy
2 Security Proxies with 1 Rule and 1 VirtualProxy
OK, we need a generic CascadedProxy
DynamicProxyBuilder
42
@SvenRuppert
OK, we need a generic CascadedProxy
Proxy n
Proxy n-1
Proxy n-2
Proxy n-3
a child must know his parent
first we only add different DynamicProxies
always the same target interface
DynamicProxyBuilder
43
@SvenRuppert
private List<SecurityRule> securityRules = new ArrayList<>();
for example: add n SecurityRules
public interface SecurityRule {

boolean checkRule();

}
functional interface
Collections.reverse(securityRules);

securityRules.forEach(this::build_addSecurityRule);
DynamicProxyBuilder
44
@SvenRuppert
private ProxyBuilder<I, T> build_addSecurityRule(SecurityRule rule) {

final ClassLoader classLoader = original.getClass().getClassLoader();

final Class<?>[] interfaces = {clazz};

final Object nextProxy = Proxy.newProxyInstance(

classLoader, interfaces,

new InvocationHandler() {

private T original = ProxyBuilder.this.original;

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

final boolean checkRule = rule.checkRule();

if (checkRule) {

return method.invoke(original, args);

} else {

return null;

}

}

});

original = (T) clazz.cast(nextProxy);

return this;

}
how this will be used ?
last child
work on child
set child for next level
DynamicProxyBuilder
45
@SvenRuppert
final InnerDemoClass original = new InnerDemoClass();
final InnerDemoInterface demoLogic =
ProxyBuilder.createBuilder(InnerDemoInterface.class, original)

.addLogging()
.addMetrics()
.addSecurityRule(() -> true)
.addSecurityRule(() -> true)
.build();
DynamicObjectAdapter - orig Version
46
@SvenRuppert
the original Version of the DynamicObjectAdapter
was written by Dr. Heinz Kabutz
DynamicObjectAdapter - orig Version
47
@SvenRuppert
Proxy
orig /
adapter
invoke orig
invoke adapter
Goal: do not need to write an
Adapter with Delegator
DynamicObjectAdapter - orig Version
48
@SvenRuppert
core concept:
switching between method implementations
how to identify a method?
DynamicObjectAdapter - orig. Version
49
@SvenRuppert
public interface Service {

String doWork_A();

}



public static class ServiceImpl implements Service {

public String doWork_A() {

return ServiceImpl.class.getSimpleName();

}

}
DynamicObjectAdapter - orig Version
50
@SvenRuppert
how to identify a method?
public class MethodIdentifier {

private final String name;

private final Class[] parameters;



public MethodIdentifier(Method m) {

name = m.getName();

parameters = m.getParameterTypes();

}

// we can save time by assuming that we only compare against

// other MethodIdentifier objects

public boolean equals(Object o) {

MethodIdentifier mid = (MethodIdentifier) o;

return name.equals(mid.name) &&

Arrays.equals(parameters, mid.parameters);

}

public int hashCode() { return name.hashCode(); }

}
DynamicObjectAdapter - orig. Version
51
@SvenRuppert
private static class DOAInvocationHandler<T extends I, I> implements InvocationHandler {
private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();
private T original; private Object adapter;
private void addAdapter(Object adapter) {
this.adapter = adapter;
final Class<?> adapterClass = adapter.getClass();
Method[] methods = adapterClass.getDeclaredMethods();
for (Method m : methods) {
final MethodIdentifier key = new MethodIdentifier(m);
adaptedMethods.put(key, m);
}

}
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
}

}
//SNIPP
DynamicObjectAdapter - orig. Version
52
@SvenRuppert
} catch (InvocationTargetException e) { throw e.getTargetException(); }

private static class DOAInvocationHandler<T extends I, I> implements InvocationHandler {
private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();
private T original; private Object adapter;
private void addAdapter(Object adapter) {
}
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
Method other = adaptedMethods.get(key);
try {

final MethodIdentifier key = new MethodIdentifier(m);
if (other != null) { return other.invoke(adapter, args); }
else { return m.invoke(original, args); }
}

}
//SNIPP
what could be a problem ?
what could be improved ?
DynamicObjectAdapter - orig. Version
53
@SvenRuppert
private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();
private T original; private Object adapter;
private void addAdapter(Object adapter) {
what could be a problem ?
what could be improved ?
public interface Service {

String doWork_A();

}
public class Adapter_A {

public String doWork_A() { .. }

}
public class Adapter_B {

public String doWork_B() { .. }

}
DynamicObjectAdapter - orig Version
54
@SvenRuppert
Proxy
orig /
adapter
invoke orig
invoke adapter
DynamicObjectAdapter - ext. Version
55
@SvenRuppert
first extension !
DynamicObjectAdapter - ext. Version
56
@SvenRuppert
public interface Service {

String doWork_A(String txt);

String doWork_B(String txt);

}
public static class ServiceImpl implements Service {



public String doWork_A(String txt) {

return "doWorkd_A_Original";

}



public String doWork_B(String txt) {

return "doWorkd_B_Original";

}

}
DynamicObjectAdapter - ext. Version
57
@SvenRuppert
public interface Service {

String doWork_A(String txt);

String doWork_B(String txt);

}
public interface ServiceAdapter_A {

String doWork_A(String txt);

}



public interface ServiceAdapter_B {

String doWork_B(String txt);

}
functional interface
functional interface
DynamicObjectAdapter - ext. Version
58
@SvenRuppert
private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();

private Map<MethodIdentifier, Object> adapters = new HashMap<>();



private T original;

private Class<T> target;
}

}
private void addAdapter(Object adapter) {
final Class<?> adapterClass = adapter.getClass();
Method[] methods = adapterClass.getDeclaredMethods();
for (Method m : methods) {
final MethodIdentifier key = new MethodIdentifier(m);
adaptedMethods.put(key, m);
adapters.put(key, adapter);
DynamicObjectAdapter - ext. Version
59
@SvenRuppert
private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();

private Map<MethodIdentifier, Object> adapters = new HashMap<>();



private T original;

private Class<T> target;
} catch (InvocationTargetException e) {

throw e.getTargetException();

}

}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {

final MethodIdentifier key = new MethodIdentifier(method);

Method other = adaptedMethods.get(key);
if (other != null) {

return other.invoke(adapters.get(key), args);

} else {

return method.invoke(original, args);

}

DynamicObjectAdapter - ext. Version @SvenRuppert
private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();

private Map<MethodIdentifier, Object> adapters = new HashMap<>();



private T original;

private Class<T> target;
if you will use this without a Builder
you can add useless Adapter !!
Add some typed with-Methods
DynamicObjectAdapter - orig Version @SvenRuppert
Add some typed with-Methods
public AdapterBuilder<T> withDoWork_A(ServiceAdapter_A adapter) {

addAdapter(adapter);

return this;

}
remember public interface Service {

String doWork_A(String txt);

String doWork_B(String txt);

}
public interface ServiceAdapter_A {

String doWork_A(String txt);

}

DynamicObjectAdapter - orig Version @SvenRuppert
.build();
How to use this?
Service service = AdapterBuilder.<Service>newBuilder()
.withTarget(Service.class)
.withOriginal(new ServiceImpl())
.withDoWork_A((txt) -> txt + "_part")
generated DynamicObjectAdapterBuilder @SvenRuppert
To much boring code to write
but we want to have a type-save version
What could we
change now ?
if wrong… compile must break
generated DynamicObjectAdapterBuilder @SvenRuppert
remember
public interface Service {

String doWork_A(String txt);

String doWork_B(String txt);

}
public interface ServiceAdapter_A {

String doWork_A(String txt);

}



public interface ServiceAdapter_B {

String doWork_B(String txt);

}
functional interface
generated DynamicObjectAdapterBuilder @SvenRuppert
use Annotation Processing
create a marker like
@DynamicObjectAdapterBuilder
@Retention(RetentionPolicy.SOURCE)

@Target(ElementType.TYPE)

public @interface DynamicObjectAdapterBuilder {

}
public class AnnotationProcessor extends AbstractProcessor
generated DynamicObjectAdapterBuilder @SvenRuppert
use Annotation Processing
with every compile you will get actual
Functional-Interfaces for the Adapters
generated AdapterBuilder
Summary
67
@SvenRuppert
we got type-save ProxyBuilder
..type-save generated DynamicObjectAdapter
..at runtime we could change the chain of Proxies
..could be used for
(Dynamic)
Dependency Injection Implementations
Summary
68
@SvenRuppert
If you are interested…
have a look at RapidPM on github
rapidpm-proxybuilder
rapidpm-dynamic-cdi
rapidpm-microservice
or contact me ;-) @SvenRuppert
Thank You !!!

More Related Content

What's hot

Introduction to nsubstitute
Introduction to nsubstituteIntroduction to nsubstitute
Introduction to nsubstituteSuresh Loganatha
 
Fun with QML
Fun with QMLFun with QML
Fun with QMLICS
 
Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streams
Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streamsTech talks annual 2015 kirk pepperdine_ripping apart java 8 streams
Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streamsTechTalks
 
MarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt frameworkMarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt frameworkLeonardo Arcari
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Mario Fusco
 
What's new in c# 10
What's new in c# 10What's new in c# 10
What's new in c# 10Moaid Hathot
 
The Erlang Programming Language
The Erlang Programming LanguageThe Erlang Programming Language
The Erlang Programming LanguageDennis Byrne
 
разработка серверов и серверных приложений лекция №4
разработка серверов и серверных приложений лекция №4разработка серверов и серверных приложений лекция №4
разработка серверов и серверных приложений лекция №4Eugeniy Tyumentcev
 
The Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFuturesThe Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFuturesHaim Yadid
 
Reactive programming with RxAndroid
Reactive programming with RxAndroidReactive programming with RxAndroid
Reactive programming with RxAndroidSavvycom Savvycom
 
Best Practices in Qt Quick/QML - Part 4
Best Practices in Qt Quick/QML - Part 4Best Practices in Qt Quick/QML - Part 4
Best Practices in Qt Quick/QML - Part 4ICS
 
Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015Sven Ruppert
 
Processing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) PregelProcessing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) PregelArangoDB Database
 
Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4ICS
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsKonrad Malawski
 
Integrating Erlang and Java
Integrating Erlang and Java Integrating Erlang and Java
Integrating Erlang and Java Dennis Byrne
 

What's hot (20)

Introduction to nsubstitute
Introduction to nsubstituteIntroduction to nsubstitute
Introduction to nsubstitute
 
Firebase ng2 zurich
Firebase ng2 zurichFirebase ng2 zurich
Firebase ng2 zurich
 
Fun with QML
Fun with QMLFun with QML
Fun with QML
 
Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streams
Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streamsTech talks annual 2015 kirk pepperdine_ripping apart java 8 streams
Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streams
 
MarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt frameworkMarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt framework
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...
 
What's new in c# 10
What's new in c# 10What's new in c# 10
What's new in c# 10
 
The Erlang Programming Language
The Erlang Programming LanguageThe Erlang Programming Language
The Erlang Programming Language
 
разработка серверов и серверных приложений лекция №4
разработка серверов и серверных приложений лекция №4разработка серверов и серверных приложений лекция №4
разработка серверов и серверных приложений лекция №4
 
Completable future
Completable futureCompletable future
Completable future
 
Reactive Java (33rd Degree)
Reactive Java (33rd Degree)Reactive Java (33rd Degree)
Reactive Java (33rd Degree)
 
The Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFuturesThe Future of Futures - A Talk About Java 8 CompletableFutures
The Future of Futures - A Talk About Java 8 CompletableFutures
 
Reactive programming with RxAndroid
Reactive programming with RxAndroidReactive programming with RxAndroid
Reactive programming with RxAndroid
 
Best Practices in Qt Quick/QML - Part 4
Best Practices in Qt Quick/QML - Part 4Best Practices in Qt Quick/QML - Part 4
Best Practices in Qt Quick/QML - Part 4
 
Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015
 
Processing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) PregelProcessing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) Pregel
 
Parallel streams in java 8
Parallel streams in java 8Parallel streams in java 8
Parallel streams in java 8
 
Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 
Integrating Erlang and Java
Integrating Erlang and Java Integrating Erlang and Java
Integrating Erlang and Java
 

Viewers also liked

JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDISven Ruppert
 
Java8 ready for the future
Java8 ready for the futureJava8 ready for the future
Java8 ready for the futureSven Ruppert
 
Active Directory Win Server
Active Directory Win ServerActive Directory Win Server
Active Directory Win ServerHajra Rasmita
 
【世界を身近に感じるデザイン】3班
【世界を身近に感じるデザイン】3班【世界を身近に感じるデザイン】3班
【世界を身近に感じるデザイン】3班tokyo_designers_week
 
【新しい学びのカタチのデザイン】1班
【新しい学びのカタチのデザイン】1班【新しい学びのカタチのデザイン】1班
【新しい学びのカタチのデザイン】1班tokyo_designers_week
 
From Jurassic Park to Microservices
From Jurassic Park to MicroservicesFrom Jurassic Park to Microservices
From Jurassic Park to MicroservicesSven Ruppert
 
DI Frameworks - hidden pearls
DI Frameworks - hidden pearlsDI Frameworks - hidden pearls
DI Frameworks - hidden pearlsSven Ruppert
 
From jUnit to Mutationtesting
From jUnit to MutationtestingFrom jUnit to Mutationtesting
From jUnit to MutationtestingSven Ruppert
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Sven Ruppert
 
Java FX8 JumpStart - JUG ch - zürich
Java FX8   JumpStart - JUG ch - zürichJava FX8   JumpStart - JUG ch - zürich
Java FX8 JumpStart - JUG ch - zürichSven Ruppert
 
Soft Power Presentation
Soft Power PresentationSoft Power Presentation
Soft Power Presentationvadim003
 
Strategi penetapan harga
Strategi penetapan hargaStrategi penetapan harga
Strategi penetapan hargaHajra Rasmita
 

Viewers also liked (14)

JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Java8 ready for the future
Java8 ready for the futureJava8 ready for the future
Java8 ready for the future
 
Active Directory Win Server
Active Directory Win ServerActive Directory Win Server
Active Directory Win Server
 
【世界を身近に感じるデザイン】3班
【世界を身近に感じるデザイン】3班【世界を身近に感じるデザイン】3班
【世界を身近に感じるデザイン】3班
 
【新しい学びのカタチのデザイン】1班
【新しい学びのカタチのデザイン】1班【新しい学びのカタチのデザイン】1班
【新しい学びのカタチのデザイン】1班
 
From Jurassic Park to Microservices
From Jurassic Park to MicroservicesFrom Jurassic Park to Microservices
From Jurassic Park to Microservices
 
DI Frameworks - hidden pearls
DI Frameworks - hidden pearlsDI Frameworks - hidden pearls
DI Frameworks - hidden pearls
 
From jUnit to Mutationtesting
From jUnit to MutationtestingFrom jUnit to Mutationtesting
From jUnit to Mutationtesting
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001
 
1.konsep rangkaian listrik
1.konsep rangkaian listrik1.konsep rangkaian listrik
1.konsep rangkaian listrik
 
Java FX8 JumpStart - JUG ch - zürich
Java FX8   JumpStart - JUG ch - zürichJava FX8   JumpStart - JUG ch - zürich
Java FX8 JumpStart - JUG ch - zürich
 
Soft Power Presentation
Soft Power PresentationSoft Power Presentation
Soft Power Presentation
 
Strategi penetapan harga
Strategi penetapan hargaStrategi penetapan harga
Strategi penetapan harga
 
CH-Resume.01062016
CH-Resume.01062016CH-Resume.01062016
CH-Resume.01062016
 

Similar to Proxy Deep Dive JUG Saxony Day 2015-10-02

4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message BrokersPROIDEA
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonAEM HUB
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling RewriterJustin Edelson
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
 
Testing in android
Testing in androidTesting in android
Testing in androidjtrindade
 
Spring Cloud Data Flow Overview
Spring Cloud Data Flow OverviewSpring Cloud Data Flow Overview
Spring Cloud Data Flow OverviewVMware Tanzu
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQNahidul Kibria
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineRoman Kirillov
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsSebastian Springer
 
Google Developer Fest 2010
Google Developer Fest 2010Google Developer Fest 2010
Google Developer Fest 2010Chris Ramsdale
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with javaDPC Consulting Ltd
 
Cloud Native Serverless Java — Orkhan Gasimov
Cloud Native Serverless Java — Orkhan GasimovCloud Native Serverless Java — Orkhan Gasimov
Cloud Native Serverless Java — Orkhan GasimovGlobalLogic Ukraine
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Chris Ramsdale
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every dayVadym Khondar
 
JavaOne 2013 BOF2924 HoneySpiderNetwork
JavaOne 2013 BOF2924 HoneySpiderNetworkJavaOne 2013 BOF2924 HoneySpiderNetwork
JavaOne 2013 BOF2924 HoneySpiderNetworknvaneijck
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and FriendsYun Zhi Lin
 

Similar to Proxy Deep Dive JUG Saxony Day 2015-10-02 (20)

Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 
4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin Edelson
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
 
Testing in android
Testing in androidTesting in android
Testing in android
 
Gwt.create
Gwt.createGwt.create
Gwt.create
 
Spring Cloud Data Flow Overview
Spring Cloud Data Flow OverviewSpring Cloud Data Flow Overview
Spring Cloud Data Flow Overview
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQ
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.js
 
Google Developer Fest 2010
Google Developer Fest 2010Google Developer Fest 2010
Google Developer Fest 2010
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with java
 
Cloud Native Serverless Java — Orkhan Gasimov
Cloud Native Serverless Java — Orkhan GasimovCloud Native Serverless Java — Orkhan Gasimov
Cloud Native Serverless Java — Orkhan Gasimov
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
JBoss World 2010
JBoss World 2010JBoss World 2010
JBoss World 2010
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
JavaOne 2013 BOF2924 HoneySpiderNetwork
JavaOne 2013 BOF2924 HoneySpiderNetworkJavaOne 2013 BOF2924 HoneySpiderNetwork
JavaOne 2013 BOF2924 HoneySpiderNetwork
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 

More from Sven Ruppert

JUnit5 Custom TestEngines intro - version 2020-06
JUnit5 Custom TestEngines intro - version 2020-06JUnit5 Custom TestEngines intro - version 2020-06
JUnit5 Custom TestEngines intro - version 2020-06Sven Ruppert
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceSven Ruppert
 
Vaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java DevsVaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java DevsSven Ruppert
 
Functional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed MelbourneFunctional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed MelbourneSven Ruppert
 
Functional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - SlidesFunctional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - SlidesSven Ruppert
 
From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017Sven Ruppert
 
Warum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi steheWarum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi steheSven Ruppert
 

More from Sven Ruppert (7)

JUnit5 Custom TestEngines intro - version 2020-06
JUnit5 Custom TestEngines intro - version 2020-06JUnit5 Custom TestEngines intro - version 2020-06
JUnit5 Custom TestEngines intro - version 2020-06
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
Vaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java DevsVaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java Devs
 
Functional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed MelbourneFunctional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed Melbourne
 
Functional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - SlidesFunctional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - Slides
 
From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017
 
Warum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi steheWarum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi stehe
 

Recently uploaded

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Proxy Deep Dive JUG Saxony Day 2015-10-02

  • 1. prepare for….. Proxy Deep Dive JUG Saxony Day 2015 1 @SvenRuppert
  • 2. @SvenRuppert has been coding java since 1996 Fellow / Senior Manager reply Group Germany - Munich 2
  • 3. @SvenRuppert has been coding java since 1996 Projects in the field of: •Automobile-industry •Energy •Finance / Leasing •Space- Satellit- •Government / UN / World-bank Where? •Europe •Asia - from India up to Malaysia 3
  • 4. Why a Proxy ? 4 @SvenRuppert Proxies you can use them for : generic parts inside your application hiding technical stuff decouple parts of your applications
  • 5. Why a Proxy ? 5 @SvenRuppert final InnerDemoClass original = new InnerDemoClass(); final InnerDemoInterface demoLogic = ProxyBuilder.createBuilder(InnerDemoInterface.class, original)
 .addLogging() .addMetrics() .addSecurityRule(() -> true) .addSecurityRule(() -> true) .build(); but it must be easy to use like…
  • 6. Why a Proxy ? 6 @SvenRuppert @Inject @Proxy(virtual = true, metrics = true) Service service;
  • 7. Adapter v Proxy - Pattern Hello World 7 @SvenRuppert Difference between Proxy and Adapter
  • 8. Adapter v Proxy - Pattern Hello World Adapter - or called Wrapper maybe : Use an Adapter if you have to use an incompatible interface between two systems. In detail I am using/talking about an Adapter with Delegator. 8 @SvenRuppert
  • 9. Adapter v Proxy - Pattern Hello World public class LegacyWorker {
 public void writeTheStrings(String[] strArray){
 Arrays.stream(strArray).forEach(System.out::println);
 }
 } 9 public interface WorkerAdapter {
 public void workOnSomething(List<String> stringListe);
 } public class Adapter implements WorkerAdapter {
 private LegacyWorker worker = new LegacyWorker();
 @Override
 public void workOnSomething(List<String> stringListe) {
 final String[] strings = stringListe.toArray(new String[0]);
 worker.writeTheStrings(strings);
 }
 } @SvenRuppert
  • 10. Adapter v Proxy - Pattern Hello World public class Main {
 public static void main(String[] args) {
 final ArrayList<String> strings = new ArrayList<>();
 Collections.addAll(strings, „A","B","C","D"); 
 new Adapter().workOnSomething(strings);
 }
 } 10 • No need to know the LegacyWorker • No inheritance between LegacyWorker and Adapter • only a transformation of an interface • same creation time for Delegator and Adapter @SvenRuppert
  • 11. Proxy - the easiest version 11 • We need to know the LegacyWorker • Inheritance between LegacyWorker and Adapter • do not use it like an Adapter ! @SvenRuppert We need a few steps to come from an Adapter with Delegator to a Proxy please show the code
  • 12. Proxy - the easiest version - (Delegator) public interface Service {
 String work(String txt);
 } 12 @SvenRuppert public class ServiceImpl implements Service {
 public String work(String txt) {
 return "ServiceImpl - " + txt;
 }
 } public class ServiceProxy implements Service {
 private Service service = new ServiceImpl();
 public String work(String txt) { return service.work(txt); }
 }
  • 13. Security Proxy 13 @SvenRuppert public class ServiceProxy implements Service {
 private Service service = new ServiceImpl();
 public String work(String txt) { return service.work(txt); }
 } What could we change now ? SecurityProxy: execute only if it is allowed public class ServiceSecurityProxy implements Service {
 private Service service = new ServiceImpl();
 private String code; //who will set this ?
 public String work(String txt) {
 if(code.equals(„hoppel")) { return service.work(txt); }
 else { return "nooooop"; }
 }
 }
  • 14. Remote Proxy - JDK only 14 @SvenRuppert public class ServiceProxy implements Service {
 private Service service = new ServiceImpl();
 public String work(String txt) { return service.work(txt); }
 } What could we change now ? RemoteProxy: execute outside of my process Service proxy = new ServiceRemoteProxy();
 String hello = proxy.work(„Hello"); some work needed
  • 15. Remote Proxy - JDK only 15 @SvenRuppert Proxy Remote Service Interface Interface remote communication client server
  • 16. Remote Proxy - JDK only 16 @SvenRuppert @WebService
 @SOAPBinding(style = SOAPBinding.Style.RPC)
 public interface Service {
 @WebMethod
 public String work(String txt);
 }
  • 17. Remote Proxy - JDK only 17 @SvenRuppert Proxy Remote Service Interface Interface remote communication client server
  • 18. Remote Proxy - JDK only 18 @SvenRuppert @SOAPBinding(style = SOAPBinding.Style.RPC)
 @WebService(endpointInterface = "org.rapidpm.Service")
 public class ServiceImpl implements Service {
 @Override
 public String work(String txt) {
 return "ServiceImpl - " + txt;
 }
 }
  • 19. Remote Proxy - JDK only 19 @SvenRuppert Proxy Remote Service Interface Interface remote communication client server
  • 20. Remote Proxy - JDK only 20 @SvenRuppert final String address = "http://localhost:9999/ws/service";
 final ExecutorService threadPool = Executors.newFixedThreadPool(10);
 final Endpoint endpoint = Endpoint.create(new ServiceImpl());
 endpoint.setExecutor(threadPool);
 endpoint.publish(address);
 System.out.println("endpoint = " + endpoint.isPublished());
  • 21. Remote Proxy - JDK only 21 @SvenRuppert Proxy Remote Service Interface Interface remote communication client server
  • 22. Remote Proxy - JDK only 22 @SvenRuppert public class ServiceRemoteProxy implements Service {
 
 private URL url;
 private Service realSubject;
 final String namespaceURI = "http://rapidpm.org/";
 final String localPart = "ServiceImplService";
 
 public ServiceRemoteProxy() {
 try {
 url = new URL("http://localhost:9999/ws/service?wsdl");
 QName qname = new QName(namespaceURI, localPart);
 javax.xml.ws.Service service = javax.xml.ws.Service.create(url, qname);
 realSubject = service.getPort(Service.class);
 } catch (MalformedURLException e) {
 e.printStackTrace();
 }
 }
 public String work(String txt){
 return realSubject.work(txt);
 }
 }
  • 23. Remote Proxy - JDK only 23 @SvenRuppert Proxy Remote Service Interface Interface remote communication client server • remote communication • most of this is technology based work • goal: developer will see no remote communication
  • 24. Virtual Proxy 24 @SvenRuppert public class ServiceProxy implements Service {
 private Service service = new ServiceImpl();
 public String work(String txt) { return service.work(txt); }
 } What could we change now ? Virtual Proxy: create the Delegator later public class VirtualService implements Service {
 private Service service = null;
 public String work(String txt) {
 if(service == null) { service = new ServiceImpl(); }
 return service.work(txt);
 }
 }
  • 25. Virtual Proxy 25 @SvenRuppert public class VirtualService implements Service {
 private Service service = null;
 public String work(String txt) {
 if(service == null) { service = new ServiceImpl(); } 
 return service.work(txt);
 }
 } This is NOT ThreadSave fixed decision for an implementation how to combine it with a FactoryPattern ?
  • 26. Virtual Proxy 26 @SvenRuppert if(service == null) { service = new ServiceImpl(); }
 public interface ServiceFactory {
 Service createInstance();
 } public interface ServiceStrategyFactory {
 Service realSubject(ServiceFactory factory);
 }
  • 27. Virtual Proxy - Not - ThreadSave 27 @SvenRuppert if(service == null) { service = new ServiceImpl(); }
 public class ServiceStrategyFactoryImpl implements ServiceStrategyFactory {
 Service realSubject;
 public Service realSubject(final ServiceFactory factory) {
 if (realSubject == null) {
 realSubject = factory.createInstance();
 }
 return realSubject;
 }
 } private ServiceFactory serviceFactory = ServiceImpl::new;
  • 28. Virtual Proxy - Not - ThreadSave 28 @SvenRuppert if(service == null) { service = new ServiceImpl(); }
 public class ServiceProxy implements Service { private ServiceFactory serviceFactory = ServiceImpl::new; private ServiceStrategyFactory strategyFactory = new ServiceStrategyFactoryImpl(); public String work(String txt) { return strategyFactory .realSubject(serviceFactory).work(txt); }
 }
  • 29. Virtual Proxy - Synchronized 29 @SvenRuppert if(service == null) { service = new ServiceImpl(); }
 public class ServiceStrategyFactorySynchronized implements ServiceStrategyFactory {
 Service realSubject;
 public synchronized Service realSubject(final ServiceFactory factory) {
 if (realSubject == null) {
 realSubject = factory.createInstance();
 }
 return realSubject;
 }
 } private ServiceFactory serviceFactory = ServiceImpl::new; This is ThreadSave
  • 30. Combining Proxies 30 @SvenRuppert Security Proxy Virtual ProxyRemote Proxy Security ProxyVirtual ProxyRemote Proxy Security ProxyVirtual Proxy Remote Proxy VirtualProxies are mostly the last one combining Proxies is easy SecurityProxies are mostly the first one ?
  • 31. Combining Proxies - SecureVirtualProxy 31 @SvenRuppert Security Proxy Virtual Proxy public class VirtualProxy implements Service {
 public VirtualProxy() { out.println("VirtualProxy " + now()); }
 private Service service = null;
 public String work(String txt) {
 if(service == null) { service = new ServiceImpl(); }
 return service.work(txt);
 }
 } public class SecureVirtualProxy implements Service {
 public SecureProxy() { out.println("SecureProxy " + now()); }
 private Service service = new VirtualProxy();
 //SNIPP….
 public String work(String txt) {
 if(code.equals("hoppel")) { return service.work(txt); }
 return { return "nooooop"; }
 }
 } hard wired proxies What could we change now ?
  • 32. Combining Proxies - SecureVirtualProxy 32 @SvenRuppert Security Proxy Virtual Proxy hard wired proxies What could we change now ? we need a Generic Proxy since JDK1.3 we have it the DynamicProxy
  • 33. Dynamic Proxy - Hello World 33 @SvenRuppert How to use it ? java.lang.reflect.Proxy we need an interface : here Service we need an implementation : here ServiceImpl Service proxyInstance = Service.class.cast( Proxy.newProxyInstance(
 Service.class.getClassLoader(),
 new Class<?>[]{Service.class},
 new InvocationHandler() {
 private final ServiceImpl service = new ServiceImpl();
 @Override
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
 return method.invoke(service, args);
 }
 }
 )
 ); OK, step by step , please
  • 34. Dynamic Proxy - Hello World 34 @SvenRuppert Proxy.newProxyInstance ( Service.class.getClassLoader(), new Class<?>[]{Service.class}, Service proxyInstance = Service.class.cast ( new InvocationHandler() {
 private final ServiceImpl service = new ServiceImpl();
 @Override
 public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
 return m.invoke(service, args);
 }
 }
 )
 ); how to make a VirtualProxy ?
  • 35. Dynamic Virtual Proxy 35 @SvenRuppert Proxy.newProxyInstance ( Service.class.getClassLoader(), new Class<?>[]{Service.class}, Service proxyInstance = Service.class.cast ( new InvocationHandler() {
 private final ServiceImpl service;
 @Override
 public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
 if(service == null) { service = new ServiceImpl(); } return m.invoke(service, args);
 }
 }
 )
 );
  • 36. Dynamic Proxy - make it generic 36 @SvenRuppert Proxy.newProxyInstance ( Service.class.getClassLoader(), new Class<?>[]{Service.class}, Service proxyInstance = Service.class.cast ( new InvocationHandler() {
 private final ServiceImpl service = new ServiceImpl();
 @Override
 public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
 return m.invoke(service, args);
 }
 }
 )
 ); get it from outside we will remove it we will get it from outside and finally we will call it ProxyGenerator
  • 37. Dynamic Proxy - make it generic 37 @SvenRuppert public class ProxyGenerator {
 public static <P> P makeProxy(Class<P> subject, P realSubject) {
 Object proxyInstance = Proxy.newProxyInstance(
 subject.getClassLoader(),
 new Class<?>[]{subject},
 new InvocationHandler() {
 @Override
 public Object invoke(final Object proxy, final Method m, final Object[] args) throws Throwable {
 return m.invoke(realSubject, args);
 }
 }
 );
 return subject.cast(proxyInstance);
 }
 }
  • 38. Dynamic Proxy - make it generic 38 @SvenRuppert public class ProxyGenerator {
 public static <P> P makeProxy(Class<P> subject, P realSubject) {
 Object proxyInstance = Proxy.newProxyInstance(
 subject.getClassLoader(),
 new Class<?>[]{subject},
 (proxy, m, args) -> m.invoke(realSubject, args)
 );
 return subject.cast(proxyInstance);
 }
 }
  • 39. Dynamic Proxy - make it generic 39 @SvenRuppert with DynamicProxies - we are writing less (more generic) code - we can create Virtual-/Remote-/Security Proxies but how to combine Proxies more generic ?
  • 40. Dynamic Proxy - make it generic 40 @SvenRuppert but how to combine Proxies more generic ? for this we have to switch from Factory-Method-Pattern Builder-Pattern
  • 41. DynamicProxyBuilder 41 @SvenRuppert but how to combine Proxies more generic ? Security Proxy Virtual ProxySecurity Proxy let´s think about Two possible ways: 1 Security Proxy with 2 Rules and 1 VirtualProxy 2 Security Proxies with 1 Rule and 1 VirtualProxy OK, we need a generic CascadedProxy
  • 42. DynamicProxyBuilder 42 @SvenRuppert OK, we need a generic CascadedProxy Proxy n Proxy n-1 Proxy n-2 Proxy n-3 a child must know his parent first we only add different DynamicProxies always the same target interface
  • 43. DynamicProxyBuilder 43 @SvenRuppert private List<SecurityRule> securityRules = new ArrayList<>(); for example: add n SecurityRules public interface SecurityRule {
 boolean checkRule();
 } functional interface Collections.reverse(securityRules);
 securityRules.forEach(this::build_addSecurityRule);
  • 44. DynamicProxyBuilder 44 @SvenRuppert private ProxyBuilder<I, T> build_addSecurityRule(SecurityRule rule) {
 final ClassLoader classLoader = original.getClass().getClassLoader();
 final Class<?>[] interfaces = {clazz};
 final Object nextProxy = Proxy.newProxyInstance(
 classLoader, interfaces,
 new InvocationHandler() {
 private T original = ProxyBuilder.this.original;
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
 final boolean checkRule = rule.checkRule();
 if (checkRule) {
 return method.invoke(original, args);
 } else {
 return null;
 }
 }
 });
 original = (T) clazz.cast(nextProxy);
 return this;
 } how this will be used ? last child work on child set child for next level
  • 45. DynamicProxyBuilder 45 @SvenRuppert final InnerDemoClass original = new InnerDemoClass(); final InnerDemoInterface demoLogic = ProxyBuilder.createBuilder(InnerDemoInterface.class, original)
 .addLogging() .addMetrics() .addSecurityRule(() -> true) .addSecurityRule(() -> true) .build();
  • 46. DynamicObjectAdapter - orig Version 46 @SvenRuppert the original Version of the DynamicObjectAdapter was written by Dr. Heinz Kabutz
  • 47. DynamicObjectAdapter - orig Version 47 @SvenRuppert Proxy orig / adapter invoke orig invoke adapter Goal: do not need to write an Adapter with Delegator
  • 48. DynamicObjectAdapter - orig Version 48 @SvenRuppert core concept: switching between method implementations how to identify a method?
  • 49. DynamicObjectAdapter - orig. Version 49 @SvenRuppert public interface Service {
 String doWork_A();
 }
 
 public static class ServiceImpl implements Service {
 public String doWork_A() {
 return ServiceImpl.class.getSimpleName();
 }
 }
  • 50. DynamicObjectAdapter - orig Version 50 @SvenRuppert how to identify a method? public class MethodIdentifier {
 private final String name;
 private final Class[] parameters;
 
 public MethodIdentifier(Method m) {
 name = m.getName();
 parameters = m.getParameterTypes();
 }
 // we can save time by assuming that we only compare against
 // other MethodIdentifier objects
 public boolean equals(Object o) {
 MethodIdentifier mid = (MethodIdentifier) o;
 return name.equals(mid.name) &&
 Arrays.equals(parameters, mid.parameters);
 }
 public int hashCode() { return name.hashCode(); }
 }
  • 51. DynamicObjectAdapter - orig. Version 51 @SvenRuppert private static class DOAInvocationHandler<T extends I, I> implements InvocationHandler { private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>(); private T original; private Object adapter; private void addAdapter(Object adapter) { this.adapter = adapter; final Class<?> adapterClass = adapter.getClass(); Method[] methods = adapterClass.getDeclaredMethods(); for (Method m : methods) { final MethodIdentifier key = new MethodIdentifier(m); adaptedMethods.put(key, m); }
 } public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { }
 } //SNIPP
  • 52. DynamicObjectAdapter - orig. Version 52 @SvenRuppert } catch (InvocationTargetException e) { throw e.getTargetException(); }
 private static class DOAInvocationHandler<T extends I, I> implements InvocationHandler { private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>(); private T original; private Object adapter; private void addAdapter(Object adapter) { } public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { Method other = adaptedMethods.get(key); try {
 final MethodIdentifier key = new MethodIdentifier(m); if (other != null) { return other.invoke(adapter, args); } else { return m.invoke(original, args); } }
 } //SNIPP what could be a problem ? what could be improved ?
  • 53. DynamicObjectAdapter - orig. Version 53 @SvenRuppert private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>(); private T original; private Object adapter; private void addAdapter(Object adapter) { what could be a problem ? what could be improved ? public interface Service {
 String doWork_A();
 } public class Adapter_A {
 public String doWork_A() { .. }
 } public class Adapter_B {
 public String doWork_B() { .. }
 }
  • 54. DynamicObjectAdapter - orig Version 54 @SvenRuppert Proxy orig / adapter invoke orig invoke adapter
  • 55. DynamicObjectAdapter - ext. Version 55 @SvenRuppert first extension !
  • 56. DynamicObjectAdapter - ext. Version 56 @SvenRuppert public interface Service {
 String doWork_A(String txt);
 String doWork_B(String txt);
 } public static class ServiceImpl implements Service {
 
 public String doWork_A(String txt) {
 return "doWorkd_A_Original";
 }
 
 public String doWork_B(String txt) {
 return "doWorkd_B_Original";
 }
 }
  • 57. DynamicObjectAdapter - ext. Version 57 @SvenRuppert public interface Service {
 String doWork_A(String txt);
 String doWork_B(String txt);
 } public interface ServiceAdapter_A {
 String doWork_A(String txt);
 }
 
 public interface ServiceAdapter_B {
 String doWork_B(String txt);
 } functional interface functional interface
  • 58. DynamicObjectAdapter - ext. Version 58 @SvenRuppert private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();
 private Map<MethodIdentifier, Object> adapters = new HashMap<>();
 
 private T original;
 private Class<T> target; }
 } private void addAdapter(Object adapter) { final Class<?> adapterClass = adapter.getClass(); Method[] methods = adapterClass.getDeclaredMethods(); for (Method m : methods) { final MethodIdentifier key = new MethodIdentifier(m); adaptedMethods.put(key, m); adapters.put(key, adapter);
  • 59. DynamicObjectAdapter - ext. Version 59 @SvenRuppert private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();
 private Map<MethodIdentifier, Object> adapters = new HashMap<>();
 
 private T original;
 private Class<T> target; } catch (InvocationTargetException e) {
 throw e.getTargetException();
 }
 } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try {
 final MethodIdentifier key = new MethodIdentifier(method);
 Method other = adaptedMethods.get(key); if (other != null) {
 return other.invoke(adapters.get(key), args);
 } else {
 return method.invoke(original, args);
 }

  • 60. DynamicObjectAdapter - ext. Version @SvenRuppert private Map<MethodIdentifier, Method> adaptedMethods = new HashMap<>();
 private Map<MethodIdentifier, Object> adapters = new HashMap<>();
 
 private T original;
 private Class<T> target; if you will use this without a Builder you can add useless Adapter !! Add some typed with-Methods
  • 61. DynamicObjectAdapter - orig Version @SvenRuppert Add some typed with-Methods public AdapterBuilder<T> withDoWork_A(ServiceAdapter_A adapter) {
 addAdapter(adapter);
 return this;
 } remember public interface Service {
 String doWork_A(String txt);
 String doWork_B(String txt);
 } public interface ServiceAdapter_A {
 String doWork_A(String txt);
 }

  • 62. DynamicObjectAdapter - orig Version @SvenRuppert .build(); How to use this? Service service = AdapterBuilder.<Service>newBuilder() .withTarget(Service.class) .withOriginal(new ServiceImpl()) .withDoWork_A((txt) -> txt + "_part")
  • 63. generated DynamicObjectAdapterBuilder @SvenRuppert To much boring code to write but we want to have a type-save version What could we change now ? if wrong… compile must break
  • 64. generated DynamicObjectAdapterBuilder @SvenRuppert remember public interface Service {
 String doWork_A(String txt);
 String doWork_B(String txt);
 } public interface ServiceAdapter_A {
 String doWork_A(String txt);
 }
 
 public interface ServiceAdapter_B {
 String doWork_B(String txt);
 } functional interface
  • 65. generated DynamicObjectAdapterBuilder @SvenRuppert use Annotation Processing create a marker like @DynamicObjectAdapterBuilder @Retention(RetentionPolicy.SOURCE)
 @Target(ElementType.TYPE)
 public @interface DynamicObjectAdapterBuilder {
 } public class AnnotationProcessor extends AbstractProcessor
  • 66. generated DynamicObjectAdapterBuilder @SvenRuppert use Annotation Processing with every compile you will get actual Functional-Interfaces for the Adapters generated AdapterBuilder
  • 67. Summary 67 @SvenRuppert we got type-save ProxyBuilder ..type-save generated DynamicObjectAdapter ..at runtime we could change the chain of Proxies ..could be used for (Dynamic) Dependency Injection Implementations
  • 68. Summary 68 @SvenRuppert If you are interested… have a look at RapidPM on github rapidpm-proxybuilder rapidpm-dynamic-cdi rapidpm-microservice or contact me ;-) @SvenRuppert Thank You !!!