/** * Done parsing. * * @throws SAXException if there is a parsing error. */ protected void doneParsing() throws SAXException { result = new Properties(); for ( int i = 0; i < propertyHandlers.size(); i++ ) { final PropertyReadHandler handler = propertyHandlers.get( i ); result.setProperty( handler.getName(), handler.getResult() ); } }
/** * Starts parsing. * * @param attrs the attributes. * @throws SAXException if there is a parsing error. */ protected void startParsing( final Attributes attrs ) throws SAXException { super.startParsing( attrs ); name = attrs.getValue( getUri(), nameAttribute ); if ( nameMandatory && name == null ) { throw new ParseException( "Required attribute '" + nameAttribute + "' missing", getLocator() ); } }
/** * 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; }
public String getScript() { if ( script == null ) { return null; } return script.getResult(); }
public String getScriptLanguage() { if ( script == null ) { return null; } return script.getName(); }
/** * Returns the handler for a child element. * * @param uri * the URI of the namespace of the current 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 ( "property".equals( tagName ) ) { final PropertyReadHandler definitionReadHandler = new PropertyReadHandler(); properties.add( definitionReadHandler ); return definitionReadHandler; } return null; }
public String getResult() { return PasswordEncryptionService.getInstance().decrypt( getRootHandler(), super.getResult() ); }
/** * Done parsing. * * @throws SAXException * if there is a parsing error. */ protected void doneParsing() throws SAXException { final NamedStaticDataFactory srdf = new NamedStaticDataFactory(); for ( int i = 0; i < queries.size(); i++ ) { final PropertyReadHandler handler = (PropertyReadHandler) queries.get( i ); srdf.setQuery( handler.getName(), handler.getResult() ); } dataFactory = srdf; }
/** * 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 ( "query".equals( tagName ) ) { final XmlReadHandler queryReadHandler = new PropertyReadHandler(); queries.add( queryReadHandler ); return queryReadHandler; } return null; }
for ( int i = 0; i < queries.size(); i++ ) { final PropertyReadHandler handler = queries.get( i ); dataFactory.setQuery( handler.getName(), handler.getResult(), null, null ); dataFactory.setGlobalScript( globalScriptReadHandler.getResult() ); dataFactory.setGlobalScriptLanguage( globalScriptReadHandler.getName() );
protected XmlReadHandler getHandlerForChild( final String uri, final String tagName, final Attributes atts ) throws SAXException { if ( isSameNamespace( uri ) == false ) { return null; } if ( "static-query".equals( tagName ) ) { query = new StringReadHandler(); return query; } if ( "script".equals( tagName ) ) { script = new PropertyReadHandler( "language", false ); return script; } return null; }
/** * Done parsing. * * @throws SAXException * if there is a parsing error. */ protected void doneParsing() throws SAXException { final SequenceDescription sequenceDescription = data.getSequenceDescription(); for ( final PropertyReadHandler propertyReadHandler : properties ) { final String propertyName = propertyReadHandler.getName(); final String propertyValue = propertyReadHandler.getResult(); final int pos = getPropertyLocation( sequenceDescription, propertyName ); if ( pos == -1 ) { throw new ParseException( "Unable to set property " + propertyName + ". There is no such property.", getLocator() ); } final Class ptype = sequenceDescription.getParameterType( pos ); try { final Object o = ConverterRegistry.toPropertyValue( propertyValue, ptype ); data.setParameter( propertyName, o ); } catch ( BeanException e ) { throw new ParseException( "Unable to set property " + propertyName + ". Conversion error.", e, getLocator() ); } } }
/** * 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 org.xml.sax.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( getPropertyTagName() ) ) { final String attrName = atts.getValue( "name" ); final PropertyReadHandler prh; if ( attrName != null && attrName.toLowerCase().contains( "password" ) ) { prh = new PasswordPropertyReadHandler(); } else { prh = new PropertyReadHandler(); } getPropertyHandlers().add( prh ); return prh; } return null; }
final PropertyReadHandler queryReadHandler = new PropertyReadHandler(); queries.add( queryReadHandler ); return queryReadHandler; globalScriptReadHandler = new PropertyReadHandler( "language", true ); return globalScriptReadHandler;