当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.getChildren方法代码示例

本文整理汇总了Java中org.apache.avalon.framework.configuration.Configuration.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getChildren方法的具体用法?Java Configuration.getChildren怎么用?Java Configuration.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.avalon.framework.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getChildren方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFontsMatcher

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Creates a font triplet matcher from a configuration object.
 * @param cfg the configuration object
 * @param strict true for strict configuraton error handling
 * @return the font matcher
 * @throws FOPException if an error occurs while building the matcher
 */
public static FontTriplet.Matcher createFontsMatcher(
        Configuration cfg, boolean strict) throws FOPException {
    List<FontTriplet.Matcher> matcherList = new java.util.ArrayList<FontTriplet.Matcher>();
    Configuration[] matches = cfg.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(
            matcherList.toArray(new FontTriplet.Matcher[matcherList.size()]));
    return orMatcher;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:25,代码来源:FontManagerConfigurator.java

示例2: getHandlerConfig

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Returns the configuration subtree for a specific renderer.
 * @param cfg the renderer configuration
 * @param namespace the namespace (i.e. the XMLHandler) for which the configuration should
 *                  be returned
 * @return the requested configuration subtree, null if there's no configuration
 */
private Configuration getHandlerConfig(Configuration cfg, String namespace) {
    if (cfg == null || namespace == null) {
        return null;
    }
    Configuration handlerConfig = null;

    Configuration[] children = cfg.getChildren("xml-handler");
    for (int i = 0; i < children.length; ++i) {
        try {
            if (children[i].getAttribute("namespace").equals(namespace)) {
                handlerConfig = children[i];
                break;
            }
        } catch (ConfigurationException e) {
            // silently pass over configurations without namespace
        }
    }
    if (log.isDebugEnabled()) {
        log.debug((handlerConfig == null ? "No" : "")
                + "XML handler configuration found for namespace " + namespace);
    }
    return handlerConfig;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:31,代码来源:XMLHandlerConfigurator.java

示例3: generateNode

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private static HashTree generateNode(Configuration config) {
    TestElement element = null;

    try {
        element = createTestElement(config.getChild("testelement")); // $NON-NLS-1$
    } catch (Exception e) {
        log.error("Problem loading part of file", e);
        return null;
    }
    HashTree subTree = new ListedHashTree(element);
    Configuration[] subNodes = config.getChildren("node"); // $NON-NLS-1$

    for (int i = 0; i < subNodes.length; i++) {
        HashTree t = generateNode(subNodes[i]);

        if (t != null) {
            subTree.add(element, t);
        }
    }
    return subTree;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:22,代码来源:OldSaveService.java

示例4: addFonts

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Populates the font info list from the fonts configuration
 * 
 * @param fontsCfg a fonts configuration
 * @param fontCache a font cache
 * @param fontInfoList a font info list
 * @throws FOPException if an exception occurs while processing the configuration
 */
protected void addFonts(Configuration fontsCfg, FontCache fontCache, List<EmbedFontInfo> fontInfoList)
		throws FOPException {
	// font file (singular) configuration
	Configuration[] font = fontsCfg.getChildren("font");
	for (int i = 0; i < font.length; i++) {
		EmbedFontInfo embedFontInfo = getFontInfo(font[i], fontCache);
		if (embedFontInfo != null) {
			fontInfoList.add(embedFontInfo);
		}
	}
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:20,代码来源:FontInfoConfigurator.java

示例5: addFonts

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Populates the font info list from the fonts configuration
 * @param fontsCfg a fonts configuration
 * @param fontCache a font cache
 * @param fontInfoList a font info list
 * @throws FOPException if an exception occurs while processing the configuration
 */
protected void addFonts(Configuration fontsCfg, FontCache fontCache,
        List<EmbedFontInfo> fontInfoList) throws FOPException {
    // font file (singular) configuration
    Configuration[] font = fontsCfg.getChildren("font");
    for (int i = 0; i < font.length; i++) {
        EmbedFontInfo embedFontInfo = getFontInfo(
                font[i], fontCache);
        if (embedFontInfo != null) {
            fontInfoList.add(embedFontInfo);
        }
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:20,代码来源:FontInfoConfigurator.java

示例6: configureImageLoading

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private void configureImageLoading(Configuration parent, boolean strict) throws FOPException {
    if (parent == null) {
        return;
    }
    ImageImplRegistry registry = factory.getImageManager().getRegistry();
    Configuration[] penalties = parent.getChildren("penalty");
    try {
        for (int i = 0, c = penalties.length; i < c; i++) {
            Configuration penaltyCfg = penalties[i];
            String className = penaltyCfg.getAttribute("class");
            String value = penaltyCfg.getAttribute("value");
            Penalty p = null;
            if (value.toUpperCase().startsWith("INF")) {
                p = Penalty.INFINITE_PENALTY;
            } else {
                try {
                    p = Penalty.toPenalty(Integer.parseInt(value));
                } catch (NumberFormatException nfe) {
                    LogUtil.handleException(log, nfe, strict);
                }
            }
            if (p != null) {
                registry.setAdditionalPenalty(className, p);
            }
        }
    } catch (ConfigurationException e) {
        LogUtil.handleException(log, e, strict);
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:30,代码来源:FopFactoryConfigurator.java

示例7: getProducers

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private BitmapProducer[] getProducers(Configuration cfg) {
    Configuration[] children = cfg.getChildren("producer");
    BitmapProducer[] producers = new BitmapProducer[children.length];
    for (int i = 0; i < children.length; i++) {
        try {
            Class<?> clazz = Class.forName(children[i].getAttribute("classname"));
            producers[i] = (BitmapProducer)clazz.newInstance();
            ContainerUtil.configure(producers[i], children[i]);
        } catch (Exception e) {
            log.error("Error setting up producers", e);
            throw new RuntimeException("Error while setting up producers");
        }
    }
    return producers;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:16,代码来源:BatchDiffer.java

示例8: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration configuration) throws ConfigurationException {
    this.threads = configuration.getChild("threads").getValueAsInteger(10);
    this.outputDir = new File(configuration.getChild("output-dir").getValue());
    this.writeToDevNull = configuration.getChild("devnull").getValueAsBoolean(false);
    Configuration tasks = configuration.getChild("tasks");
    this.repeat = tasks.getAttributeAsInteger("repeat", 1);
    Configuration[] entries = tasks.getChildren("task");
    for (int i = 0; i < entries.length; i++) {
        this.taskList.add(new TaskDef(entries[i]));
    }
    this.fopCfg = configuration.getChild("processor");
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:14,代码来源:FOPTestbed.java

示例9: getSampleResult

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Read sampleResult from Avalon XML file.
 *
 * @param config Avalon configuration
 * @return sample result
 */
// Probably no point in converting this to return a SampleEvent
private static SampleResult getSampleResult(Configuration config) {
    SampleResult result = new SampleResult(config.getAttributeAsLong(TIME_STAMP, 0L), config.getAttributeAsLong(
            TIME, 0L));

    result.setThreadName(config.getAttribute(THREAD_NAME, "")); // $NON-NLS-1$
    result.setDataType(config.getAttribute(DATA_TYPE, ""));
    result.setResponseCode(config.getAttribute(RESPONSE_CODE, "")); // $NON-NLS-1$
    result.setResponseMessage(config.getAttribute(RESPONSE_MESSAGE, "")); // $NON-NLS-1$
    result.setSuccessful(config.getAttributeAsBoolean(SUCCESSFUL, false));
    result.setSampleLabel(config.getAttribute(LABEL, "")); // $NON-NLS-1$
    result.setResponseData(getBinaryData(config.getChild(BINARY)));
    Configuration[] subResults = config.getChildren(SAMPLE_RESULT_TAG_NAME);

    for (int i = 0; i < subResults.length; i++) {
        result.storeSubResult(getSampleResult(subResults[i]));
    }
    Configuration[] assResults = config.getChildren(ASSERTION_RESULT_TAG_NAME);

    for (int i = 0; i < assResults.length; i++) {
        result.addAssertionResult(getAssertionResult(assResults[i]));
    }

    Configuration[] samplerData = config.getChildren("property"); // $NON-NLS-1$
    for (int i = 0; i < samplerData.length; i++) {
        result.setSamplerData(samplerData[i].getValue("")); // $NON-NLS-1$
    }
    return result;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:36,代码来源:OldSaveService.java

示例10: createMap

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private static Map<String, JMeterProperty> createMap(Configuration config, String testClass) throws ConfigurationException,
        ClassNotFoundException, IllegalAccessException, InstantiationException {
    @SuppressWarnings("unchecked") // OK
    Map<String, JMeterProperty> map = (Map<String, JMeterProperty>) Class.forName(config.getAttribute("class")).newInstance();
    Configuration[] items = config.getChildren();

    for (int i = 0; i < items.length; i++) {
        if (items[i].getName().equals("property")) { // $NON-NLS-1$
            JMeterProperty prop = createProperty(items[i], testClass);
            if (prop!=null) {
                map.put(prop.getName(), prop);
            }
        } else if (items[i].getName().equals("testelement")) { // $NON-NLS-1$
            map.put(items[i].getAttribute("name", ""), new TestElementProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
                    createTestElement(items[i])));
        } else if (items[i].getName().equals("collection")) { // $NON-NLS-1$
            map.put(items[i].getAttribute("name"),  // $NON-NLS-1$
                    new CollectionProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
                    createCollection(items[i], testClass)));
        } else if (items[i].getName().equals("map")) { // $NON-NLS-1$
            map.put(items[i].getAttribute("name", ""),  // $NON-NLS-1$ // $NON-NLS-2$
                    new MapProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
                    createMap(items[i], testClass)));
        }
    }
    return map;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:28,代码来源:OldSaveService.java

示例11: processSamples

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
public static void processSamples(String filename, Visualizer visualizer, ResultCollector rc)
throws SAXException, IOException, ConfigurationException
{
    DefaultConfigurationBuilder cfgbuilder = new DefaultConfigurationBuilder();
    Configuration savedSamples = cfgbuilder.buildFromFile(filename);
    Configuration[] samples = savedSamples.getChildren();
    final boolean errorsOnly = rc.isErrorLogging();
    final boolean successOnly = rc.isSuccessOnlyLogging();
    for (int i = 0; i < samples.length; i++) {
        SampleResult result = OldSaveService.getSampleResult(samples[i]);
        if (ResultCollector.isSampleWanted(result.isSuccessful(), errorsOnly, successOnly)) {
            visualizer.add(result);
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:16,代码来源:OldSaveService.java

示例12: buildFilterMapFromConfiguration

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Builds a filter map from an Avalon Configuration object.
 *
 * @param cfg the Configuration object
 * @return Map the newly built filter map
 * @throws ConfigurationException if a filter list is defined twice
 */
public static Map buildFilterMapFromConfiguration(Configuration cfg)
            throws ConfigurationException {
    Map filterMap = new java.util.HashMap();
    Configuration[] filterLists = cfg.getChildren("filterList");
    for (int i = 0; i < filterLists.length; i++) {
        Configuration filters = filterLists[i];
        String type = filters.getAttribute("type", null);
        Configuration[] filt = filters.getChildren("value");
        List filterList = new java.util.ArrayList();
        for (int j = 0; j < filt.length; j++) {
            String name = filt[j].getValue();
            filterList.add(name);
        }

        if (type == null) {
            type = PDFFilterList.DEFAULT_FILTER;
        }

        if (!filterList.isEmpty() && log.isDebugEnabled()) {
            StringBuffer debug = new StringBuffer("Adding PDF filter");
            if (filterList.size() != 1) {
                debug.append("s");
            }
            debug.append(" for type ").append(type).append(": ");
            for (int j = 0; j < filterList.size(); j++) {
                if (j != 0) {
                    debug.append(", ");
                }
                debug.append(filterList.get(j));
            }
            log.debug(debug.toString());
        }

        if (filterMap.get(type) != null) {
            throw new ConfigurationException("A filterList of type '"
                + type + "' has already been defined");
        }
        filterMap.put(type, filterList);
    }
    return filterMap;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:49,代码来源:PDFRendererConfigurator.java

示例13: buildFontListFromConfiguration

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Builds a list of AFPFontInfo objects for use with the setup() method.
 *
 * @param cfg Configuration object
 * @param eventProducer for AFP font related events
 * @return List the newly created list of fonts
 * @throws ConfigurationException if something's wrong with the config data
 */
private List<AFPFontInfo> buildFontListFromConfiguration(Configuration cfg,
        AFPEventProducer eventProducer) throws FOPException, ConfigurationException {

    Configuration fonts = cfg.getChild("fonts");
    FontManager fontManager = this.userAgent.getFactory().getFontManager();

    // General matcher
    FontTriplet.Matcher referencedFontsMatcher = fontManager.getReferencedFontsMatcher();
    // Renderer-specific matcher
    FontTriplet.Matcher localMatcher = null;

    // Renderer-specific referenced fonts
    Configuration referencedFontsCfg = fonts.getChild("referenced-fonts", false);
    if (referencedFontsCfg != null) {
        localMatcher = FontManagerConfigurator.createFontsMatcher(
                referencedFontsCfg, this.userAgent.getFactory().validateUserConfigStrictly());
    }

    List<AFPFontInfo> fontList = new java.util.ArrayList<AFPFontInfo>();
    Configuration[] font = fonts.getChildren("font");
    final String fontPath = null;
    for (int i = 0; i < font.length; i++) {
        AFPFontInfo afi = buildFont(font[i], fontPath);
        if (afi != null) {
            if (log.isDebugEnabled()) {
                log.debug("Adding font " + afi.getAFPFont().getFontName());
            }
            List<FontTriplet> fontTriplets = afi.getFontTriplets();
            for (int j = 0; j < fontTriplets.size(); ++j) {
                FontTriplet triplet = fontTriplets.get(j);
                if (log.isDebugEnabled()) {
                    log.debug("  Font triplet "
                            + triplet.getName() + ", "
                            + triplet.getStyle() + ", "
                            + triplet.getWeight());
                }

                if ((referencedFontsMatcher != null && referencedFontsMatcher.matches(triplet))
                        || (localMatcher != null && localMatcher.matches(triplet))) {
                    afi.getAFPFont().setEmbeddable(false);
                    break;
                }
            }

            fontList.add(afi);
        }
    }
    return fontList;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:58,代码来源:AFPRendererConfigurator.java

示例14: createTestElement

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private static TestElement createTestElement(Configuration config) throws ConfigurationException,
        ClassNotFoundException, IllegalAccessException, InstantiationException {
    TestElement element = null;

    String testClass = config.getAttribute("class"); // $NON-NLS-1$

    String gui_class=""; // $NON-NLS-1$
    Configuration[] children = config.getChildren();
    for (int i = 0; i < children.length; i++) {
        if (children[i].getName().equals("property")) { // $NON-NLS-1$
            if (children[i].getAttribute("name").equals(TestElement.GUI_CLASS)){ // $NON-NLS-1$
                gui_class=children[i].getValue();
            }
        }
    }

    String newClass = NameUpdater.getCurrentTestName(testClass,gui_class);

    element = (TestElement) Class.forName(newClass).newInstance();

    for (int i = 0; i < children.length; i++) {
        if (children[i].getName().equals("property")) { // $NON-NLS-1$
            try {
                JMeterProperty prop = createProperty(children[i], newClass);
                if (prop!=null) {
                    element.setProperty(prop);
                }
            } catch (Exception ex) {
                log.error("Problem loading property", ex);
                element.setProperty(children[i].getAttribute("name"), ""); // $NON-NLS-1$ // $NON-NLS-2$
            }
        } else if (children[i].getName().equals("testelement")) { // $NON-NLS-1$
            element.setProperty(new TestElementProperty(children[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
                    createTestElement(children[i])));
        } else if (children[i].getName().equals("collection")) { // $NON-NLS-1$
            element.setProperty(new CollectionProperty(children[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
                    createCollection(children[i], newClass)));
        } else if (children[i].getName().equals("map")) { // $NON-NLS-1$
            element.setProperty(new MapProperty(children[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
                    createMap(children[i],newClass)));
        }
    }
    return element;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:45,代码来源:OldSaveService.java


注:本文中的org.apache.avalon.framework.configuration.Configuration.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。