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

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

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

Configuration.getAttribute介绍

[英]Return the value of specified attribute.
[中]返回指定属性的值。

代码示例

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

private static FontQualifier getQualfierFromConfiguration(Configuration cfg)
throws FOPException {
  String fontFamily = cfg.getAttribute("font-family", null);
  if (fontFamily == null) {
    throw new FOPException("substitution qualifier must have a font-family");
  }
  FontQualifier qualifier = new FontQualifier();
  qualifier.setFontFamily(fontFamily);
  String fontWeight = cfg.getAttribute("font-weight", null);
  if (fontWeight != null) {
    qualifier.setFontWeight(fontWeight);
  }
  String fontStyle = cfg.getAttribute("font-style", null);
  if (fontStyle != null) {
    qualifier.setFontStyle(fontStyle);
  }
  return qualifier;
}

代码示例来源:origin: com.cloudhopper.proxool/proxool

private Attributes getAttributes(Configuration configuration) throws ConfigurationException {
    final AttributesImpl attributes = new AttributesImpl();
    final String[] avalonAttributeNames = configuration.getAttributeNames();
    if (avalonAttributeNames != null && avalonAttributeNames.length > 0) {
      for (int i = 0; i < avalonAttributeNames.length; ++i) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Adding attribute " + avalonAttributeNames[i] + " with value "
            + configuration.getAttribute(avalonAttributeNames[i]));
        }
        attributes.addAttribute("", avalonAttributeNames[i], avalonAttributeNames[i], "CDATA",
            configuration.getAttribute(avalonAttributeNames[i]));
          LOG.debug("In attributes: " + avalonAttributeNames[i] + " with value "
            + attributes.getValue(avalonAttributeNames[i]));
        }
      }
    return attributes;
  }
}

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

/**
 * @param conf
 * @throws ConfigurationException
 */
private void setupSingleRefreshJob(final Configuration conf) throws ConfigurationException {
  try {
    String key = NetUtils.decode(conf.getAttribute(ATTR_KEY), "utf-8");
    String uri = NetUtils.decode(conf.getAttribute(ATTR_URI), "utf-8");
    long interval = conf.getAttributeAsLong(ATTR_INTERVAL);
    addRefreshSource(key, uri, 10, interval);
  } catch (UnsupportedEncodingException e) {
    /* Won't happen */
  }
}

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

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

代码示例来源: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: 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: org.apache.fulcrum/fulcrum-security-api

/**
 * Avalon component lifecycle method
 */
@Override
public void configure(Configuration conf)
{
  globalGroupName = conf.getAttribute(
      TurbineModelManager.GLOBAL_GROUP_ATTR_NAME,
      TurbineModelManager.GLOBAL_GROUP_NAME);
  //cascadeDelete = conf.getAttributeAsBoolean( TurbineModelManager.CASCADE_DELETE_ATTR_NAME, false );
}

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

public boolean hasConfiguredLazyInit() {
    return this.configuration != null && this.configuration.getAttribute("lazy-init", null) != 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();
  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-core

public void configure(Configuration config) throws ConfigurationException {
  this.startElement = new ElementData();
  this.startElement.uri = config.getChild("start").getAttribute("uri", "");
  this.startElement.loc = config.getChild("start").getAttribute("local-name", "form-instance");
  this.startElement.raw = config.getChild("start").getAttribute("raw-name", "form-instance");
  this.nameElement = new ElementData();
  this.nameElement.uri = config.getChild("name").getAttribute("uri", "");
  this.nameElement.loc = config.getChild("name").getAttribute("local-name", "form");
  this.nameElement.raw = config.getChild("name").getAttribute("raw-name", "form");
  this.qname = config.getChild("name").getAttribute("name-attribute", "name");
  this.nameAsRoot = config.getChild("name-as-root").getValueAsBoolean(this.nameAsRoot);
  this.outputConf = config.getChild("output");
  this.outputModuleName = this.outputConf.getAttribute("name",this.outputModuleName);
}

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

public ProcessingNode buildNode(Configuration config) throws Exception {

    NamedContainerNode node = new NamedContainerNode(config.getAttribute(this.nameAttr));
    this.setupNode(node, config);
    return node;
  }
}

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

