01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.ws.addressing;
19:
20: import java.util.logging.Level;
21: import java.util.logging.Logger;
22:
23: import org.apache.cxf.common.logging.LogUtils;
24: import static org.apache.cxf.ws.addressing.JAXWSAConstants.DEFAULT_ADDRESSING_BUILDER;
25:
26: /**
27: * Factory for WS-Addressing elements.
28: * <p>
29: * Note that the JAXB generated types are used directly to represent
30: * WS-Addressing schema types. Hence there are no factory methods defined
31: * on this class for those types, as they may be instanted in the normal
32: * way via the JAXB generated ObjectFactory.
33: */
34: public abstract class AddressingBuilder implements AddressingType {
35:
36: private static final Logger LOG = LogUtils.getL7dLogger(
37: AddressingBuilder.class, "APIMessages");
38: private static AddressingBuilder builder;
39:
40: /**
41: * Non-public constructor prevents instantiation.
42: */
43: protected AddressingBuilder() {
44: }
45:
46: /**
47: * AddressingBuilder factory method.
48: *
49: * @return AddressingBuilder instance
50: */
51: public static AddressingBuilder getAddressingBuilder() {
52: synchronized (AddressingBuilder.class) {
53: if (builder == null) {
54: String className = DEFAULT_ADDRESSING_BUILDER;
55: try {
56: Class cls = Class.forName(className);
57: builder = (AddressingBuilder) cls.newInstance();
58: } catch (ClassNotFoundException cnfe) {
59: cnfe.printStackTrace();
60: LogUtils.log(LOG, Level.WARNING,
61: "BUILDER_CLASS_NOT_FOUND_MSG", cnfe,
62: className);
63: } catch (Exception ex) {
64: ex.printStackTrace();
65: LogUtils.log(LOG, Level.WARNING,
66: "BUILDER_INSTANTIATION_FAILED_MSG", ex,
67: className);
68: }
69: }
70: }
71: return builder;
72: }
73:
74: /**
75: * AddressingProperties factory method.
76: *
77: * @return a new AddressingProperties instance
78: */
79: public abstract AddressingProperties newAddressingProperties();
80:
81: /**
82: * Returns an instance of
83: * <code>javax.ws.addressing.AddressingConstants</code>
84: * <p>
85: * <b>Note</b>: This is a new method since Early Draft 1.
86: *
87: * @return The new AddressingConstants.
88: */
89: public abstract AddressingConstants newAddressingConstants();
90: }
|