public class XMLConfigurator extends org.xml.sax.helpers.DefaultHandler
A SAX 2 ContentHandler that can configure Proxool from an XML source.
This is just a ContentHandler, so you must associate it with a SAX parser for it to actually do anything.
If you have JAXP available JAXPConfigurator will do this for you.
Properties that you pass on to the delegate driver have to be treated specially. They must be contained within a <driver-properties> element.
See The latest version is available at Proxool properties for documentation on the available configuration properties.
Example configuration:
<proxool>
<alias>apple</alias>
<driver-url>jdbc:hsqldb:.</driver-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<driver-properties>
<property name="user" value="abc" />
<property name="password" value="def" />
</driver-properties>
<house-keeping-sleep-time>40000</house-keeping-sleep-time>
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
<maximum-connection-count>10</maximum-connection-count>
<minimum-connection-count>3</minimum-connection-count>
<maximum-connection-lifetime>18000000</maximum-connection-lifetime> <!-- 5 hours -->
<simultaneous-build-throttle>5</simultaneous-build-throttle>
<recently-started-threshold>40000</recently-started-threshold>
<overload-without-refusal-lifetime>50000</overload-without-refusal-lifetime>
<maximum-active-time>60000</maximum-active-time>
<verbose>true</verbose>
<trace>true</trace>
<fatal-sql-exception>ORA-1234</fatal-sql-exception>
<prototype-count>2</prototype-count>
</proxool>
When the parser reaches the end of the <proxool> element the pool
is automatically registered. You can contain the <proxool> element
in any other elements as you wish. And the <proxool> element can
occur as many times as you wish. This allows you to use an XML file that
configures your whole application as the source. This configurator will
ignore everything apart from the elements contained within the <proxool>
element.
Validationproxool-config element.
The document must adhere to the Proxool dtd.
DOCTYPE entry to your xml with a system id containing the absolute url to the Proxool
dtd. The Proxool jar contains a copy of the Proxool dtd in the confguration package. You can reference that with
a jar url like this:<!DOCTYPE proxool-config SYSTEM "jar:file:///C:/Proxool/lib/proxool.jar!/org/logicalcobwebs/proxool/configuration/proxool.dtd">JAXPConfigurator this is done by passing true as
the second arghument to any of the configure methods.
This class is not thread safe.
| 构造器和说明 |
|---|
XMLConfigurator() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
characters(char[] chars,
int start,
int length) |
void |
endElement(String uri,
String lname,
String qname) |
void |
error(SAXParseException e) |
void |
fatalError(SAXParseException e) |
void |
startElement(String uri,
String lname,
String qname,
Attributes attributes) |
void |
warning(SAXParseException e) |
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDeclpublic void startElement(String uri, String lname, String qname, Attributes attributes) throws SAXException
public void characters(char[] chars,
int start,
int length)
throws SAXException
characters 在接口中 ContentHandlercharacters 在类中 org.xml.sax.helpers.DefaultHandlerSAXExceptionContentHandler.characters(char[], int, int)public void endElement(String uri, String lname, String qname) throws SAXException
public void warning(SAXParseException e) throws SAXException
warning 在接口中 ErrorHandlerwarning 在类中 org.xml.sax.helpers.DefaultHandlerSAXExceptionErrorHandler.warning(SAXParseException)public void error(SAXParseException e) throws SAXException
error 在接口中 ErrorHandlererror 在类中 org.xml.sax.helpers.DefaultHandlerSAXExceptionErrorHandler.error(SAXParseException)public void fatalError(SAXParseException e) throws SAXException
fatalError 在接口中 ErrorHandlerfatalError 在类中 org.xml.sax.helpers.DefaultHandlerSAXExceptionErrorHandler.fatalError(SAXParseException)Copyright © 2024. All rights reserved.