本文整理了Java中org.apache.avalon.framework.configuration.Configuration.getChildren()
方法的一些代码示例,展示了Configuration.getChildren()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getChildren()
方法的具体详情如下:
包路径:org.apache.avalon.framework.configuration.Configuration
类名称:Configuration
方法名:getChildren
[英]Return an Array
of Configuration
elements containing all node children. The array order will reflect the order in the source config file.
[中]返回包含所有节点子级的Configuration
元素的Array
。数组顺序将反映源配置文件中的顺序。
代码示例来源:origin: plutext/docx4j
private static void createReferencedFontsMatcher(Configuration referencedFontsCfg,
boolean strict, FontManager fontManager) throws FOPException {
List matcherList = new java.util.ArrayList();
Configuration[] matches = referencedFontsCfg.getChildren("match");
for (int i = 0; i < matches.length; i++) {
try {
matcherList.add(new FontFamilyRegExFontTripletMatcher(
matches[i].getAttribute("font-family")));
} catch (ConfigurationException ce) {
LogUtil.handleException(log, ce, strict);
continue;
}
}
FontTriplet.Matcher orMatcher = new OrFontTripletMatcher(
(FontTriplet.Matcher[])matcherList.toArray(
new FontTriplet.Matcher[matcherList.size()]));
fontManager.setReferencedFontsMatcher(orMatcher);
}
代码示例来源: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: org.apache.excalibur.containerkit/excalibur-logger
/**
* Interpret configuration to build loggers.
*
* @param configuration the configuration
* @throws ConfigurationException if malformed configuration
*/
public void configure( final Configuration configuration )
throws ConfigurationException
{
final Configuration[] targets = configuration.getChildren( "log-target" );
final HashMap targetSet = configureTargets( targets );
m_targets = targetSet.values();
final Configuration[] categories = configuration.getChildren( "category" );
configureCategories( categories, targetSet );
}
代码示例来源:origin: org.apache.cocoon/cocoon-linkrewriter-impl
/**
* Retrieve a dynamic Configuration for a specific InputModule.
* @param scheme InputModule name
* @return Configuration for specified scheme, from the map:transformer block.
*/
private Configuration getConf(String scheme) {
Configuration[] schemeConfs = this.conf.getChildren();
for (int i=0; i<schemeConfs.length; i++) {
if (scheme.equals(schemeConfs[i].getAttribute("name", null))) {
return schemeConfs[i];
}
}
return null;
}
代码示例来源:origin: org.apache.cocoon/cocoon-linkrewriter-impl
/**
* Retrieve a dynamic configuration for a specific InputModule.
*
* @param scheme InputModule name
* @return Configuration for specified scheme, from the map:transformer block.
*/
private Configuration getConf(String scheme) {
Configuration[] schemeConfs = this.conf.getChildren("input-module");
for (int i = 0; i < schemeConfs.length; i++) {
if (scheme.equals(schemeConfs[i].getAttribute("name", null))) {
return schemeConfs[i];
}
}
return null;
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* Recursively resolve constraint sets that may "include" other constraint
* sets and return a collection of all parameters to validate.
*
* @param valsetstr
* @param consets
* @return collection of all parameters to validate
*/
protected Collection resolveConstraints(String valsetstr, Map consets) {
/* get the list of params to be validated */
Vector rules = new Vector();
Configuration[] set = ((Configuration) consets.get(valsetstr)).getChildren("validate");
for (int j = 0; j < set.length; j++) {
rules.add(set[j]);
}
set = ((Configuration) consets.get(valsetstr)).getChildren("include");
for (int j = 0; j < set.length; j++) {
Collection tmp = resolveConstraints(set[j].getAttribute("name", ""), consets);
rules.addAll(tmp);
}
return rules;
}
代码示例来源: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.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.avalon.framework/avalon-framework-impl
/**
* Add all child <code>Configuration</code> objects from specified
* configuration element to current configuration element.
*
* @param other the other {@link Configuration} value
*/
public void addAllChildren( final Configuration other )
{
checkWriteable();
final Configuration[] children = other.getChildren();
for( int i = 0; i < children.length; i++ )
{
addChild( children[ i ] );
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-core
/**
* @param conf
*/
private void setupRefreshJobs(final Configuration conf) {
if (conf != null) {
final Configuration[] children = conf.getChildren(TAGNAME_TARGET);
if (children != null) {
for (int i = 0; i < children.length; i++) {
try {
setupSingleRefreshJob(children[i]);
} catch (CascadingException ignore) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Setting up refresh job, ignoring exception:", ignore);
}
}
}
}
}
}
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
/**
* Helper method to obtain the <i>to</i> address/es from the
* given configuration.
*
* @param config <code>Configuration</code> instance
* @return an array of <code>Address</code> objects
* @exception ConfigurationException if a configuration error occurs
* @exception AddressException if a addressing error occurs
*/
private Address[] getToAddresses( final Configuration config )
throws ConfigurationException, AddressException
{
final Configuration[] toAddresses = config.getChildren( "to" );
final Address[] addresses = new Address[ toAddresses.length ];
for( int i = 0; i < toAddresses.length; ++i )
{
addresses[ i ] = createAddress( toAddresses[ i ].getValue() );
}
return addresses;
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* <p>Configure this instance parsing all regular expression patterns.</p>
*
* @param configuration the {@link Configuration} instance where configured
* patterns are defined.
* @throws ConfigurationException if one of the regular-expression to configure
* could not be compiled.
*/
public void configure(Configuration configuration)
throws ConfigurationException {
Configuration patterns[] = configuration.getChildren("pattern");
for (int x = 0; x < patterns.length; x++) {
String name = patterns[x].getAttribute("name");
String pattern = patterns[x].getValue();
this.patterns.put(name, this.compile(pattern));
}
}
代码示例来源:origin: org.docx4j/docx4j
private static void createReferencedFontsMatcher(Configuration referencedFontsCfg,
boolean strict, FontManager fontManager) throws FOPException {
List matcherList = new java.util.ArrayList();
Configuration[] matches = referencedFontsCfg.getChildren("match");
for (int i = 0; i < matches.length; i++) {
try {
matcherList.add(new FontFamilyRegExFontTripletMatcher(
matches[i].getAttribute("font-family")));
} catch (ConfigurationException ce) {
LogUtil.handleException(log, ce, strict);
continue;
}
}
FontTriplet.Matcher orMatcher = new OrFontTripletMatcher(
(FontTriplet.Matcher[])matcherList.toArray(
new FontTriplet.Matcher[matcherList.size()]));
fontManager.setReferencedFontsMatcher(orMatcher);
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* compatibility with 2.1.x - check for global variables in sitemap
* TODO - This will be removed in later versions!
*/
protected static Properties getGlobalSitemapVariables(Configuration sitemap)
throws ConfigurationException {
Properties variables = null;
final Configuration varConfig = sitemap.getChild("pipelines").getChild("component-configurations").getChild("global-variables", false);
if ( varConfig != null ) {
Deprecation.logger.warn("The 'component-configurations' section in the sitemap is deprecated. Please check for alternatives.");
variables = new Properties();
final Configuration[] variableElements = varConfig.getChildren();
for(int v=0; v<variableElements.length; v++) {
variables.setProperty(variableElements[v].getName(), variableElements[v].getValue());
}
}
return variables;
}
代码示例来源:origin: org.apache.cocoon/cocoon-template-impl
public void setupInstructions(Configuration conf) throws ConfigurationException {
Configuration[] instructionSets = conf.getChildren("instructions");
for (int i = 0; i < instructionSets.length; i++) {
Configuration instructionSet = instructionSets[i];
String namespace = instructionSet.getAttribute("targetNamespace", "");
Configuration[] instr = instructionSet.getChildren("instruction");
for (int j = 0; j < instr.length; j++) {
Configuration currentInstruction = instr[j];
String name = currentInstruction.getAttribute("name");
if (name == null)
throw new ConfigurationException("@name for instruction required");
String className = currentInstruction.getAttribute("class");
if (className == null)
throw new ConfigurationException("@class for instruction required");
registerInstruction(name, namespace, className);
}
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* Register all extension packages listed in the configuration
* through <code><package name="fully.qualified.package"
* prefix="prefix"/></code> in the given FunctionLibrary.
*
* @param conf a <code>Configuration</code> value
*/
private void getPackages(Configuration conf) {
Configuration[] children = conf.getChildren("package");
int i = children.length;
while (i-- > 0) {
String packageName = children[i].getAttribute("name", null);
String prefix = children[i].getAttribute("prefix", null);
if (packageName != null && prefix != null) {
this.library.addFunctions(new PackageFunctions(packageName, prefix));
}
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* Configures the database access helper.
*
* Takes all elements nested in component declaration and stores
* them as key-value pairs in <code>settings</code>. Nested
* configuration option are not catered for. This way global
* configuration options can be used.
*
* For nested configurations override this function.
* */
public void configure(Configuration conf) throws ConfigurationException {
Configuration[] parameters = conf.getChildren();
this.settings = new HashMap(parameters.length);
for (int i = 0; i < parameters.length; i++) {
String key = parameters[i].getName();
String val = parameters[i].getValue("");
this.settings.put (key, val);
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* Configures the Action.
*
* Takes the children from the <code>Configuration</code> and stores them
* them as key (configuration name) and value (configuration value)
* in <code>settings</code>.
* <br/>
* This automates parsing of flat string-only configurations.
* For nested configurations, override this function in your action.
*/
public void configure(Configuration conf) throws ConfigurationException {
Configuration[] parameters = conf.getChildren();
this.settings = new HashMap(parameters.length);
for (int i = 0; i < parameters.length; i++) {
String key = parameters[i].getName();
String val = parameters[i].getValue(null);
this.settings.put(key, val);
}
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/**
* Configures the module.
*
* <p>Takes all elements nested in component declaration and stores
* them as key-value pairs in <code>settings</code>. Nested
* configuration option are not catered for. This way global
* configuration options can be used.</p>
*
* <p>For nested configurations override this function.</p>
*/
public void configure(Configuration conf) throws ConfigurationException {
Configuration[] parameters = conf.getChildren();
// Ideally here should be length * 1.333(3) but simple +1 will do for lengths up to 3
this.settings = new HashMap(parameters.length + 1);
for (int i = 0; i < parameters.length; i++) {
String key = parameters[i].getName();
String val = parameters[i].getValue("");
this.settings.put(key, val);
}
}
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
private MessageBuilder getMessageBuilder( final Configuration configuration )
throws ConfigurationException
{
final String messageType = configuration.getAttribute( "type", "object" );
if( "text".equals( messageType ) )
{
final Configuration[] propertyConf =
configuration.getChild( "property", true ).getChildren();
final Configuration formatterConf = configuration.getChild( "format" );
final PropertyInfo[] properties = new PropertyInfo[ propertyConf.length ];
for( int i = 0; i < properties.length; i++ )
{
final String name = propertyConf[ i ].getValue();
final int type = PropertyType.getTypeIdFor( propertyConf[ i ].getName() );
final String aux = propertyConf[ i ].getAttribute( "aux", null );
properties[ i ] = new PropertyInfo( name, type, aux );
}
final Formatter formatter = getFormatter( formatterConf );
return new TextMessageBuilder( properties, formatter );
}
return new ObjectMessageBuilder();
}
内容来源于网络,如有侵权,请联系作者删除!