KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > zeus > source > BaseSource


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  */

19 package org.enhydra.zeus.source;
20
21 import java.io.IOException JavaDoc;
22
23 // Zeus imports
24
import org.enhydra.zeus.Source;
25
26 // JDOM imports
27
import org.jdom.Document;
28
29 // SAX imports
30
import org.xml.sax.EntityResolver JavaDoc;
31
32 /**
33  * <p>
34  * <code>{@link Source}</code> provides an interface for all input
35  * means. It details the required contract that other
36  * portions of the Zeus XML data binding framework must
37  * use for processing of an arbitrary input.
38  * </p>
39  * <p>
40  * This implementation of <code>Source</code> handles the
41  * basic functionality of dealing with system IDs so that
42  * other implementations don't have to code these methods.
43  * Thus, <code>XXXSource</code> classes should extend
44  * this class, rather than directly implementing
45  * <code>Source</code>, and will get this functionality
46  * "for free."
47  * </p>
48  *
49  * @author Brett McLaughlin
50  */

51 public abstract class BaseSource implements Source {
52
53     /** The system ID for this <code>Source</code> */
54     protected String JavaDoc systemID;
55
56     /** <code>EntityResolver</code> to pass to parser */
57     protected EntityResolver JavaDoc entityResolver;
58         
59     /**
60      * <p>
61      * This will return the system ID associated with
62      * this <code>Source</code>. This is generally in
63      * the form of a URI.
64      * </p>
65      *
66      * @return <code>String</code> - the system ID for the
67      * <code>Source</code>.
68      */

69     public String JavaDoc getSystemID() {
70         return systemID;
71     }
72     
73     /**
74      * <p>
75      * This will set the system ID for this
76      * <code>Source</code>. This is important to use,
77      * even when input is in the form of an input stream
78      * (see <code>{@link StreamSource}</code>)
79      * for resolving external references, such as to a DTD.
80      * </p>
81      *
82      * @param systemID <code>String</code> system ID to use.
83      */

84     public void setSystemID(String JavaDoc systemID) {
85         this.systemID = systemID;
86     }
87     
88     /**
89      * <p>
90      * This will return a JDOM <code>Document</code> that
91      * represents the input source.
92      * </p>
93      *
94      * @return <code>Document</code> - the JDOM representation
95      * of the input source.
96      * @throws <code>IOException</code> - when construction of
97      * a <code>Document</code> generates errors.
98      */

99     public abstract Document getDocument() throws IOException JavaDoc;
100
101     /**
102      * <p>
103      * This will set an EntityResolver for this
104      * <code>Source</code>. This is passed to the underlying
105      * parser to use.
106      * </p>
107      *
108      * @param entityResolver <code>EntityResolver</code> to use in parsing.
109      */

110      public void setEntityResolver(EntityResolver JavaDoc entityResolver) {
111         this.entityResolver = entityResolver;
112      }
113 }
114
Popular Tags