Clover coverage report - dom4j - 1.6.1
Coverage timestamp: ma mei 16 2005 14:23:01 GMT+01:00

file stats: | LOC: | 204 |  | Methods: | 27
| NCLOC: | 110 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

ProxyDocumentFactory.java

0%

0%

0%

0%

1 |  | /*
2 |  | * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
3 |  | *
4 |  | * This software is open source.
5 |  | * See the bottom of this file for the licence.
6 |  | */
7 |  |
8 |  | package org.dom4j.util;
9 |  |
10 |  | import java.util.Map;
11 |  |
12 |  | import org.dom4j.Attribute;
13 |  | import org.dom4j.CDATA;
14 |  | import org.dom4j.Comment;
15 |  | import org.dom4j.Document;
16 |  | import org.dom4j.DocumentFactory;
17 |  | import org.dom4j.DocumentType;
18 |  | import org.dom4j.Element;
19 |  | import org.dom4j.Entity;
20 |  | import org.dom4j.Namespace;
21 |  | import org.dom4j.NodeFilter;
22 |  | import org.dom4j.ProcessingInstruction;
23 |  | import org.dom4j.QName;
24 |  | import org.dom4j.Text;
25 |  | import org.dom4j.XPath;
26 |  | import org.dom4j.rule.Pattern;
27 |  |
28 |  | import org.jaxen.VariableContext;
29 |  |
30 |  | /**
31 |  | * <p>
32 |  | * <code>ProxyDocumentFactory</code> implements a proxy to a DocumentFactory
33 |  | * which is useful for implementation inheritence, allowing the pipelining of
34 |  | * various factory implementations. For example an EncodingDocumentFactory which
35 |  | * takes care of encoding strings outside of allowable XML ranges could be used
36 |  | * with a DatatypeDocumentFactory which is XML Schema Data Type aware.
37 |  | * </p>
38 |  | *
39 |  | * @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
40 |  | * @version $Revision: 1.13 $
41 |  | */
42 |  | public abstract class ProxyDocumentFactory {
43 |  | private DocumentFactory proxy;
44 |  |
45 | 0 | public ProxyDocumentFactory() {
46 |  | // use default factory
47 | 0 | this.proxy = DocumentFactory.getInstance();
48 |  | }
49 |  |
50 | 0 | public ProxyDocumentFactory(DocumentFactory proxy) {
51 | 0 | this.proxy = proxy;
52 |  | }
53 |  |
54 |  | // Factory methods
55 |  | // -------------------------------------------------------------------------
56 | 0 | public Document createDocument() {
57 | 0 | return proxy.createDocument();
58 |  | }
59 |  |
60 | 0 | public Document createDocument(Element rootElement) {
61 | 0 | return proxy.createDocument(rootElement);
62 |  | }
63 |  |
64 | 0 | public DocumentType createDocType(String name, String publicId,
65 |  | String systemId) {
66 | 0 | return proxy.createDocType(name, publicId, systemId);
67 |  | }
68 |  |
69 | 0 | public Element createElement(QName qname) {
70 | 0 | return proxy.createElement(qname);
71 |  | }
72 |  |
73 | 0 | public Element createElement(String name) {
74 | 0 | return proxy.createElement(name);
75 |  | }
76 |  |
77 | 0 | public Attribute createAttribute(Element owner, QName qname, String value) {
78 | 0 | return proxy.createAttribute(owner, qname, value);
79 |  | }
80 |  |
81 | 0 | public Attribute createAttribute(Element owner, String name, String value) {
82 | 0 | return proxy.createAttribute(owner, name, value);
83 |  | }
84 |  |
85 | 0 | public CDATA createCDATA(String text) {
86 | 0 | return proxy.createCDATA(text);
87 |  | }
88 |  |
89 | 0 | public Comment createComment(String text) {
90 | 0 | return proxy.createComment(text);
91 |  | }
92 |  |
93 | 0 | public Text createText(String text) {
94 | 0 | return proxy.createText(text);
95 |  | }
96 |  |
97 | 0 | public Entity createEntity(String name, String text) {
98 | 0 | return proxy.createEntity(name, text);
99 |  | }
100 |  |
101 | 0 | public Namespace createNamespace(String prefix, String uri) {
102 | 0 | return proxy.createNamespace(prefix, uri);
103 |  | }
104 |  |
105 | 0 | public ProcessingInstruction createProcessingInstruction(String target,
106 |  | String data) {
107 | 0 | return proxy.createProcessingInstruction(target, data);
108 |  | }
109 |  |
110 | 0 | public ProcessingInstruction createProcessingInstruction(String target,
111 |  | Map data) {
112 | 0 | return proxy.createProcessingInstruction(target, data);
113 |  | }
114 |  |
115 | 0 | public QName createQName(String localName, Namespace namespace) {
116 | 0 | return proxy.createQName(localName, namespace);
117 |  | }
118 |  |
119 | 0 | public QName createQName(String localName) {
120 | 0 | return proxy.createQName(localName);
121 |  | }
122 |  |
123 | 0 | public QName createQName(String name, String prefix, String uri) {
124 | 0 | return proxy.createQName(name, prefix, uri);
125 |  | }
126 |  |
127 | 0 | public QName createQName(String qualifiedName, String uri) {
128 | 0 | return proxy.createQName(qualifiedName, uri);
129 |  | }
130 |  |
131 | 0 | public XPath createXPath(String xpathExpression) {
132 | 0 | return proxy.createXPath(xpathExpression);
133 |  | }
134 |  |
135 | 0 | public XPath createXPath(String xpathExpression,
136 |  | VariableContext variableContext) {
137 | 0 | return proxy.createXPath(xpathExpression, variableContext);
138 |  | }
139 |  |
140 | 0 | public NodeFilter createXPathFilter(String xpathFilterExpression,
141 |  | VariableContext variableContext) {
142 | 0 | return proxy.createXPathFilter(xpathFilterExpression, variableContext);
143 |  | }
144 |  |
145 | 0 | public NodeFilter createXPathFilter(String xpathFilterExpression) {
146 | 0 | return proxy.createXPathFilter(xpathFilterExpression);
147 |  | }
148 |  |
149 | 0 | public Pattern createPattern(String xpathPattern) {
150 | 0 | return proxy.createPattern(xpathPattern);
151 |  | }
152 |  |
153 |  | // Implementation methods
154 |  | // -------------------------------------------------------------------------
155 | 0 | protected DocumentFactory getProxy() {
156 | 0 | return proxy;
157 |  | }
158 |  |
159 | 0 | protected void setProxy(DocumentFactory proxy) {
160 | 0 | if (proxy == null) {
161 |  | // use default factory
162 | 0 | proxy = DocumentFactory.getInstance();
163 |  | }
164 |  |
165 | 0 | this.proxy = proxy;
166 |  | }
167 |  | }
168 |  |
169 |  | /*
170 |  | * Redistribution and use of this software and associated documentation
171 |  | * ("Software"), with or without modification, are permitted provided that the
172 |  | * following conditions are met:
173 |  | *
174 |  | * 1. Redistributions of source code must retain copyright statements and
175 |  | * notices. Redistributions must also contain a copy of this document.
176 |  | *
177 |  | * 2. Redistributions in binary form must reproduce the above copyright notice,
178 |  | * this list of conditions and the following disclaimer in the documentation
179 |  | * and/or other materials provided with the distribution.
180 |  | *
181 |  | * 3. The name "DOM4J" must not be used to endorse or promote products derived
182 |  | * from this Software without prior written permission of MetaStuff, Ltd. For
183 |  | * written permission, please contact dom4j-info@metastuff.com.
184 |  | *
185 |  | * 4. Products derived from this Software may not be called "DOM4J" nor may
186 |  | * "DOM4J" appear in their names without prior written permission of MetaStuff,
187 |  | * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
188 |  | *
189 |  | * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
190 |  | *
191 |  | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
192 |  | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
193 |  | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
194 |  | * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
195 |  | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
196 |  | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
197 |  | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
198 |  | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
199 |  | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
200 |  | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
201 |  | * POSSIBILITY OF SUCH DAMAGE.
202 |  | *
203 |  | * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
204 |  | */