Package org.apache.avalon.framework.configuration

Examples of org.apache.avalon.framework.configuration.Configuration


        try {
            // Build a namespace-aware configuration object
            NamespacedSAXConfigurationHandler handler = new NamespacedSAXConfigurationHandler();
            SourceUtil.toSAX( source, handler );
            Configuration treeConfig = handler.getConfiguration();

            return build(treeConfig);
        } catch (ProcessingException e) {
            throw e;
        } catch(Exception e) {
View Full Code Here


            return null;
        }

        Map params = new HashMap();
        for (int i = 0; i < children.length; i++) {
            Configuration child = children[i];
            if (true) { // FIXME : check namespace
                String name = child.getAttribute("name");
                String value = child.getAttribute("value");
                try {
                    params.put(
                        VariableResolverFactory.getResolver(name, this.manager),
                        VariableResolverFactory.getResolver(value, this.manager));
                } catch(PatternException pe) {
                    String msg = "Invalid pattern '" + value + "' at " + child.getLocation();
                    throw new ConfigurationException(msg, pe);
                }
            }
        }
View Full Code Here

        ComponentSelector cs = this.inputSelector;
        Object value = null;
        String name = null;
        InputModule input = null;
        Configuration conf = null;
        boolean release = false;

        try {

            if (cs == null)
View Full Code Here

public class PipelinesNodeBuilder extends ContainerNodeBuilder implements ThreadSafe {

    public ProcessingNode buildNode(Configuration config)
    throws Exception {
        // check for component configurations
        Configuration child = config.getChild("component-configurations", false);
        if (child != null) {
            this.checkNamespace(child);
            this.treeBuilder.getProcessor().setComponentConfigurations(child);
        }
        PipelinesNode node = new PipelinesNode(this.treeBuilder.getProcessor());
        this.treeBuilder.setupNode(node, config);

    Configuration[] childConfigs = config.getChildren();
    List children = new ArrayList();
    HandleErrorsNode handler = null;
   
    for (int i = 0; i < childConfigs.length; i++) {

      Configuration childConfig = childConfigs[i];
      if (isChild(childConfig)) {

        ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
        if (builder instanceof HandleErrorsNodeBuilder) {
          handler = (HandleErrorsNode)builder.buildNode(childConfig);
View Full Code Here

    /** Configure backend component */
    public void configure(final Configuration configuration)
        throws ConfigurationException {
        if (null != configuration) {
            this.properties     = new Web3Properties ();
            Configuration child = configuration.getChild("pool");
            this.trace          = child.getAttributeAsBoolean("trace", false);
            this.level          = child.getAttributeAsInteger("level", 0);
            this.mySID          = configuration.getAttribute("name");
            this.poolsize       = child.getAttributeAsInteger("size");

            this.properties.put("jco.client.client",
                child.getChild("client").getValue());
            this.properties.put("jco.client.user",
                child.getChild("user").getValue());
            this.properties.put("jco.client.passwd",
                child.getChild("password").getValue());
            this.properties.put("jco.client.ashost",
                child.getChild("route").getValue());
            this.properties.put("jco.client.sysnr",
                child.getChild("system").getValue());
            this.properties.put("sap.gateway",
                child.getChild("gateway").getValue(""));
            this.properties.put("sap.programid",
                child.getChild("program-id").getValue(""));

            if ( getLogger().isDebugEnabled() ) {
                getLogger ().debug ("Configure R3DataSource [mySID="
                    + this.mySID );
            }
View Full Code Here

        String valsetstr = (String) this.settings.get("validate-set");
        String valstr = (String) this.settings.get("validate");

        try {
            Configuration conf = this.getConfiguration(
                    parameters.getParameter("descriptor", (String) this.settings.get("descriptor")),
                    resolver,
                    parameters.getParameterAsBoolean("reloadable", reloadable)
                    );
            valstr = parameters.getParameter("validate", valstr);
            valsetstr = parameters.getParameter("validate-set", valsetstr);
            Configuration[] desc = conf.getChildren("parameter");
            Configuration[] csets = conf.getChildren("constraint-set");
            HashMap actionMap = new HashMap();

            /*
             *  old obsoleted method
             */
            if (!"".equals(valstr.trim())) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("COOKIEVALIDATOR: validating parameters "
                             + "as specified via 'validate' parameter");
                }
                /*
                 *  get list of params to be validated
                 */
                String[] rparams = Tokenizer.tokenize(valstr, ",", false);

                /*
                 *  perform actuall validation
                 */
                ValidatorActionHelper result = null;
                String name = null;
                HashMap params = new HashMap(rparams.length);
                /*
                 *  put required params into hash
                 */
                for (int i = 0; i < rparams.length; i++) {
                    name = rparams[i];
                    if (name == null || "".equals(name.trim())) {
                        if (getLogger().isDebugEnabled()) {
                            getLogger().debug("COOKIEVALIDATOR: "
                                     + "wrong syntax of the 'validate' parameter");
                        }
                        return null;
                    }
                    name = name.trim();

                    /*
                     *  String cookieValue = XSPCookieHelper.getValue(objectModel, name,-1) ;
                     *  getLogger().debug("COOKIE(" + name + ")=" + cookieValue + "(" +
                     *  XSPCookieHelper.getCookie (objectModel, name, -1).getValue()
                     *  +")");
                     */
                    params.put(name, XSPCookieHelper.getCookie(objectModel, name, -1).getValue());
                }
                for (int i = 0; i < rparams.length; i++) {
                    name = rparams[i].trim();
                    result = validateParameter(name, null, desc,
                            params, false);
                    if (!result.isOK()) {
                        if (getLogger().isDebugEnabled()) {
                            getLogger().debug("COOKIEVALIDATOR: "
                                     + "validation failed for parameter " + name);
                        }
                        return null;
                    }
                    actionMap.put(name, result.getObject());
                }
            }

            /*
             *  new set-based method
             */
            if (valsetstr != null && !"".equals(valsetstr.trim())) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("COOKIEVALIDATOR: validating parameters "
                             + "from given constraint-set " + valsetstr);
                }
                Configuration cset = null;
                String setname = null;
                int j = 0;
                boolean found = false;
                for (j = 0; j < csets.length; j++) {
                    setname = csets[j].getAttribute("name", "");
                    if (valsetstr.trim().equals(setname.trim())) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("COOKIEVALIDATOR: given set "
                                 + valsetstr
                                 + " does not exist in a description file");
                    }
                    return null;
                }
                cset = csets[j];
                /*
                 *  get the list of params to be validated
                 */
                Configuration[] set = cset.getChildren("validate");

                /*
                 *  perform actuall validation
                 */
                ValidatorActionHelper result = null;
View Full Code Here

                if (Web3DataSourceSelectorImpl.pools.containsKey(obj)) {
                    pool =
                        (Web3DataSource) Web3DataSourceSelectorImpl.pools.get(
                            obj);
                } else {
                    Configuration a[] =
                        this.configuration.getChildren("backend"),
                        c = null;

                    if (null != a)
                        for (int i = 0; i < a.length; i++) {
View Full Code Here

                                           triple[j].getAttribute("style"),
                                           weight));
        }

        //build the fonts
        Configuration afpFontCfg = fontCfg.getChild("afp-font");
        if (afpFontCfg == null) {
            log.error("Mandatory font configuration element '<afp-font...' is missing");
            return null;
        }
        String path = afpFontCfg.getAttribute("path", fontPath);
        String type = afpFontCfg.getAttribute("type");
        if (type == null) {
            log.error("Mandatory afp-font configuration attribute 'type=' is missing");
            return null;
        }
        String codepage = afpFontCfg.getAttribute("codepage");
        if (codepage == null) {
            log.error("Mandatory afp-font configuration attribute 'code=' is missing");
            return null;
        }
        String encoding = afpFontCfg.getAttribute("encoding");
        if (encoding == null) {
            log.error("Mandatory afp-font configuration attribute 'encoding=' is missing");
            return null;
        }

        if ("raster".equalsIgnoreCase(type)) {

            String name = afpFontCfg.getAttribute("name", "Unknown");

            // Create a new font object
            RasterFont font = new RasterFont(name);

            Configuration[] rasters = afpFontCfg.getChildren("afp-raster-font");
            if (rasters.length == 0) {
                log.error(
                        "Mandatory font configuration elements '<afp-raster-font...' are missing");
                return null;
            }
            for (int j = 0; j < rasters.length; j++) {
                Configuration rasterCfg = rasters[j];

                String characterset = rasterCfg.getAttribute("characterset");
                if (characterset == null) {
                    log.error(
                    "Mandatory afp-raster-font configuration attribute 'characterset=' is missing");
                    return null;
                }
                int size = rasterCfg.getAttributeAsInteger("size");
                String base14 = rasterCfg.getAttribute("base14-font", null);

                if (base14 != null) {
                    try {
                        Class clazz = Class.forName("org.apache.fop.fonts.base14."
                            + base14);
View Full Code Here

     * @param renderer AFP renderer
     * @throws FOPException fop exception
     * @see org.apache.fop.render.PrintRendererConfigurator#configure(Renderer)
     */
    public void configure(Renderer renderer) throws FOPException {
        Configuration cfg = super.getRendererConfig(renderer);
        if (cfg != null) {
            AFPRenderer afpRenderer = (AFPRenderer)renderer;
            try {
                List fontList = buildFontListFromConfiguration(cfg);
                afpRenderer.setFontList(fontList);
            } catch (ConfigurationException e) {
                LogUtil.handleException(log, e,
                        userAgent.getFactory().validateUserConfigStrictly());
            }
           
            Configuration images = cfg.getChild("images");
            if (!"color".equalsIgnoreCase(images.getAttribute("mode", "b+w"))) {
                afpRenderer.setBitsPerPixel(images.getAttributeAsInteger("bits-per-pixel", 8));
            } else {
                afpRenderer.setColorImages(true);
            }
        }
    }
View Full Code Here

     * fonts etc.
     * @param renderer pdf renderer
     * @throws FOPException fop exception
     */
    public void configure(Renderer renderer) throws FOPException {
        Configuration cfg = super.getRendererConfig(renderer);
        if (cfg != null) {
            PDFRenderer pdfRenderer = (PDFRenderer)renderer;
            //PDF filters
            try {
                Map filterMap = buildFilterMapFromConfiguration(cfg);
                if (filterMap != null) {
                    pdfRenderer.setFilterMap(filterMap);
                }
            } catch (ConfigurationException e) {
                LogUtil.handleException(log, e, false);
            }
   
            super.configure(renderer);
   
            String s = cfg.getChild(PDFRenderer.PDF_A_MODE, true).getValue(null);
            if (s != null) {
                pdfRenderer.setAMode(PDFAMode.valueOf(s));
            }
            s = cfg.getChild(PDFRenderer.PDF_X_MODE, true).getValue(null);
            if (s != null) {
                pdfRenderer.setXMode(PDFXMode.valueOf(s));
            }
            s = cfg.getChild(PDFRenderer.KEY_OUTPUT_PROFILE, true).getValue(null);
            if (s != null) {
                pdfRenderer.setOutputProfileURI(s);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.configuration.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.