KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > core > util > dom > DOMFactory


1 /*
2  * Copyright (C) 2001 Christian Cryder [christianc@granitepeaks.com]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: DOMFactory.java,v 1.7 2004/01/29 18:02:35 christianc Exp $
19  */

20 package org.enhydra.barracuda.core.util.dom;
21
22 import java.io.IOException JavaDoc;
23 import org.w3c.dom.Document JavaDoc;
24
25
26 /**
27  * This interface defines the methods needed to implement a DOMFactory. A dom
28  * factory is not meant to be called directly, but by the chosen dom loader
29  * implementation.
30  *
31  * <p>There are two possible ways for loading a DOM: from a
32  * class and from a path to a document. It is not required for both to be
33  * supported at the same time.</p>
34  *
35  * <p>Where Implementations do not support a particular getInstance() method,
36  * they should simply throw an IOException and document their lack of support.</p>
37  *
38  * @see DOMLoader
39  */

40 public interface DOMFactory {
41     /**
42      * Obtain an instance of the DOM from a loaded class. This is here to
43      * support dom implementations such as XMLC which wrap the DOM up in a
44      * compiled class.
45      *
46      * @param clazz the class to be loaded as a Document object
47      * @return a Document object
48      * @throws IOException
49      */

50     public Document JavaDoc getInstance(Class JavaDoc clazz) throws IOException JavaDoc;
51     
52     /**
53      * Obtain an instance of the DOM from a path to a document. The syntax of
54      * the path depends on the implementation.
55      *
56      * <p>Depending on the dom factory implementation, the docPath may be an
57      * OS-specifc hardcoded path, a path relative to a known hardcoded path,
58      * a path to a document located within the classloader, or anything else
59      * one can imagine. See the doc of the various dom factory implementations
60      * for details.</p>
61      *
62      * @param docPath the path to the document to be loaded as a Document object
63      * @return a Document object
64      * @throws IOException
65      */

66     public Document JavaDoc getInstance(String JavaDoc docPath) throws IOException JavaDoc;
67 }
68
Popular Tags