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

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

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

Configuration.getChild介绍

[英]Return a new Configuration instance encapsulating the specified child node.

If no such child node exists, an empty Configuration will be returned, allowing constructs such as conf.getChild("foo").getChild("bar").getChild("baz"). #getValue(String)("default");

If you wish to get a null return when no element is present, use #getChild(String,boolean).
[中]返回封装指定子节点的新Configuration实例。
如果不存在这样的子节点,则将返回一个空的Configuration,允许像conf.getChild("foo").getChild("bar").getChild("baz"). #getValue(String)("default");这样的构造
如果您希望在不存在任何元素时获得null返回,请使用#getChild(字符串,布尔值)。

代码示例

代码示例来源:origin: plutext/docx4j

/**
   * Configures a font substitution catalog
   *
   * @param substitutions font substitutions
   * @throws FOPException if something's wrong with the config data
   */
  public void configure(FontSubstitutions substitutions) throws FOPException {
    Configuration[] substitutionCfgs = cfg.getChildren("substitution");
    for (int i = 0; i < substitutionCfgs.length; i++) {
      Configuration fromCfg = substitutionCfgs[i].getChild("from", false);
      if (fromCfg == null) {
        throw new FOPException("'substitution' element without child 'from' element");
      }
      Configuration toCfg = substitutionCfgs[i].getChild("to", false);
      if (fromCfg == null) {
        throw new FOPException("'substitution' element without child 'to' element");
      }
      FontQualifier fromQualifier = getQualfierFromConfiguration(fromCfg);
      FontQualifier toQualifier = getQualfierFromConfiguration(toCfg);
      FontSubstitution substitution = new FontSubstitution(fromQualifier, toQualifier);
      substitutions.add(substitution);
    }
  }
}

代码示例来源:origin: plutext/docx4j

