01: package org.objectweb.celtix.bus.jaxws;
02:
03: import java.lang.reflect.InvocationTargetException;
04:
05: import javax.xml.bind.JAXBContext;
06: import javax.xml.ws.Provider;
07:
08: import org.objectweb.celtix.bindings.DataBindingCallback.Mode;
09: import org.objectweb.celtix.bindings.ServerDataBindingCallback;
10: import org.objectweb.celtix.context.ObjectMessageContext;
11:
12: public class ServerDynamicDataBindingCallback<T> extends
13: DynamicDataBindingCallback implements ServerDataBindingCallback {
14:
15: private Provider<T> provider;
16:
17: public ServerDynamicDataBindingCallback(Class<T> cls, Mode md,
18: Provider<T> p) {
19: super (cls, md);
20: provider = p;
21: }
22:
23: public ServerDynamicDataBindingCallback(JAXBContext ctx, Mode md,
24: Provider<T> p) {
25: super (ctx, md);
26: provider = p;
27: }
28:
29: @SuppressWarnings("unchecked")
30: public void invoke(ObjectMessageContext octx)
31: throws InvocationTargetException {
32: T obj = provider.invoke((T) octx.getMessageObjects()[0]);
33: octx.setReturn(obj);
34: }
35: }
|