public ProcessingNode buildNode(Configuration config)
throws Exception {
  String source = config.getAttribute("src");
  this.node = new ScriptNode(source);
  this.treeBuilder.setupNode(this.node, config);
  return this.node;
}

代码示例来源: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

/**
 * The category name is the value of the "category-name" child, or if not
 * present, the name of the configuration element.
 */
public void configure(Configuration config) throws ConfigurationException {
  super.configure(config);
  this.name = config.getChild("category-name").getValue(config.getAttribute("name"));
}

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

private void initializeRoleManager( Configuration roleManagerConfig )
  throws Exception
{
  // Get the logger for the role manager
  Logger rmLogger = m_loggerManager.getLoggerForCategory(
    roleManagerConfig.getAttribute( "logger", "system.roles" ) );
  // Setup the RoleManager
  DefaultRoleManager roleManager = new DefaultRoleManager();
  roleManager.enableLogging( rmLogger );
  roleManager.configure( roleManagerConfig );
  m_roleManager = roleManager;
}

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

private void initializeInstrumentManager( Configuration instrumentManagerConfig )
  throws Exception
{
  if( instrumentManagerConfig != null )
  {
    // Get the logger for the instrument manager
    Logger imLogger = m_loggerManager.getLoggerForCategory(
      instrumentManagerConfig.getAttribute( "logger", "system.instrument" ) );
    // Set up the Instrument Manager
    DefaultInstrumentManagerImpl instrumentManager = new DefaultInstrumentManagerImpl();
    instrumentManager.enableLogging( imLogger );
    instrumentManager.configure( instrumentManagerConfig );
    instrumentManager.initialize();
    m_instrumentManager = instrumentManager;
  }
}

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

public ProcessingNode buildNode(Configuration config) throws Exception {

    HandleErrorsNode node = new HandleErrorsNode(config.getAttribute("when", "external"));
    this.treeBuilder.setupNode(node, config);

    // Set a flag that will prevent redirects
    ((SitemapLanguage) this.treeBuilder).setBuildingErrorHandler(true);
    try {
      // Get all children
      node.setChildren(buildChildNodes(config));
    } finally {
      // And clear the flag
      ((SitemapLanguage) this.treeBuilder).setBuildingErrorHandler(false);
    }

    return node;
  }
}

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

public ProcessingNode buildNode(Configuration config) throws Exception {
  String type = this.treeBuilder.getTypeForStatement(config, Generator.ROLE);
  this.views = ((SitemapLanguage)this.treeBuilder).getViewsForStatement(Generator.ROLE, type, config);
  this.pipelineHints = ((SitemapLanguage)this.treeBuilder).getHintsForStatement(Generator.ROLE, type, config);
  this.node = new GenerateNode(
    type,
    VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager)
  );
  this.node.setPipelineHints(this.pipelineHints);
  return this.treeBuilder.setupNode(this.node, config);
}

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

/**
 * @see org.apache.cocoon.components.treeprocessor.ProcessingNodeBuilder#buildNode(org.apache.avalon.framework.configuration.Configuration)
 */
public ProcessingNode buildNode(Configuration config) throws Exception {
  String type = this.treeBuilder.getTypeForStatement(config, Transformer.ROLE);
  this.views = ((SitemapLanguage)this.treeBuilder).getViewsForStatement(Transformer.ROLE, type, config);
  this.pipelineHints = ((SitemapLanguage)this.treeBuilder).getHintsForStatement(Transformer.ROLE, type, config);
  this.node = new TransformNode(
    type,
    VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager)
  );
  this.node.setPipelineHints(this.pipelineHints);
  return this.treeBuilder.setupNode(node, config);
}

相关文章