if (cfg.getChild("use-cache", false) != null) {
  try {
    fontManager.setUseCache(
        cfg.getChild("use-cache").getValueAsBoolean());
  } catch (ConfigurationException mfue) {
    LogUtil.handleException(log, mfue, true);
if (cfg.getChild("font-base", false) != null) {
  try {
    fontManager.setFontBaseURL(
        cfg.getChild("font-base").getValue(null));
  } catch (MalformedURLException mfue) {
    LogUtil.handleException(log, mfue, true);
Configuration fontsCfg = cfg.getChild("fonts", false);
if (fontsCfg != null) {
  Configuration substitutionsCfg = fontsCfg.getChild("substitutions", false);
  if (substitutionsCfg != null) {
    FontSubstitutionsConfigurator fontSubstitutionsConfigurator
  Configuration referencedFontsCfg = fontsCfg.getChild("referenced-fonts", false);
  if (referencedFontsCfg != null) {
    createReferencedFontsMatcher(referencedFontsCfg, strict, fontManager);

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

/**
 * Helper method to obtain the debug glag to use from the given
 * configuration object.
 *
 * @param config a <code>Configuration</code> instance
 * @return subject line
 */
private boolean getDebug( Configuration config )
  throws ConfigurationException
{
  return config.getChild( "debug" ).getValueAsBoolean();
}

代码示例来源: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 {
  Configuration[] interceptorConfigList = configuration.getChild("interceptors").getChildren("interceptor");
  this.defaultInterceptorList = new String[interceptorConfigList.length];
  for (int i = 0; i < interceptorConfigList.length; i++) {
    this.defaultInterceptorList[i] = interceptorConfigList[i].getValue();
  }
}

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

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
 */
public void configure(Configuration config) throws ConfigurationException
{
  this.cacheCheckFrequency = config.getChild("cacheCheckFrequency")
      .getValueAsLong(DEFAULT_CACHE_CHECK_FREQUENCY);
  this.cacheName = config.getChild("cacheName").getValue(DEFAULT_CACHE_NAME);
  this.configFile = config.getChild("configurationFile").getValue(null);
}

代码示例来源: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
{
  Configuration[] interceptorConfigList = configuration.getChild("interceptors").getChildren("interceptor");
  this.defaultInterceptorList = new String[interceptorConfigList.length];
  for( int i=0; i<interceptorConfigList.length; i++ )
  {
    this.defaultInterceptorList[i] = interceptorConfigList[i].getValue();
  }
}

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

public void configure(Configuration configuration) throws ConfigurationException {
  /* Read configuration nodes for recursive, parallel, recursive-parallel */
  this.defaultRecursive = configuration.getChild("recursive").getValueAsBoolean(false);
  this.defaultParallel = configuration.getChild("parallel").getValueAsBoolean(false);
  this.defaultRecursiveParallel = configuration.getChild("recursive-parallel").getValueAsBoolean(false);
  /* Read configuration node for thread pool name */
  this.threadPool = configuration.getChild("thread-pool").getValue("default");
  this.defaultKey = configuration.getChild("key").getValue(null);
}

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

/**
 * Avalon component lifecycle method
 */
@Override
public void configure(Configuration conf) throws ConfigurationException
{
  algorithm = conf.getChild("algorithm").getValue();
  cipher = conf.getChild("cipher").getValue();
}

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

/**
 * Configure the sets of allowed, forbidden and ignored children nodes.
 */
public void configure(Configuration config) throws ConfigurationException {
  this.allowedChildren   = getStringCollection(config.getChild("allowed-children"));
  this.forbiddenChildren = getStringCollection(config.getChild("forbidden-children"));
  this.ignoredChildren   = getStringCollection(config.getChild("ignored-children"));
}

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

/**
 * Should the default includes be read for this sitemap?
 */
protected static boolean isUsingDefaultIncludes(Configuration config) {
  return config.getChild("components").getAttributeAsBoolean("use-default-includes", true);
}

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

/**
 * @return Returns the componentConfigurationPropertiesLocation.
 */
protected String getLocation()
{
  return configuration.getChild("location").getValue(COMPONENT_CONFIG_PROPERTIES_VALUE );
}

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

/**
 * Helper method to obtain the subject line to use from the given
 * configuration object.
 *
 * @param config a <code>Configuration</code> instance
 * @return subject line
 */
private String getSubject( Configuration config )
  throws ConfigurationException
{
  return config.getChild( "subject" ).getValue();
}

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

/**
 * Helper method to obtain the maximum delay time any particular SMTP
 * message can be queued from a given configuration object.
 *
 * @param config a <code>Configuration</code> instance
 * @return maximum SMTP mail delay time
 */
private int getMaxDelayTime( Configuration config )
  throws ConfigurationException
{
  return config.getChild( "maximum-delay-time" ).getValueAsInteger( 0 );
}

代码示例来源: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);
  this.toStringBuilderClassName = configuration.getChild("toStringBuilderClass")
      .getValue(ArgumentToStringBuilderImpl.class.getName());
  this.monitorAllExceptions = configuration.getChild("monitorAllExceptions").getValueAsBoolean(true);
}

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

/**
 * Create a LogTarget based on a Configuration
 */
public final LogTarget createTarget( final Configuration configuration )
  throws ConfigurationException
{
  final Configuration confFormat = configuration.getChild( "format" );
  final Formatter formatter = getFormatter( confFormat );
  final LogTarget logtarget = new StreamTarget(System.out, formatter);
  return logtarget;
}

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

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
 */
public void configure(Configuration config) throws ConfigurationException {
  this.reloadScripts = config.getChild("reload-scripts").getValueAsBoolean(this.settings.isReloadingEnabled("flow"));
  this.checkTime = config.getChild("check-time").getValueAsLong(this.settings.getReloadDelay("flow"));
}

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

/**
 * Create a LogTarget based on a Configuration
 */
public final LogTarget createTarget( final Configuration configuration )
  throws ConfigurationException
{
  final Configuration confFilename = configuration.getChild( "filename" );
  final String filename = getFilename( confFilename.getValue() );
  final File file = new File( filename );
  final LogTarget logtarget = createTarget( file, configuration );
  return logtarget;
}

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

/**
 * @see org.apache.cocoon.components.modules.input.AbstractInputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
 */
public Object getAttribute(String name, Configuration modeConf, Map objectModel)
throws ConfigurationException {
  Object contextObj = getContextObject(modeConf, objectModel);
  if (modeConf != null) {
    name = modeConf.getChild("parameter").getValue(this.parameter != null ? this.parameter : name);
  }
  return JXPathHelper.getAttributeValue(name, modeConf, this.configuration, contextObj);
}

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

public LogTarget createTarget( final Configuration configuration )
    throws ConfigurationException
  {
    LF5LogTarget result = new LF5LogTarget();

    Configuration child = configuration.getChild( "NDC-pattern", false );
    if( null != child )
    {
      result.setNDCFormatter( new FormatterFactory().createFormatter( child ) );
    }

    return result;
  }
}

代码示例来源:origin: net.sf.barcode4j/barcode4j

/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
 */
public void configure(Configuration cfg) throws ConfigurationException {
  //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
  Length mw = new Length(cfg.getChild("module-width").getValue("0.33mm"), "mm");
  getUPCEANBean().setModuleWidth(mw.getValueAsMillimeter());
  super.configure(cfg);
  
  //Checksum mode        
  getUPCEANBean().setChecksumMode(ChecksumMode.byName(
    cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));
}

相关文章