KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > mapper > storage > XDBCFilerAdapter


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.mapper.storage;
24
25 import org.w3c.dom.Document JavaDoc;
26 import org.xml.sax.*;
27 import org.xml.sax.ext.LexicalHandler JavaDoc;
28 import org.xquark.xml.xdbc.*;
29
30 /**
31  * Class used to convert XDBCDocumentFiler calls to basic internal calls.
32  */

33 public class XDBCFilerAdapter extends XDBCMapperAdapter
34 implements XMLDocumentFiler
35 {
36     private static final String JavaDoc RCSRevision = "$Revision: 1.1 $";
37     private static final String JavaDoc RCSName = "$Name: $";
38     private CollectionFiler filer;
39     
40     public XDBCFilerAdapter(ContentHandler contentHandler, LexicalHandler JavaDoc lexicalHandler,
41                     ErrorHandler errorHandler, CollectionFiler filer)
42     {
43         super(contentHandler, lexicalHandler, errorHandler, filer);
44         this.filer = filer;
45     }
46     
47     ///////////////////////////////////////////////////////////////////////////
48
// XMLDocumentFiler implementation
49
///////////////////////////////////////////////////////////////////////////
50

51     public XMLDocument insertDocument(InputSource input, String JavaDoc id)
52     throws XMLDBCException, SAXException
53     {
54         setDocumentId(id);
55         return insertDocument(input);
56     }
57     
58     public XMLDocument insertDocument(XMLReader parser, InputSource input, String JavaDoc id)
59     throws XMLDBCException, SAXException
60     {
61         setDocumentId(id);
62         return insertDocument(parser, input);
63     }
64
65     public XMLDocument insertDocument(String JavaDoc doc, String JavaDoc id)
66     throws XMLDBCException, org.xml.sax.SAXException JavaDoc
67     {
68         setDocumentId(id);
69         return insertDocument(doc);
70     }
71     
72     public XMLDocument insertDocument(Document JavaDoc doc, String JavaDoc id)
73     throws XMLDBCException
74     {
75         setDocumentId(id);
76         return insertDocument(doc);
77     }
78     
79
80     public XMLDocument insertDocument(InputSource input)
81     throws XMLDBCException, SAXException
82     {
83         insertXMLDocument(input);
84         return filer.getCollection().getDocument(filer.getDocumentId());
85     }
86     
87     public XMLDocument insertDocument(XMLReader parser, InputSource input)
88     throws XMLDBCException, SAXException
89     {
90         insertXMLDocument(parser, input);
91         return filer.getCollection().getDocument(filer.getDocumentId());
92     }
93     
94     public XMLDocument insertDocument(String JavaDoc doc)
95     throws XMLDBCException, SAXException
96     {
97         insertXMLDocument(doc);
98         return filer.getCollection().getDocument(filer.getDocumentId());
99      }
100     
101     public XMLDocument insertDocument(Document JavaDoc document) throws XMLDBCException
102     {
103         insertXMLDocument(document);
104         return filer.getCollection().getDocument(filer.getDocumentId());
105     }
106     
107     public void setDocumentId(String JavaDoc id) throws XMLDBCException
108     {
109         filer.setDocumentId(id);
110     }
111     
112     public XMLCollection getCollection()
113     {
114         return filer.getCollection();
115     }
116     
117     public String JavaDoc getDocumentId()
118     {
119         return filer.getDocumentId();
120     }
121     
122     public String JavaDoc[] getFeatureList()
123     {
124         return filer.getXMLFeatureList();
125     }
126     
127     public String JavaDoc[] getPropertyList()
128     {
129         return filer.getXMLPropertyList();
130     }
131     
132     public boolean getFeature(String JavaDoc featureId) throws XMLDBCNotRecognizedException
133     {
134         return filer.getXMLFeature(featureId);
135     }
136     
137     public void setFeature(String JavaDoc featureId, boolean state) throws XMLDBCNotRecognizedException, XMLDBCNotSupportedException
138     {
139         filer.setXMLFeature(featureId, state);
140     }
141     
142     public Object JavaDoc getProperty(String JavaDoc propertyId) throws XMLDBCNotRecognizedException
143     {
144         return filer.getXMLProperty(propertyId);
145     }
146     
147     public void setProperty(String JavaDoc propertyId, Object JavaDoc value) throws XMLDBCNotRecognizedException, XMLDBCNotSupportedException
148     {
149         filer.setXMLProperty(propertyId, value);
150     }
151 }
152
Popular Tags