1 package org.codehaus.xfire.service.binding;
2
3 import javax.xml.namespace.QName;
4 import javax.xml.stream.XMLStreamReader;
5 import javax.xml.stream.XMLStreamWriter;
6
7 import org.codehaus.xfire.MessageContext;
8 import org.codehaus.xfire.fault.XFireFault;
9 import org.codehaus.xfire.service.MessageHeaderInfo;
10 import org.codehaus.xfire.service.MessagePartInfo;
11 import org.codehaus.xfire.service.OperationInfo;
12 import org.codehaus.xfire.service.Service;
13
14 /***
15 * A BindingProvider provides the ability to map XML and java objects. This can
16 * come in the form of simple POJOs or a DOM tree. To use one must just implement
17 * the interface and provide it to the {@link ObjectServiceFactory}.
18 *
19 * @author Dan Diephouse
20 */
21 public interface BindingProvider
22 {
23 void initialize(Service newParam);
24
25 /***
26 * Gives a binding the chance to suggest a name for a particular parameter.
27 * @param m The method of the parameter.
28 * @param param The index of the parameter. -1 specifies the return parameter.
29 * @return The suggestion. null if there isn't a suggestion.
30 */
31 QName getSuggestedName(Service service, OperationInfo op, int param);
32
33 Object readParameter(MessagePartInfo p, XMLStreamReader reader, MessageContext context)
34 throws XFireFault;
35
36 void writeParameter(MessagePartInfo p,
37 XMLStreamWriter writer,
38 MessageContext context,
39 Object value)
40 throws XFireFault;
41
42 Object readHeader(MessageHeaderInfo p, MessageContext context)
43 throws XFireFault;
44
45 void writeHeader(MessagePartInfo p, MessageContext context, Object value)
46 throws XFireFault;
47 }