KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > ws > addressing > AddressingBuilder


1 package org.objectweb.celtix.ws.addressing;
2
3
4 import java.util.logging.Level JavaDoc;
5 import java.util.logging.Logger JavaDoc;
6
7
8 import org.objectweb.celtix.common.logging.LogUtils;
9 import static org.objectweb.celtix.ws.addressing.JAXWSAConstants.DEFAULT_ADDRESSING_BUILDER;
10
11
12 /**
13  * Factory for WS-Addressing elements.
14  * <p>
15  * Note that the JAXB generated types are used directly to represent
16  * WS-Addressing schema types. Hence there are no factory methods defined
17  * on this class for those types, as they may be instanted in the normal
18  * way via the JAXB generated ObjectFactory.
19  */

20 public abstract class AddressingBuilder implements AddressingType {
21
22     private static final Logger JavaDoc LOG =
23         LogUtils.getL7dLogger(AddressingBuilder.class);
24     private static AddressingBuilder builder;
25
26     /**
27      * Non-public constructor prevents instantiation.
28      */

29     protected AddressingBuilder() {
30     }
31
32     /**
33      * AddressingBuilder factory method.
34      *
35      * @return AddressingBuilder instance
36      */

37     public static AddressingBuilder getAddressingBuilder() {
38         synchronized (AddressingBuilder.class) {
39             if (builder == null) {
40                 String JavaDoc className = DEFAULT_ADDRESSING_BUILDER;
41                 try {
42                     Class JavaDoc cls = Class.forName(className);
43                     builder = (AddressingBuilder)cls.newInstance();
44                 } catch (ClassNotFoundException JavaDoc cnfe) {
45                     cnfe.printStackTrace();
46                     LogUtils.log(LOG,
47                                  Level.WARNING,
48                                  "BUILDER_CLASS_NOT_FOUND_MSG",
49                                  cnfe,
50                                  className);
51                 } catch (Exception JavaDoc ex) {
52                     ex.printStackTrace();
53                     LogUtils.log(LOG,
54                                  Level.WARNING,
55                                  "BUILDER_INSTANTIATION_FAILED_MSG",
56                                  ex,
57                                  className);
58                 }
59             }
60         }
61         return builder;
62     }
63     
64     /**
65      * AddressingProperties factory method.
66      *
67      * @return a new AddressingProperties instance
68      */

69     public abstract AddressingProperties newAddressingProperties();
70     
71     /**
72      * Returns an instance of
73      * <code>javax.ws.addressing.AddressingConstants</code>
74      * <p>
75      * <b>Note</b>: This is a new method since Early Draft 1.
76      *
77      * @return The new AddressingConstants.
78      */

79     public abstract AddressingConstants newAddressingConstants();
80 }
81
Popular Tags