001: package org.objectweb.celtix.bus.jaxws;
002:
003: import java.util.logging.Level;
004: import java.util.logging.Logger;
005:
006: import javax.jws.WebParam;
007: import javax.jws.WebResult;
008: import javax.jws.WebService;
009: import javax.jws.soap.SOAPBinding.ParameterStyle;
010: import javax.jws.soap.SOAPBinding.Style;
011: import javax.jws.soap.SOAPBinding.Use;
012: import javax.xml.bind.JAXBContext;
013: import javax.xml.namespace.QName;
014: import javax.xml.soap.SOAPBody;
015:
016: import org.objectweb.celtix.bindings.DataBindingCallback;
017: import org.objectweb.celtix.bindings.DataReader;
018: import org.objectweb.celtix.bindings.DataWriter;
019: import org.objectweb.celtix.bus.jaxws.io.SOAPBodyDataReader;
020: import org.objectweb.celtix.bus.jaxws.io.SOAPBodyDataWriter;
021: import org.objectweb.celtix.bus.jaxws.io.SOAPMessageDataReader;
022: import org.objectweb.celtix.bus.jaxws.io.SOAPMessageDataWriter;
023: import org.objectweb.celtix.common.logging.LogUtils;
024: import org.objectweb.celtix.context.ObjectMessageContext;
025:
026: public class DynamicDataBindingCallback implements DataBindingCallback {
027:
028: private static final Logger LOG = LogUtils
029: .getL7dLogger(DynamicDataBindingCallback.class);
030:
031: protected final Mode mode;
032: protected final Class<?>[] clazz;
033: protected final JAXBContext context;
034:
035: public DynamicDataBindingCallback(Class<?> cls, Mode md) {
036: mode = md;
037: clazz = new Class<?>[] { cls };
038: context = null;
039: }
040:
041: public DynamicDataBindingCallback(JAXBContext ctx, Mode md) {
042: mode = md;
043: context = ctx;
044: clazz = new Class<?>[] { Object.class };
045: }
046:
047: public Mode getMode() {
048: return mode;
049: }
050:
051: public JAXBContext getJAXBContext() {
052: return context;
053: }
054:
055: public Class<?>[] getSupportedFormats() {
056: return clazz;
057: }
058:
059: public <T> DataWriter<T> createWriter(Class<T> cls) {
060: if (getMode() == Mode.MESSAGE) {
061: return new SOAPMessageDataWriter<T>(this );
062: } else if ((getMode() == Mode.PAYLOAD)
063: && (cls.isAssignableFrom(SOAPBody.class))) {
064: return new SOAPBodyDataWriter<T>(this );
065: }
066: LOG.log(Level.SEVERE, "No DataWriter for class: "
067: + cls.getName());
068: return null;
069: }
070:
071: public <T> DataReader<T> createReader(Class<T> cls) {
072: if (getMode() == Mode.MESSAGE) {
073: return new SOAPMessageDataReader<T>(this );
074: } else if ((getMode() == Mode.PAYLOAD)
075: && (cls.isAssignableFrom(SOAPBody.class))) {
076: return new SOAPBodyDataReader<T>(this );
077: }
078: LOG.log(Level.SEVERE, "No DataReader for class: "
079: + cls.getName());
080: return null;
081: }
082:
083: public Style getSOAPStyle() {
084: // TODO Auto-generated method stub
085: return null;
086: }
087:
088: public Use getSOAPUse() {
089: // TODO Auto-generated method stub
090: return null;
091: }
092:
093: public ParameterStyle getSOAPParameterStyle() {
094: // TODO Auto-generated method stub
095: return null;
096: }
097:
098: public String getOperationName() {
099: // TODO Auto-generated method stub
100: return null;
101: }
102:
103: public String getTargetNamespace() {
104: // TODO Auto-generated method stub
105: return null;
106: }
107:
108: public String getSOAPAction() {
109: // TODO Auto-generated method stub
110: return null;
111: }
112:
113: public WebResult getWebResult() {
114: // TODO Auto-generated method stub
115: return null;
116: }
117:
118: public QName getWebResultQName() {
119: // TODO Auto-generated method stub
120: return null;
121: }
122:
123: public WebParam getWebParam(int index) {
124: // TODO Auto-generated method stub
125: return null;
126: }
127:
128: public int getParamsLength() {
129: // TODO Auto-generated method stub
130: return 0;
131: }
132:
133: public WebResult getWebResultAnnotation() {
134: // TODO Auto-generated method stub
135: return null;
136: }
137:
138: public WebService getWebService() {
139: // TODO Auto-generated method stub
140: return null;
141: }
142:
143: public QName getRequestWrapperQName() {
144: // TODO Auto-generated method stub
145: return null;
146: }
147:
148: public String getRequestWrapperType() {
149: // TODO Auto-generated method stub
150: return null;
151: }
152:
153: public QName getResponseWrapperQName() {
154: // TODO Auto-generated method stub
155: return null;
156: }
157:
158: public String getResponseWrapperType() {
159: // TODO Auto-generated method stub
160: return null;
161: }
162:
163: public boolean isOneWay() {
164: // TODO Auto-generated method stub
165: return false;
166: }
167:
168: public void initObjectContext(ObjectMessageContext octx) {
169: // TODO Auto-generated method stub
170: //REVISIT
171: }
172:
173: }
|