org.apache.avalon.framework.configuration.Configuration.getAttributeAsInteger()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.apache.avalon.framework.configuration.Configuration.getAttributeAsInteger()方法的一些代码示例,展示了Configuration.getAttributeAsInteger()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getAttributeAsInteger()方法的具体详情如下:
包路径:org.apache.avalon.framework.configuration.Configuration
类名称:Configuration
方法名:getAttributeAsInteger

Configuration.getAttributeAsInteger介绍

[英]Return the int value of the specified attribute contained in this node.
[中]返回此节点中包含的指定属性的int值。

代码示例

代码示例来源:origin: org.apache.excalibur.fortress.container/excalibur-fortress-container-impl

/**
 * Configuration of the handler under which the minimum pool size
 * is established.
 * @param configuration the configuration fragment
 */
public void configure( final Configuration configuration )
{
  m_poolMin = configuration.getAttributeAsInteger( "pool-min", 10 );
}

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-instrument-mgr-impl

/**
 * Used to load the state, called from AbstractInstrumentSample.loadState();
 * <p>
 * Should only be called when synchronized.
 *
 * @param value Current value loaded from the state.
 * @param state Configuration object to load state from.
 *
 * @throws ConfigurationException If there were any problems loading the
 *                                state.
 */
protected void loadState( int value, Configuration state )
  throws ConfigurationException
{
  m_value = value;
  m_valueCount = state.getAttributeAsInteger( "value-count" );
  m_lastValue = state.getAttributeAsInteger( "last-value" );
}

代码示例来源:origin: org.apache.fulcrum/fulcrum-cache

/**
 * Avalon component lifecycle method
 */
public void configure(Configuration conf) throws ConfigurationException
{
  this.cacheCheckFrequency = conf.getAttributeAsLong(
      CACHE_CHECK_FREQUENCY, DEFAULT_CACHE_CHECK_FREQUENCY);
  this.cacheInitialSize = conf.getAttributeAsInteger(INITIAL_CACHE_SIZE,
      DEFAULT_INITIAL_CACHE_SIZE);
}

代码示例来源:origin: org.apache.fulcrum/fulcrum-upload

/**
 * Avalon component lifecycle method
 */
public void configure(Configuration conf)
{
  repositoryPath = conf.getAttribute(
      UploadService.REPOSITORY_KEY,
      UploadService.REPOSITORY_DEFAULT);
  headerEncoding = conf.getAttribute(
      UploadService.HEADER_ENCODING_KEY,
      UploadService.HEADER_ENCODING_DEFAULT);
  sizeMax = conf.getAttributeAsInteger(
      UploadService.SIZE_MAX_KEY,
      UploadService.SIZE_MAX_DEFAULT);
  sizeThreshold = conf.getAttributeAsInteger(
      UploadService.SIZE_THRESHOLD_KEY,
      UploadService.SIZE_THRESHOLD_DEFAULT);
}

代码示例来源:origin: org.apache.fulcrum/fulcrum-yaafi

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
 */
public void configure(Configuration configuration) throws ConfigurationException {
  super.configure(configuration);
  this.maxArgLength = configuration.getChild("maxArgLength").getValueAsInteger(MAX_ARG_LENGTH);
  Configuration tresholdConfiguration = configuration.getChild("tresholds");
  this.tresholdList[0] = tresholdConfiguration.getChild("fatal").getAttributeAsInteger("millis", 5000);
  this.tresholdList[1] = tresholdConfiguration.getChild("error").getAttributeAsInteger("millis", 1000);
  this.tresholdList[2] = tresholdConfiguration.getChild("warn").getAttributeAsInteger("millis", 500);
  this.tresholdList[3] = tresholdConfiguration.getChild("info").getAttributeAsInteger("millis", 100);
  this.tresholdList[4] = tresholdConfiguration.getChild("debug").getAttributeAsInteger("millis", 10);
}

代码示例来源:origin: org.apache.turbine/fulcrum-yaafi

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
 */
public void configure(Configuration configuration) throws ConfigurationException
{
  super.configure(configuration);
  this.maxArgLength = configuration.getChild("maxArgLength").getValueAsInteger(MAX_ARG_LENGTH);
  Configuration tresholdConfiguration = configuration.getChild("tresholds");
  this.tresholdList[0] = tresholdConfiguration.getChild("fatal").getAttributeAsInteger("millis", 5000);
  this.tresholdList[1] = tresholdConfiguration.getChild("error").getAttributeAsInteger("millis", 1000);
  this.tresholdList[2] = tresholdConfiguration.getChild("warn").getAttributeAsInteger("millis", 500);
  this.tresholdList[3] = tresholdConfiguration.getChild("info").getAttributeAsInteger("millis", 100);
  this.tresholdList[4] = tresholdConfiguration.getChild("debug").getAttributeAsInteger("millis", 10);
}

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger

throws ConfigurationException
final int queuesize = configuration.getAttributeAsInteger( "queue-size", -1 );
final Configuration config = configuration.getChildren()[ 0 ];
final LogTargetFactory factory = m_logTargetFactoryManager.getLogTargetFactory( config.getName() );
  threadPriority = configuration.getAttributeAsInteger( "priority", 1 );

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger

