01: package org.objectweb.celtix.ws.addressing;
02:
03: import java.util.logging.Level;
04: import java.util.logging.Logger;
05:
06: import org.objectweb.celtix.common.logging.LogUtils;
07: import static org.objectweb.celtix.ws.addressing.JAXWSAConstants.DEFAULT_ADDRESSING_BUILDER;
08:
09: /**
10: * Factory for WS-Addressing elements.
11: * <p>
12: * Note that the JAXB generated types are used directly to represent
13: * WS-Addressing schema types. Hence there are no factory methods defined
14: * on this class for those types, as they may be instanted in the normal
15: * way via the JAXB generated ObjectFactory.
16: */
17: public abstract class AddressingBuilder implements AddressingType {
18:
19: private static final Logger LOG = LogUtils
20: .getL7dLogger(AddressingBuilder.class);
21: private static AddressingBuilder builder;
22:
23: /**
24: * Non-public constructor prevents instantiation.
25: */
26: protected AddressingBuilder() {
27: }
28:
29: /**
30: * AddressingBuilder factory method.
31: *
32: * @return AddressingBuilder instance
33: */
34: public static AddressingBuilder getAddressingBuilder() {
35: synchronized (AddressingBuilder.class) {
36: if (builder == null) {
37: String className = DEFAULT_ADDRESSING_BUILDER;
38: try {
39: Class cls = Class.forName(className);
40: builder = (AddressingBuilder) cls.newInstance();
41: } catch (ClassNotFoundException cnfe) {
42: cnfe.printStackTrace();
43: LogUtils.log(LOG, Level.WARNING,
44: "BUILDER_CLASS_NOT_FOUND_MSG", cnfe,
45: className);
46: } catch (Exception ex) {
47: ex.printStackTrace();
48: LogUtils.log(LOG, Level.WARNING,
49: "BUILDER_INSTANTIATION_FAILED_MSG", ex,
50: className);
51: }
52: }
53: }
54: return builder;
55: }
56:
57: /**
58: * AddressingProperties factory method.
59: *
60: * @return a new AddressingProperties instance
61: */
62: public abstract AddressingProperties newAddressingProperties();
63:
64: /**
65: * Returns an instance of
66: * <code>javax.ws.addressing.AddressingConstants</code>
67: * <p>
68: * <b>Note</b>: This is a new method since Early Draft 1.
69: *
70: * @return The new AddressingConstants.
71: */
72: public abstract AddressingConstants newAddressingConstants();
73: }
|