001    /*
002     * Copyright 1999-2001,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */ 
016    
017    package org.apache.commons.workflow;
018    
019    
020    /**
021     * <p>A <strong>Registry</strong> is a Singleton that provides registration
022     * and lookup facilities for {@link Activity} instances.  All Activity
023     * instances registered in a Registry must have unique <code>id</code>
024     * properties, but lookup facilities may be used to select zero or more
025     * Activities that match particular patterns.  This can be used, for example,
026     * to select a Locale-specific version of a particular Activity.</p>
027     *
028     * <p><strong>FIXME</strong> - Initial version of this interface does not
029     * have any of the fancy lookup capabilities allued to above.</p>
030     *
031     * @author Craig R. McClanahan
032     * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
033     */
034    
035    public interface Registry {
036    
037    
038        // ------------------------------------------------------------- Properties
039    
040    
041        // --------------------------------------------------------- Public Methods
042    
043    
044        /**
045         * Add a new Activity to the set of Activity instances known to this
046         * Registry.
047         *
048         * @param activity The new activity to be added
049         */
050        public void addActivity(Activity activity);
051    
052    
053        /**
054         * Clear any existing Activity instances registered with this Registry.
055         */
056        public void clear();
057    
058    
059        /**
060         * Return the complete set of Activity instances associated with
061         * this Activity.  If there are no such registered Activity instances,
062         * a zero-length array is returned.
063         */
064        public Activity[] findActivities();
065    
066    
067        /**
068         * Return the registered Activity with the specified identifier, if any;
069         * otherwise return <code>null</code>.
070         *
071         * @param id Identifier of the desired Activity
072         */
073        public Activity findActivity(String id);
074    
075    
076        /**
077         * Remove the specified Activity from this Registry.
078         *
079         * @param activity The Activity to be removed
080         */
081        public void removeActivity(Activity activity);
082    
083    
084    }