View Javadoc

1   /* ===================================================================
2    * Copyright 2002-04 SRI International.
3    * Released under the MOZILLA PUBLIC LICENSE Version 1.1
4    * which can be obtained at http://www.mozilla.org/MPL/MPL-1.1.html
5    * This software is distributed on an "AS IS"
6    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
7    * See the License for the specific language governing rights and
8    * limitations under the License.
9    * =================================================================== */
10  package com.sri.emo.wizard;
11  
12  import java.io.Serializable;
13  import java.util.List;
14  
15  /***
16   * Location where all instances of Wizards may be retrieved.
17   *
18   * @author Michael Rimov
19   */
20  public interface WizardRepository {
21      /***
22       * Retrieve a wizard based on id.
23       *
24       * @param id the identification field.
25       * @return Wizard instance.
26       * @throws WizardException upon repository query or wizard construction
27       *                         error.
28       */
29      Wizard find(Serializable id) throws WizardException;
30  
31      /***
32       * Retrieve instances of all wizards stored in the repository.
33       *
34       * @return java.util.List
35       * @throws WizardException upon listing or construction error.
36       */
37      List list() throws WizardException;
38  
39      /***
40       * Adds a factory to the repository.  The interface will
41       *
42       * @param id      the unique id of the wizard that we're going to hold.
43       * @param factory the factory to use for building new instances of
44       *                Wizards
45       * @throws IllegalArgumentException if the id already exists.
46       */
47      void addFactory(Serializable id, WizardFactory factory);
48  
49      /***
50       * Removes a particular wizard from the repository.  Often more used
51       * for unit testing.
52       *
53       * @param id the id of the wizard.
54       */
55      void removeWizard(Serializable id);
56  }