protected XmlReadHandler getHandlerForChild( final String uri, final String tagName, final Attributes atts ) throws SAXException { if ( isSameNamespace( uri ) ) { if ( NODE_ATTRIBUTES.equals( tagName ) ) { propertiesReadHandler = new PropertiesReadHandler( NODE_ATTRIBUTE ); return propertiesReadHandler; } } return null; }
protected void doneParsing() throws SAXException { if ( propertiesReadHandler == null ) { return; } final Properties result = propertiesReadHandler.getResult(); for ( final Map.Entry<Object, Object> entry : result.entrySet() ) { final String code = (String) entry.getKey(); final String attribute = (String) entry.getValue(); databaseConnection.getAttributes().put( code, ( attribute == null || attribute.length() == 0 ) ? "" : attribute ); //$NON-NLS-1$ } }
/** * Returns the handler for a child element. * * @param tagName the tag name. * @param atts the attributes. * @return the handler or null, if the tagname is invalid. * @throws SAXException if there is a parsing error. */ protected XmlReadHandler getHandlerForChild( final String uri, final String tagName, final Attributes atts ) throws SAXException { if ( isSameNamespace( uri ) == false ) { return null; } if ( tagName.equals( propertyTagName ) ) { final PropertyReadHandler prh = new PropertyReadHandler(); propertyHandlers.add( prh ); return prh; } return null; }
/** * Done parsing. * * @throws SAXException * if there is a parsing error. */ protected void doneParsing() throws SAXException { final DriverConnectionProvider provider = new DriverConnectionProvider(); if ( driverReadHandler != null ) { provider.setDriver( driverReadHandler.getResult() ); } if ( urlReadHandler != null ) { provider.setUrl( urlReadHandler.getResult() ); } if ( propertiesReadHandler != null ) { final Properties p = (Properties) propertiesReadHandler.getObject(); final Iterator it = p.entrySet().iterator(); while ( it.hasNext() ) { final Map.Entry entry = (Map.Entry) it.next(); provider.setProperty( (String) entry.getKey(), (String) entry.getValue() ); } } driverConnectionProvider = provider; }