View Javadoc

1   /**
2    * Copyright 2005-2006 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.core;
16  
17  import java.util.List;
18  import java.util.Properties;
19  /**
20   * This is an interface allowing objects and services to self-describe some
21   * of them parameters. This is useful when service implementations are configured
22   * using an interactive processus (such as a web wizard form ;-))
23   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
24   * @version $Revision: 1.2 $
25   */
26  public interface Configurable{
27  
28     // Public -------------------------------------------------------------------
29  
30     /**
31      * Get this object parameters definitions as a list
32      * @return A list of {@code ParameterDefinition} objects
33      */
34     public abstract List getParameterDefinitionsAsList();
35  
36     /**
37      * Get this object parameters definitions as an array
38      * @return An array of {@code ParameterDefinition} objects
39      */
40     public abstract ParameterDefinition[] getParameterDefinitions();
41  
42     /**
43      * Set the value of a parameter using its nama
44      * @param parameterName The name of parameter so set value for
45      * @param parameterValue The value of the paramater
46      * @throws InvalidParameterException if this parameter is not supported by this object
47      */
48     public abstract void setParameter(String parameterName, String parameterValue) throws InvalidParameterException;
49  
50     /**
51      * Set the value of a parameter using its definitions
52      * @param parameter The definition of the paramater to set
53      * @param parameterValue The value of the parameter
54      * @throws InvalidParameterException if this parameter is not supported by this object
55      */
56     public abstract void setParameter(ParameterDefinition parameter, String parameterValue) throws InvalidParameterException;
57  
58     /**
59      * Convenient methods for setting all attributes values using a single method.
60      * @param parameters Properties where keys are parameter names
61      * @throws InvalidParameterException if one of these parameters is not supported by this object
62      */
63     public abstract void setParameters(Properties parameters) throws InvalidParameterException;
64  }