/** @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration) */ public void configure(final Configuration configuration) throws ConfigurationException { super.configure(configuration); if (isEnabled()) { Configuration handlerConfiguration = configuration.getChild("handler"); Configuration admin = handlerConfiguration.getChild("administrator_accounts"); Configuration[] accounts = admin.getChildren("account"); for (int i = 0; i < accounts.length; i++) { adminAccounts.put(accounts[i].getAttribute("login"), accounts[i].getAttribute("password")); } Configuration promtConfiguration = handlerConfiguration.getChild("prompt", false); if (promtConfiguration != null) prompt = promtConfiguration.getValue(); if (prompt == null) prompt = ""; else if (!prompt.equals("") && !prompt.endsWith(" ")) prompt += " "; } }
/** Configure this transformer. */ public void configure(Configuration conf) throws ConfigurationException { Configuration child; child = conf.getChild("use-request-parameters"); this.useParameters = child.getValueAsBoolean(false); this._useParameters = this.useParameters; child = conf.getChild("use-cookies"); this.useCookies = child.getValueAsBoolean(false); this._useCookies = this.useCookies; child = conf.getChild("use-session-info"); this.useSessionInfo = child.getValueAsBoolean(false); this._useSessionInfo = this.useSessionInfo; child = conf.getChild("transformer-factory"); // traxFactory is null, if transformer-factory config is unspecified final String traxFactory = child.getValue(null); child = conf.getChild("xslt-processor-role"); String xsltProcessorRole = child.getValue(XSLTProcessor.ROLE); if (!xsltProcessorRole.startsWith(XSLTProcessor.ROLE)) { xsltProcessorRole = XSLTProcessor.ROLE + '/' + xsltProcessorRole; } child = conf.getChild("check-includes"); this.checkIncludes = child.getValueAsBoolean(this.checkIncludes); child = conf.getChild("default-src", false); if (child != null) { this.defaultSrc = child.getValue(); } if (getLogger().isDebugEnabled()) { getLogger().debug("Use parameters is " + this.useParameters); getLogger().debug("Use cookies is " + this.useCookies); getLogger().debug("Use session info is " + this.useSessionInfo); getLogger().debug("Use TrAX Processor " + xsltProcessorRole); getLogger().debug("Check for included stylesheets is " + this.checkIncludes); if (traxFactory != null) { getLogger().debug("Use TrAX Transformer Factory " + traxFactory); } else { getLogger().debug("Use default TrAX Transformer Factory."); } getLogger().debug("Default source = " + this.defaultSrc); } try { this.xsltProcessor = (XSLTProcessor) this.manager.lookup(xsltProcessorRole); if (traxFactory != null) { this.xsltProcessor.setTransformerFactory(traxFactory); } } catch (ServiceException e) { throw new ConfigurationException("Cannot load XSLT processor", e); } try { // see the recyle() method to see what we need this for Class dtmManagerClass = Class.forName("org.apache.xml.dtm.DTMManager"); xalanDtmManagerGetIncrementalMethod = dtmManagerClass.getMethod("getIncremental", null); } catch (ClassNotFoundException e) { // do nothing -- user does not use xalan, so we don't need the dtm manager } catch (NoSuchMethodException e) { throw new ConfigurationException( "Was not able to get getIncremental method from Xalan's DTMManager.", e); } }