/** * Should the default includes be read for this sitemap? */ protected static boolean isUsingDefaultIncludes(Configuration config) { return config.getChild("components").getAttributeAsBoolean("use-default-includes", true); }
/** * Avalon component lifecycle method * * This method processes the repository path, to make it relative to the web * application root, if neccessary. It supports URL-style repositories. */ public void configure(Configuration conf) throws ConfigurationException { StringBuffer sb = new StringBuffer(conf.getAttribute(STYLESHEET_PATH, "/")); // is URL? if (!sb.toString().matches("[a-zA-Z]{3,}://.*")) { // No if (sb.charAt(0) != '/') { sb.insert(0, '/'); } sb.insert(0, applicationRoot); sb.insert(0, "file:"); } if (sb.charAt(sb.length() - 1) != '/') { sb.append('/'); } path = sb.toString(); caching = conf.getAttributeAsBoolean(STYLESHEET_CACHING, false); }
/** * Create a PoolableComponentHandler which manages a pool of Components * created by the specified factory object. * * @param factory The factory object which is responsible for creating the components * managed by the ComponentHandler. * @param config The configuration to use to configure the pool. */ public PoolableComponentHandler( final DefaultComponentFactory factory, final Configuration config ) throws Exception { m_factory = factory; int poolMax = config.getAttributeAsInteger( "pool-max", DEFAULT_MAX_POOL_SIZE ); boolean poolMaxStrict = config.getAttributeAsBoolean( "pool-max-strict", false ); boolean poolBlocking = config.getAttributeAsBoolean( "pool-blocking", true ); long poolTimeout = config.getAttributeAsLong( "pool-timeout", 0 ); long poolTrimInterval = config.getAttributeAsLong( "pool-trim-interval", 0 ); m_pool = new InstrumentedResourceLimitingPool( m_factory, poolMax, poolMaxStrict, poolBlocking, poolTimeout, poolTrimInterval ); // Initialize the Instrumentable elements. addChildInstrumentable( m_pool ); }
String location = target.getAttribute( "location" ).trim(); final String format = target.getAttribute( "format", DEFAULT_FORMAT ); final boolean append = target.getAttributeAsBoolean( "append", true );
final boolean printCascading = conf.getAttributeAsBoolean( "cascading", AvalonFormatter.DEFAULT_PRINT_CASCADING ); return new AvalonFormatter( format, depth, printCascading );
public ProcessingNode buildNode(Configuration config) throws Exception { final Settings settings = (Settings)manager.lookup(Settings.ROLE); MountNode node = new MountNode( VariableResolverFactory.getResolver(config.getAttribute("uri-prefix"), manager), VariableResolverFactory.getResolver(config.getAttribute("src"), manager), this.treeBuilder.getProcessor().getWrappingProcessor(), config.getAttributeAsBoolean("check-reload", settings.isReloadingEnabled("sitemap")), config.getAttributeAsBoolean("pass-through", false) ); return (this.treeBuilder.setupNode(node, config)); } }
config.getAttributeAsBoolean("session", false), config.getAttributeAsBoolean("global", false), config.getAttributeAsBoolean("permanent", false) ); return this.treeBuilder.setupNode(URINode, config);
/** * Populates the underlying <code>Hierarchy</code>. * * @param configuration The configuration object. * @throws ConfigurationException if the configuration is malformed */ public final void configure( final Configuration configuration ) throws ConfigurationException { final Configuration factories = configuration.getChild( "factories" ); final LogTargetFactoryManager targetFactoryManager = setupTargetFactoryManager( factories ); final Configuration targets = configuration.getChild( "targets" ); final LogTargetManager targetManager = setupTargetManager( targets, targetFactoryManager ); final Configuration categories = configuration.getChild( "categories" ); setupLoggers( targetManager, null, categories, true, categories.getAttributeAsBoolean( "additive", false ) ); }
name = entry.getAttribute("name", clazzName); shorthand = entry.getAttribute("shorthand", name); isEarlyInit = entry.getAttributeAsBoolean("early-init", true); description = entry.getAttribute("description", null); componentType = entry.getAttribute("component-type", "avalon"); componentFlavour = entry.getAttribute("component-flavour", AvalonYaafiConstants.AVALON_CONTAINER_YAAFI); hasProxy = entry.getAttributeAsBoolean("has-proxy", true); logCategory = entry.getAttribute("logger", shorthand);
/** * Reads a configuration object and creates the category mapping. * * @param configuration The configuration object. * @throws ConfigurationException if the configuration is malformed */ public void configure( final Configuration configuration ) throws ConfigurationException { final Configuration factories = configuration.getChild( "factories" ); final LogTargetFactoryManager targetFactoryManager = setupTargetFactoryManager( factories ); final Configuration targets = configuration.getChild( "targets" ); final LogTargetManager targetManager = setupTargetManager( targets, targetFactoryManager ); final Configuration categories = configuration.getChild( "categories" ); final Configuration[] category = categories.getChildren( "category" ); setupLoggers( targetManager, m_prefix, category, true, categories.getAttributeAsBoolean( "additive", false ) ); }
/** * Check that all top level elements are named proxool and hand them to * {@link XMLConfigurator}. * @param configuration the configuration handed over by the Avalon Framework. * @throws ConfigurationException if the configuration fails. */ public void configure(Configuration configuration) throws ConfigurationException { final XMLConfigurator xmlConfigurator = new XMLConfigurator(); this.closeOnDispose = configuration.getAttributeAsBoolean(CLOSE_ON_DISPOSE_ATTRIBUTE, true); final Configuration[] children = configuration.getChildren(); for (int i = 0; i < children.length; ++i) { if (!children[i].getName().equals(ProxoolConstants.PROXOOL)) { throw new ConfigurationException("Found element named " + children[i].getName() + ". Only " + ProxoolConstants.PROXOOL + " top level elements are alowed."); } } try { xmlConfigurator.startDocument(); reportProperties(xmlConfigurator, configuration.getChildren()); xmlConfigurator.endDocument(); } catch (SAXException e) { throw new ConfigurationException("", e); } }
/** * Check that all top level elements are named proxool and hand them to * {@link XMLConfigurator}. * @param configuration the configuration handed over by the Avalon Framework. * @throws ConfigurationException if the configuration fails. */ public void configure(Configuration configuration) throws ConfigurationException { final XMLConfigurator xmlConfigurator = new XMLConfigurator(); this.closeOnDispose = configuration.getAttributeAsBoolean(CLOSE_ON_DISPOSE_ATTRIBUTE, true); final Configuration[] children = configuration.getChildren(); for (int i = 0; i < children.length; ++i) { if (!children[i].getName().equals(ProxoolConstants.PROXOOL)) { throw new ConfigurationException("Found element named " + children[i].getName() + ". Only " + ProxoolConstants.PROXOOL + " top level elements are alowed."); } } try { xmlConfigurator.startDocument(); reportProperties(xmlConfigurator, configuration.getChildren()); xmlConfigurator.endDocument(); } catch (SAXException e) { throw new ConfigurationException("", e); } }
public void configure(Configuration config) { this.defaultTimeToLive = config.getAttributeAsInteger("time-to-live", (3600 * 1000)); this.bindContinuationsToSession = config.getAttributeAsBoolean( "session-bound-continuations", false ); // create a global ContinuationsHolder if this the "session-bound-continuations" parameter is set to false if (!this.bindContinuationsToSession) { this.continuationsHolder = new WebContinuationsHolder(); } final Configuration expireConf = config.getChild("expirations-check"); final long initialDelay = expireConf.getChild("offset", true).getValueAsLong(180000); this.expirationCheckInterval = expireConf.getChild("period", true).getValueAsLong(180000); try { final RunnableManager runnableManager = (RunnableManager)serviceManager.lookup(RunnableManager.ROLE); runnableManager.execute( new Runnable() { public void run() { expireContinuations(); } }, initialDelay, expirationCheckInterval); serviceManager.release(runnableManager); } catch (Exception e) { getLogger().warn("Could not enqueue continuations expiration task. " + "Continuations will not automatically expire.", e); } }
/** * Configure the tree processor: * <processor file="{Location of the sitemap}" * check-reload="{true|false}" * config="{Location of sitemap tree processor config}> * <reload delay="10"/> * </processor> * * Only the file attribute is required; everything else is optional. * * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration config) throws ConfigurationException { this.checkReload = config.getAttributeAsBoolean("check-reload", this.settings.isReloadingEnabled("sitemap")); // Reload check delay. Default is 1 second. this.lastModifiedDelay = config.getChild("reload").getAttributeAsLong("delay", this.settings.getReloadDelay("sitemap")); String fileName = config.getAttribute("file", "sitemap.xmap"); try { this.source = new DelayedRefreshSourceWrapper(this.resolver.resolveURI(fileName), lastModifiedDelay); } catch (Exception e) { throw new ConfigurationException("Cannot resolve " + fileName, e); } }
for (int j = 0; j < features.length; j++) { boolean featureValue = features[j] .getAttributeAsBoolean("value", false); String feature = features[j].getValue(); getLogger().debug(
public void fill(Configuration config) { // test model final String componentModel = config.getAttribute("model", null); if ( TYPE_POOLED.equals(componentModel) ) { this.setModel(ComponentInfo.MODEL_POOLED); this.setPoolInMethodName(config.getAttribute("pool-in", null)); this.setPoolOutMethodName(config.getAttribute("pool-out", null)); } else if (TYPE_NON_THREAD_SAFE_POOLED.equals(componentModel)) { this.setModel(ComponentInfo.MODEL_POOLED); this.setPoolInMethodName(config.getAttribute("pool-in", null)); this.setPoolOutMethodName(config.getAttribute("pool-out", null)); } else if ( TYPE_SINGLETON.equals(componentModel) ) { this.setModel(ComponentInfo.MODEL_SINGLETON); } // init/destroy methods this.setInitMethodName(config.getAttribute("init", null)); this.setDestroyMethodName(config.getAttribute("destroy", null)); // logging this.setLoggerCategory(config.getAttribute("logger", null)); this.setRole(config.getAttribute("role", null)); // default value final String newDefaultValue = config.getAttribute("default", null); if ( newDefaultValue != null ) { this.defaultValue = newDefaultValue; } this.lazyInit = config.getAttributeAsBoolean("lazy-init", this.lazyInit); }
node.setInternalOnly(false); } else { node.setInternalOnly(config.getAttributeAsBoolean(PipelineNodeBuilder.ATTRIBUTE_INTERNAL_ONLY, false));
configuration.getAttributeAsBoolean( "close-wrapped-targets", true );
conf.getChild( "year" ).getValueAsInteger( -1 ); final boolean dayOfWeek = conf.getChild( "day" ).getAttributeAsBoolean( "week", false );
if (!includeStatement.getAttributeAsBoolean("optional", false)) { throw new ConfigurationException("Directory '" + directoryURI + "' does not exist (" + includeStatement.getLocation() + ").");