protected FileStrategy getFileStrategy( final Configuration conf, final File file )
{
  final String type = conf.getAttribute( "type", "unique" );
  if( "revolving".equals( type ) )
  {
    final int initialRotation =
      conf.getAttributeAsInteger( "init", 5 );
    final int maxRotation =
      conf.getAttributeAsInteger( "max", 10 );
    return new RevolvingFileStrategy( file, initialRotation, maxRotation );
  }
  // default file strategy
  final String pattern = conf.getAttribute( "pattern", null );
  final String suffix = conf.getAttribute( "suffix", null );
  if( pattern == null )
  {
    return new UniqueFileStrategy( file );
  }
  else
  {
    if( suffix == null )
    {
      return new UniqueFileStrategy( file, pattern );
    }
    else
    {
      return new UniqueFileStrategy( file, pattern, suffix );
    }
  }
}

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger

if( "avalon".equals( type ) )
  final int depth = conf.getAttributeAsInteger( "depth", AvalonFormatter.DEFAULT_STACK_DEPTH );
  final boolean printCascading = conf.getAttributeAsBoolean( "cascading", AvalonFormatter.DEFAULT_PRINT_CASCADING );
  return new AvalonFormatter( format, depth, printCascading );

代码示例来源:origin: org.apache.excalibur.component/excalibur-component

/**
 * 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 );
}

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger

final int port = configChild.getAttributeAsInteger( "port" );

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger

int port = configChild.getAttributeAsInteger( "port" );

代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl

public ProcessingNode buildNode(Configuration config) throws Exception {

    String type = this.treeBuilder.getTypeForStatement(config, Reader.ROLE);
    
    String mimeType = config.getAttribute("mime-type", null);
    if (mimeType == null) {
      mimeType = ((SitemapLanguage)this.treeBuilder).getMimeType(Reader.ROLE, type);
    }

    ReadNode node = new ReadNode(
      type,
      VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager),
      VariableResolverFactory.getResolver(mimeType, this.manager),
      config.getAttributeAsInteger("status-code", -1)
    );

    return this.treeBuilder.setupNode(node, config);
  }
}

代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl

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);
  }
}

代码示例来源:origin: org.apache.fulcrum/fulcrum-yaafi

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
 */
public void configure(Configuration configuration) throws ConfigurationException {
  // limit to minimum interval of 1 second
  this.interval = Math.max(configuration.getAttributeAsInteger("interval", 5000), 1000);
  this.getLogger().debug("Monitoring the resources every " + this.interval + " ms");
  if (configuration.getChild("entry", false) != null) {
    Configuration shutdownConfig = configuration.getChild("entry");
    String shutdownEntryLocation = shutdownConfig.getChild("location").getValue();
    this.shutdownEntry = new ShutdownEntry(this.getLogger(), this.applicationDir, shutdownEntryLocation,
        shutdownConfig.getChild("useSystemExit").getValueAsBoolean(false));
    this.getLogger().debug("Using a shutdown entry : " + shutdownEntryLocation);
  } else {
    this.shutdownEntry = null;
    this.getLogger().debug("No shutdown entry defined");
  }
}

代码示例来源:origin: org.apache.turbine/fulcrum-yaafi

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
 */
public void configure(Configuration configuration) throws ConfigurationException
{
  // limit to minimum interval of 1 second
  this.interval = Math.max( configuration.getAttributeAsInteger("interval",5000), 1000 );
  this.getLogger().debug( "Monitoring the resources every " + this.interval + " ms" );
  if( configuration.getChild("entry",false) != null )
  {
    Configuration shutdownConfig = configuration.getChild("entry");
    String shutdownEntryLocation = shutdownConfig.getChild("location").getValue();
    this.shutdownEntry = new ShutdownEntry(
      this.getLogger(),
      this.applicationDir,
      shutdownEntryLocation,
      shutdownConfig.getChild("useSystemExit").getValueAsBoolean(false)
      );
    this.getLogger().debug( "Using a shutdown entry : " + shutdownEntryLocation );
  }
  else
  {
    this.shutdownEntry = null;
    this.getLogger().debug( "No shutdown entry defined" );
  }
}

代码示例来源:origin: org.apache.fulcrum/fulcrum-yaafi

this.interval = Math.max(configuration.getAttributeAsInteger("interval", 5000), 1000);

代码示例来源:origin: org.apache.turbine/fulcrum-yaafi

this.interval = Math.max( configuration.getAttributeAsInteger("interval",5000), 1000 );

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-instrument-mgr-impl

instrumentSampleConf.getAttribute( "type" ) );
long sampleInterval = instrumentSampleConf.getAttributeAsLong( "interval" );
int sampleSize = instrumentSampleConf.getAttributeAsInteger( "size", 1 );

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-instrument-mgr-impl

sampleConf.getAttribute( "type" ) );
long sampleInterval = sampleConf.getAttributeAsLong( "interval" );
int sampleSize = sampleConf.getAttributeAsInteger( "size" );

相关文章