Package org.apache.avalon.framework.parameters

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


            manager = new TaskManager(publication.getDirectory().getAbsolutePath(), this.manager);
            task = manager.getTask(taskId);

            Properties properties = new Properties();
            properties.putAll(getTaskParameters().getMap());
            Parameters _parameters = Parameters.fromProperties(properties);

            task.parameterize(_parameters);
        } catch (final ConfigurationException e) {
            throw new ExecutionException(e);
        } catch (final ParameterException e) {
View Full Code Here


    /**
     * Get parameters of the task
     * @return The parameters
     */
    public Parameters getParameters() {
        Parameters params = new Parameters();
        params = params.merge(this.parameters);

        return params;
    }
View Full Code Here

     */
    protected void initialize(Parameters parameters, Publication publication, Request request)
            throws ExecutionException {
        setNotifying(request);

        Parameters taskParameters = extractTaskParameters(parameters, publication, request);
        getTaskParameters().parameterize(taskParameters);

        String taskId = request.getParameter(TaskWrapperParameters.TASK_ID);
        taskId = parameters.getParameter(TaskWrapperParameters.TASK_ID, taskId);

View Full Code Here

        super( name );
    }

    public void testRemoveParameter()
    {
        final Parameters parameters = new Parameters();
        parameters.setParameter( "key1", "value1" );
        assertEquals("Should only have one parameter", 1, parameters.getNames().length );
        parameters.setParameter( "key1", null );
        assertTrue( "key1 should no longer be a parameter", ! parameters.isParameter( "key1" ) );
        assertEquals( 0, parameters.getNames().length );
    }
View Full Code Here

        assertEquals( 0, parameters.getNames().length );
    }

    public void testIsParameter()
    {
        final Parameters parameters = new Parameters();
        parameters.setParameter( "key1", "value1" );
        assertTrue( "key1 should be a parameter", parameters.isParameter( "key1" ) );
        assertTrue( "key2 should not be a parameter", ! parameters.isParameter( "key2" ) );
    }
View Full Code Here

        assertTrue( "key2 should not be a parameter", ! parameters.isParameter( "key2" ) );
    }

    public void testGetParameter()
    {
        final Parameters parameters = new Parameters();
        parameters.setParameter( "key1", "value1" );

        try
        {
            assertEquals( "key1 should equal value1", "value1", parameters.getParameter( "key1" ) );
        }
        catch ( final ParameterException pe )
        {
            fail( pe.getMessage() );
        }

        try
        {
            parameters.getParameter( "key2" );
            fail( "Not inserted parameter 'key2' exists" );
        }
        catch( final ParameterException pe )
        {
            //OK
        }

        assertEquals( "key1 should use correct value1", "value1", parameters.getParameter( "key1", "value1-1" ) );

        assertEquals( "key2 should use default value2", "value2", parameters.getParameter( "key2", "value2" ) );
    }
View Full Code Here

        {
            final DefaultConfigurationBuilder builder =
                new DefaultConfigurationBuilder();
            final Configuration configuration = builder.build( confInput );

            final Parameters parameters =
                Parameters.fromConfiguration( configuration );

            assertEquals( "key1 should be value1", "value1", parameters.getParameter( "key1" ) );
            assertEquals( "key2 should be value2", "value2", parameters.getParameter( "key2" ) );
            assertEquals( "key3 should be value3", "value3", parameters.getParameter( "key3" ) );
        }
        catch ( final ConfigurationException ce )
        {
            fail( "Converting failed: " + ce.getMessage() );
        }
View Full Code Here

        final Properties properties = new Properties();
        properties.put( "key1", "value1" );
        properties.put( "key2", "value2" );
        properties.put( "key3", "value3" );

        final Parameters parameters = Parameters.fromProperties( properties );

        try
        {
            assertEquals( "key1 should be value1", "value1", parameters.getParameter( "key1" ) );
            assertEquals( "key2 should be value2", "value2", parameters.getParameter( "key2" ) );
            assertEquals( "key3 should be value3", "value3", parameters.getParameter( "key3" ) );
        }
        catch ( final ParameterException pe )
        {
            fail( pe.getMessage() );
        }
View Full Code Here

     * Abstract out the Logicsheet creation.  Handles both Named and regular logicsheets.
     */
    private Logicsheet createLogicsheet(Configuration configuration, boolean named)
            throws Exception
    {
        Parameters params = Parameters.fromConfiguration(configuration);

        Logicsheet logicsheet;
        if (named) {
            String location = params.getParameter("href", null);
            String uri = params.getParameter("uri", null);
            String prefix = params.getParameter("prefix", null);

            NamedLogicsheet namedLogicsheet =
                new NamedLogicsheet(location, manager, resolver);
            namedLogicsheet.enableLogging(getLogger());
            namedLogicsheet.setURI(uri);
            namedLogicsheet.setPrefix(prefix);
            logicsheet = namedLogicsheet;
        } else {
            String location = params.getParameter("core-logicsheet", null);
            logicsheet = new Logicsheet(location, manager, resolver);
            logicsheet.enableLogging(getLogger());
        }

        String logicsheetName = logicsheet.getSystemId();
View Full Code Here

        protected String columnCase;

        protected Query( SQLTransformer transformer, int query_index ) {
            this.transformer = transformer;
            this.query_index = query_index;
            this.properties = new Parameters();
            this.properties.merge( transformer.parameters );
        }
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.