View Javadoc

1   /*
2    * Copyright 1999-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  
17  package org.apache.commons.workflow;
18  
19  
20  /**
21   * <p>A <strong>Registry</strong> is a Singleton that provides registration
22   * and lookup facilities for {@link Activity} instances.  All Activity
23   * instances registered in a Registry must have unique <code>id</code>
24   * properties, but lookup facilities may be used to select zero or more
25   * Activities that match particular patterns.  This can be used, for example,
26   * to select a Locale-specific version of a particular Activity.</p>
27   *
28   * <p><strong>FIXME</strong> - Initial version of this interface does not
29   * have any of the fancy lookup capabilities allued to above.</p>
30   *
31   * @author Craig R. McClanahan
32   * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
33   */
34  
35  public interface Registry {
36  
37  
38      // ------------------------------------------------------------- Properties
39  
40  
41      // --------------------------------------------------------- Public Methods
42  
43  
44      /**
45       * Add a new Activity to the set of Activity instances known to this
46       * Registry.
47       *
48       * @param activity The new activity to be added
49       */
50      public void addActivity(Activity activity);
51  
52  
53      /**
54       * Clear any existing Activity instances registered with this Registry.
55       */
56      public void clear();
57  
58  
59      /**
60       * Return the complete set of Activity instances associated with
61       * this Activity.  If there are no such registered Activity instances,
62       * a zero-length array is returned.
63       */
64      public Activity[] findActivities();
65  
66  
67      /**
68       * Return the registered Activity with the specified identifier, if any;
69       * otherwise return <code>null</code>.
70       *
71       * @param id Identifier of the desired Activity
72       */
73      public Activity findActivity(String id);
74  
75  
76      /**
77       * Remove the specified Activity from this Registry.
78       *
79       * @param activity The Activity to be removed
80       */
81      public void removeActivity(Activity activity);
82  
83  
84  }