1 22 23 package org.xquark.bridge; 24 25 import java.sql.Connection ; 26 import java.sql.SQLException ; 27 28 import org.w3c.dom.Document ; 29 import org.xml.sax.*; 30 import org.xml.sax.ext.LexicalHandler ; 31 import org.xquark.mapper.dbms.AbstractConnection; 32 import org.xquark.mapper.storage.SAXHandler; 33 import org.xquark.mapper.storage.XDBCMapperAdapter; 34 import org.xquark.schema.validation.ValidatingSchemaHandler; 35 import org.xquark.xml.xdbc.XMLDBCException; 36 37 53 class MapperImpl extends XDBCMapperAdapter implements Mapper 54 { 55 private static final String RCSRevision = "$Revision: 1.7 $"; 56 private static final String RCSName = "$Name: $"; 57 58 private Mapping mapping = null; 59 private AbstractConnection connection; 60 private ValidatingSchemaHandler validatingContentHandler = null; 61 62 66 MapperImpl(Mapping mapping, AbstractConnection connection, ValidatingSchemaHandler validatingContentHandler, 67 LexicalHandler lexicalHandler, ErrorHandler errorHandler, SAXHandler handler) 68 throws XMLDBCException 69 { 70 super(validatingContentHandler, lexicalHandler, errorHandler, handler); 71 this.mapping = mapping; 72 this.connection = connection; 73 this.validatingContentHandler = validatingContentHandler; 74 } 75 76 80 public Mapping getMapping() 81 { 82 return mapping; 83 } 84 85 89 public void close() throws XMLDBCException 90 { 91 super.close(); 92 try { 93 connection.close(); 94 } catch (SQLException ex) { 95 throw new XMLDBCException(ex.getMessage(), ex); 96 } 97 mapping.remove(this); 98 } 99 100 public void insertDocument(InputSource input) 104 throws XMLDBCException, SAXException 105 { 106 insertXMLDocument(input); 107 } 108 109 public void insertDocument(XMLReader parser, InputSource input) 110 throws XMLDBCException, SAXException 111 { 112 insertXMLDocument(parser, input); 113 } 114 115 public void insertDocument(String doc) throws XMLDBCException, org.xml.sax.SAXException 116 { 117 insertXMLDocument(doc); 118 } 119 120 public void insertDocument(Document document) throws XMLDBCException 121 { 122 insertXMLDocument(document); 123 } 124 125 131 public String getDocumentBase() 132 { 133 return validatingContentHandler.getDocumentBase(); 134 } 135 136 146 public void setDocumentBase(String URI) 147 { 148 validatingContentHandler.setDocumentBase(URI); 149 } 150 151 155 public Connection getConnection() 156 { 157 return connection.getConnection(); 158 } 159 160 } 161 162 163 | Popular Tags |