Package org.apache.avalon.framework.parameters

Examples of org.apache.avalon.framework.parameters.Parameters


    public final boolean invoke(Environment env, InvokeContext context)
      throws Exception {

        List       mapStack = context.getMapStack();
        Parameters resolvedParams = MapStackResolver.buildParameters(this.parameters, mapStack);

        Map result = this.actionSet.call(env, context, resolvedParams);

        if (PipelinesNode.getRedirector(env).hasRedirected()) {
            return true;
View Full Code Here


        if (this.getLogger().isDebugEnabled()) {
            this.getLogger().debug("Configure StoreJanitorImpl");
        }
        this.setJVM(Runtime.getRuntime());

        Parameters params = Parameters.fromConfiguration(conf);
        this.setFreememory(params.getParameterAsInteger("freememory",1000000));
        this.setHeapsize(params.getParameterAsInteger("heapsize",60000000));
        this.setCleanupthreadinterval(params.getParameterAsInteger("cleanupthreadinterval",10));
        this.setPriority(params.getParameterAsInteger( "threadpriority",
                                        Thread.currentThread().getPriority()));
        int percent = params.getParameterAsInteger("percent_to_free", 10);

        if ((this.getFreememory() < 1)) {
            throw new ConfigurationException("StoreJanitorImpl freememory parameter has to be greater then 1");
        }
        if ((this.getHeapsize() < 1)) {
View Full Code Here

                   break;
                } else if ("image-mime-type".equals(typeName)) {
                    String imageAttr = param.substring(0, (param.length() - "-mime-type".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
                        String imageMimeType = parameters.getParameter("image-mime-type",
                                                                       (String) settings.get("image-mime-type",""));
                        statement.setString(position, imageMimeType);
                        /** Store the image mime type in the request attributes.
                            Why do we do this? **/
                        setRequestAttribute(request, param, imageMimeType);
                    }
                    break;
                }
            case Types.BLOB:
                if (value instanceof File) {
                    file = (File)value;
                } else if (value instanceof String) {
                    file = new File((String)value);
                } else {
                    throw new SQLException("Invalid type for blob: "+value.getClass().getName());
                }
                //InputStream input = new BufferedInputStream(new FileInputStream(file));
                FileInputStream input = new FileInputStream(file);
                statement.setBinaryStream(position, input, (int)file.length());
                if ("image".equals(typeName)) {
                    /** If this column type is an image, store the
                        size, width, and height in a static table **/
                    Parameters parameters = new Parameters();
                    parameters.setParameter("image-size", Long.toString(file.length()));
                    int [] dimensions = ImageDirectoryGenerator.getSize(file);
                    String type = ImageDirectoryGenerator.getFileType(file);
                    parameters.setParameter("image-width", Integer.toString(dimensions[0]));
                    parameters.setParameter("image-height", Integer.toString(dimensions[1]));
                    parameters.setParameter("image-mime-type",type);
                    synchronized (this.files) {
                        this.files.put(file, parameters);
                    }
                }
                break;
            case Types.INTEGER:
                if ("int".equals(typeName)) {
                    Integer i = null;
                    if (value instanceof Integer) {
                        i = (Integer) value;
                    } else {
                        i = new Integer((String) value);
                    }
                    statement.setInt(position, i.intValue());
                    break;
                } else if ("image-width".equals(typeName)) {
                    /** Get the image width from the cached image data **/
                    /** Is this why we store the values in the request
                        attributes? **/
                    String imageAttr = param.substring(0, (param.length() - "-width".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
                        statement.setInt(position, parameters.getParameterAsInteger("image-width",
                         Integer.parseInt((String)settings.get("image-width","-1"))));
                        /** Store the image width in the request attributes.
                            Why do we do this? **/
                        setRequestAttribute(request,
                        param,
                        parameters.getParameter("image-width",
                                    (String) settings.get("image-width","")));
                    }
                    break;
                } else if ("image-height".equals(typeName)) {
                    /** Get the image height from the cached image data **/
                    String imageAttr = param.substring(0, (param.length() - "-height".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
                        statement.setInt(position, parameters.getParameterAsInteger("image-height",
                         Integer.parseInt((String)settings.get("image-height","-1"))));
                        setRequestAttribute(request,
                        param,
                        parameters.getParameter("image-height",
                                    (String) settings.get("image-height","")));
                    }
                    break;
                } else if ("image-size".equals(typeName)) {
                    /** Get the image file size from the cached image data **/
                    String imageAttr = param.substring(0, (param.length() - "-size".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
                        statement.setInt(position, parameters.getParameterAsInteger("image-size",
                         Integer.parseInt((String)settings.get("image-height","-1"))));
                        setRequestAttribute(request,
                        param,
                        parameters.getParameter("image-size",
                                    (String) settings.get("image-size","")));
                    }
                    break;
                } else if ("row-index".equals(typeName)) {
                    statement.setInt(position,rowIndex);
View Full Code Here

    public static Parameters buildParameters(Map expressions, List mapStack) throws PatternException {
        if (expressions == null || expressions.size() == 0) {
            return Parameters.EMPTY_PARAMETERS;
        }

        Parameters result = new Parameters();

        Iterator iter = expressions.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry)iter.next();
            String value = ((MapStackResolver)entry.getValue()).resolve(mapStack);
            result.setParameter((String)entry.getKey(), value);
        }

        return result;
    }
View Full Code Here

                            xslT = (Transformer)selector.select("xslt");
                            transformers.add(xslT);
                            xslT.setup(resolver,
                                       objectModel,
                                       XMLUtil.getValueOfNode(transformations.item(k)),
                                       new Parameters());
                            xslT.setConsumer(nextConsumer);
                            nextConsumer = xslT;
                        }
                        nextConsumer.startDocument();
                    }
View Full Code Here

    {
        if ( m_embeddor != null ) {
           throw new BuildException( "Already started" );
        }

        m_parameters = new Parameters();
//        m_parameters.setParameter( "log-destination", "." );
//        m_parameters.setParameter( "log-priority", "DEBUG" );
//        m_parameters.setParameter( "application-name", "james" );
        m_parameters.setParameter( "application-location", "dist/apps/james.sar");
View Full Code Here

                String type = values[i].getAttribute("type");
                String parameter = values[i].getAttribute("param");

                if (type.equals("image")) {
                    File binaryFile = (File) request.get(parameter);
                    Parameters iparam = new Parameters();

                    iparam.setParameter("image-size", String.valueOf(binaryFile.length()));

                    int [] dimensions = ImageDirectoryGenerator.getSize(binaryFile);
                    iparam.setParameter("image-width", String.valueOf(dimensions[0]));
                    iparam.setParameter("image-height", String.valueOf(dimensions[1]));

                    synchronized (this.files) {
                        this.files.put(binaryFile, param);
                    }
                }
View Full Code Here

     * Set the sitemap-provided configuration.
     * @param conf The configuration information
     * @exception ConfigurationException
     */
    public void configure(Configuration conf) throws ConfigurationException {
        Parameters params = Parameters.fromConfiguration(conf);
        this.servletName = params.getParameter(CONFIG_SERVLET_NAME, DEFAULT_SERVLET_NAME);
    }
View Full Code Here

     * Set the sitemap-provided configuration.
     * @param conf The configuration information
     * @exception ConfigurationException
     */
    public void configure(Configuration conf) throws ConfigurationException {
        Parameters params = Parameters.fromConfiguration(conf);
        this.jspServletClass = params.getParameter("servlet-class", DEFAULT_SERVLET_CLASS);
    }
View Full Code Here

                    break;
                } else if ("image-mime-type".equals(typeName)) {
                    String imageAttr = param.substring(0, (param.length() - "-mime-type".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
            String imageMimeType = parameters.getParameter("image-mime-type",
                                       (String) settings.get("image-mime-type",""));
                        statement.setString(position, imageMimeType);
                        /** Store the image mime type in the request attributes.
                            Why do we do this? **/
                        setRequestAttribute(request, param, imageMimeType);
                    }
                    break;
                }
            case Types.BLOB:
                if (value instanceof File) {
                  file = (File)value;
                } else if (value instanceof String) {
                  file = new File((String)value);
                } else {
                  throw new SQLException("Invalid type for blob: "+value.getClass().getName());
                }
                //InputStream input = new BufferedInputStream(new FileInputStream(file));
                FileInputStream input = new FileInputStream(file);
                statement.setBinaryStream(position, input, (int)file.length());
                if ("image".equals(typeName)) {
                    /** If this column type is an image, store the
                        size, width, and height in a static table **/
                    Parameters parameters = new Parameters();
                    parameters.setParameter("image-size", Long.toString(file.length()));
                    int [] dimensions = ImageDirectoryGenerator.getSize(file);
                    String type = ImageDirectoryGenerator.getFileType(file);
                    parameters.setParameter("image-width", Integer.toString(dimensions[0]));
                    parameters.setParameter("image-height", Integer.toString(dimensions[1]));
                    parameters.setParameter("image-mime-type",type);
                    synchronized (this.files) {
                        this.files.put(file, parameters);
                    }
                }
                break;
            case Types.INTEGER:
                if ("int".equals(typeName)) {
                    Integer i = null;
                    if (value instanceof Integer) {
                        i = (Integer) value;
                    } else {
                        i = new Integer((String) value);
                    }
                    statement.setInt(position, i.intValue());
                    break;
                } else if ("image-width".equals(typeName)) {
                    /** Get the image width from the cached image data **/
                    /** Is this why we store the values in the request
                        attributes? **/
                    String imageAttr = param.substring(0, (param.length() - "-width".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
            statement.setInt(position, parameters.getParameterAsInteger("image-width",
                         Integer.parseInt((String)settings.get("image-width","-1"))));
                        /** Store the image width in the request attributes.
                            Why do we do this? **/
                        setRequestAttribute(request,
                        param,
                        parameters.getParameter("image-width",
                                    (String) settings.get("image-width","")));
                    }
                    break;
                } else if ("image-height".equals(typeName)) {
                    /** Get the image height from the cached image data **/
                    String imageAttr = param.substring(0, (param.length() - "-height".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
                        statement.setInt(position, parameters.getParameterAsInteger("image-height",
                         Integer.parseInt((String)settings.get("image-height","-1"))));
                        setRequestAttribute(request,
                        param,
                        parameters.getParameter("image-height",
                                    (String) settings.get("image-height","")));
                    }
                    break;
                } else if ("image-size".equals(typeName)) {
                    /** Get the image file size from the cached image data **/
                    String imageAttr = param.substring(0, (param.length() - "-size".length()));
                    file = (File) request.get(imageAttr);
                    synchronized (this.files) {
                        Parameters parameters = (Parameters) this.files.get(file);
                        statement.setInt(position, parameters.getParameterAsInteger("image-size",
                         Integer.parseInt((String)settings.get("image-height","-1"))));
                        setRequestAttribute(request,
                        param,
                        parameters.getParameter("image-size",
                                    (String) settings.get("image-size","")));
                    }
                    break;
                } else if ("row-index".equals(typeName)) {
                    statement.setInt(position,rowIndex);
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.parameters.Parameters

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.