001    // Copyright 2004, 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.hivemind.service;
016    
017    import org.apache.hivemind.Location;
018    
019    /**
020     * Service used to link two other services together using event notifications. The service producer
021     * will have the consumer registered as a listener.
022     * 
023     * @author Howard Lewis Ship
024     */
025    public interface EventLinker
026    {
027        /**
028         * Adds the consumer as a listener of events published by the producer. Typically, the producer
029         * is a service, and the consumer is some other service's core implementation.
030         * 
031         * @param producer
032         *            the object which will be publishing the events.
033         * @param eventSetName
034         *            the name of an event set; the consumer will only be registered for that set of
035         *            events.
036         * @param consumer
037         *            the object which will be added as a listener.
038         * @param location
039         *            used when reporting errors, may be null
040         * @return true on success, false if there was any failure (which may mean only partial
041         *         registration).
042         */
043        public void addEventListener(Object producer, String eventSetName, Object consumer,
044                Location location);
045    }