Project

General

Profile

1 26600 sandro.lab
package eu.dnetlib.soap;
2
3
import java.util.Map;
4
5
import javax.xml.namespace.QName;
6
import javax.xml.ws.wsaddressing.W3CEndpointReference;
7
8
/**
9
 * This is a generalization of org.apache.cxf.jaxws.EndpointReferenceBuilder and org.apache.cxf.jaxws.EndpointImpl
10
 *
11
 * <p>
12
 * javax.xml.ws.WebServiceContext org.apache.cxf.jaxws.EndpointReferenceBuilder doesn't expose the API for adding
13
 * additional metadata while org.apache.cxf.jaxws.EndpointImpl doesn't take the correct endpoint address from the
14
 * EndpointInfo object. org.apache.cxf.endpoint.Endpoint return a CXF proprietary endpoint reference and not the
15
 * javax/w3c standard definition.
16
 * </p>
17
 *
18
 * <p>
19
 * This interface is intended to provide an abstract way to construct an endpoint reference for a given service,
20
 * depending on the type of endpoint interface you have at hand (CXF abstract endpoint or jaxws endpoint)
21
 * </p>
22
 *
23
 * <p>
24
 * Normally the type parameter T will be bound to your endpoint type.
25
 * </p>
26
 *
27
 * <p>
28
 * In CXF jaxws applications you can easly get a WebServiceContext instance which returns an EndpointReference, however
29
 * the API is cumbersome because it requires instantiating w3c DOM Element instances for each reference parameter, and
30
 * it doesn't allow setting custom metadata elements.
31
 * </p>
32
 *
33
 * <p>
34
 * Implementors of this API will extract as many useful informations from the runtime besides the plain soap endpoint
35
 * address.
36
 * </p>
37
 *
38
 * @author marko
39
 * @param <T>
40
 *            all endpoint builders are parameterized to specific endpoint type which on the used framework (not on the
41
 *            service)
42
 *
43
 */
44
public interface EndpointReferenceBuilder<T> {
45
	/**
46
	 * get an endpoint reference with default metadata attached.
47
	 *
48
	 * @param endpoint
49
	 *            the endpoint
50
	 * @return an endpoint reference
51
	 */
52
	W3CEndpointReference getEndpointReference(T endpoint);
53
54
	/**
55
	 * get an endpoint reference with custom metadata attached.
56
	 *
57
	 * @param endpoint
58
	 *            the endpoint
59
	 * @param attrs
60
	 *            metadata attribute map
61
	 * @return an endpoint reference
62
	 */
63
	W3CEndpointReference getEndpointReference(T endpoint, Map<QName, Object> attrs);
64
65
	/**
66
	 * get an endpoint reference with a WSA reference parameter.
67
	 *
68
	 * @param endpoint
69
	 *            the endpoint
70
	 * @param referenceParam
71
	 *            reference parameters
72
	 * @return an endpoint reference
73
	 */
74
	W3CEndpointReference getEndpointReference(T endpoint, String referenceParam);
75
76
	/**
77
	 * get an endpoint reference with custom metadata attached and WSA reference parameter.
78
	 *
79
	 * @param endpoint
80
	 *            endpoint
81
	 * @param referenceParam
82
	 *            reference parameters
83
	 * @param attrs
84
	 *            metadata attribute map
85
	 * @return an endpoint reference
86
	 */
87
	W3CEndpointReference getEndpointReference(T endpoint, String referenceParam, Map<QName, Object> attrs);
88
89
	/**
90
	 * Sometimes we need only the address.
91
	 *
92
	 * @param endpoint endpoint
93
	 * @return address
94
	 */
95
	String getAddress(T endpoint);
96
}