1 package org.objectweb.celtix.bus.jaxws; 2 3 import java.util.logging.Level ; 4 import java.util.logging.Logger ; 5 6 import javax.jws.WebParam; 7 import javax.jws.WebResult; 8 import javax.jws.WebService; 9 import javax.jws.soap.SOAPBinding.ParameterStyle; 10 import javax.jws.soap.SOAPBinding.Style; 11 import javax.jws.soap.SOAPBinding.Use; 12 import javax.xml.bind.JAXBContext; 13 import javax.xml.namespace.QName ; 14 import javax.xml.soap.SOAPBody ; 15 16 import org.objectweb.celtix.bindings.DataBindingCallback; 17 import org.objectweb.celtix.bindings.DataReader; 18 import org.objectweb.celtix.bindings.DataWriter; 19 import org.objectweb.celtix.bus.jaxws.io.SOAPBodyDataReader; 20 import org.objectweb.celtix.bus.jaxws.io.SOAPBodyDataWriter; 21 import org.objectweb.celtix.bus.jaxws.io.SOAPMessageDataReader; 22 import org.objectweb.celtix.bus.jaxws.io.SOAPMessageDataWriter; 23 import org.objectweb.celtix.common.logging.LogUtils; 24 import org.objectweb.celtix.context.ObjectMessageContext; 25 26 public class DynamicDataBindingCallback implements DataBindingCallback { 27 28 private static final Logger LOG = LogUtils.getL7dLogger(DynamicDataBindingCallback.class); 29 30 protected final Mode mode; 31 protected final Class <?>[] clazz; 32 protected final JAXBContext context; 33 34 public DynamicDataBindingCallback(Class <?> cls, Mode md) { 35 mode = md; 36 clazz = new Class <?>[] {cls}; 37 context = null; 38 } 39 40 public DynamicDataBindingCallback(JAXBContext ctx, Mode md) { 41 mode = md; 42 context = ctx; 43 clazz = new Class <?>[] {Object .class}; 44 } 45 46 public Mode getMode() { 47 return mode; 48 } 49 50 public JAXBContext getJAXBContext() { 51 return context; 52 } 53 54 public Class <?>[] getSupportedFormats() { 55 return clazz; 56 } 57 58 public <T> DataWriter<T> createWriter(Class <T> cls) { 59 if (getMode() == Mode.MESSAGE) { 60 return new SOAPMessageDataWriter<T>(this); 61 } else if ((getMode() == Mode.PAYLOAD) && (cls.isAssignableFrom(SOAPBody .class))) { 62 return new SOAPBodyDataWriter<T>(this); 63 } 64 LOG.log(Level.SEVERE, "No DataWriter for class: " + cls.getName()); 65 return null; 66 } 67 68 public <T> DataReader<T> createReader(Class <T> cls) { 69 if (getMode() == Mode.MESSAGE) { 70 return new SOAPMessageDataReader<T>(this); 71 } else if ((getMode() == Mode.PAYLOAD) && (cls.isAssignableFrom(SOAPBody .class))) { 72 return new SOAPBodyDataReader<T>(this); 73 } 74 LOG.log(Level.SEVERE, "No DataReader for class: " + cls.getName()); 75 return null; 76 } 77 78 public Style getSOAPStyle() { 79 return null; 81 } 82 83 public Use getSOAPUse() { 84 return null; 86 } 87 88 public ParameterStyle getSOAPParameterStyle() { 89 return null; 91 } 92 93 public String getOperationName() { 94 return null; 96 } 97 98 public String getTargetNamespace() { 99 return null; 101 } 102 103 public String getSOAPAction() { 104 return null; 106 } 107 108 public WebResult getWebResult() { 109 return null; 111 } 112 113 public QName getWebResultQName() { 114 return null; 116 } 117 118 public WebParam getWebParam(int index) { 119 return null; 121 } 122 123 public int getParamsLength() { 124 return 0; 126 } 127 128 public WebResult getWebResultAnnotation() { 129 return null; 131 } 132 133 public WebService getWebService() { 134 return null; 136 } 137 138 public QName getRequestWrapperQName() { 139 return null; 141 } 142 143 public String getRequestWrapperType() { 144 return null; 146 } 147 148 public QName getResponseWrapperQName() { 149 return null; 151 } 152 153 public String getResponseWrapperType() { 154 return null; 156 } 157 158 public boolean isOneWay() { 159 return false; 161 } 162 163 public void initObjectContext(ObjectMessageContext octx) { 164 } 167 168 169 } 170 | Popular Tags |