1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.apache.river.norm.event; 19 20 import java.rmi.MarshalledObject; 21 import net.jini.core.event.RemoteEvent; 22 23 /** 24 * Factory interface for creating 25 * <code>net.jini.core.event.RemoteEvent</code>. An object of this 26 * type is passed to each call of <code>EventType.sendEvent</code> and 27 * is used by the <code>EventType</code> object to generate the 28 * concrete <code>RemoteEvent</code> associated with a given event 29 * occurrence on demand. Providing a factory to <code>sendEvent</code> 30 * instead of an actual <code>RemoteEvent</code> object allows 31 * <code>eventType</code> object to send an event originally 32 * intended for one listener to another. 33 * 34 * @author Sun Microsystems, Inc. 35 * 36 * @see EventType 37 * @see EventType#sendEvent 38 */ 39 public interface EventFactory { 40 /** 41 * Create the concrete <code>RemoteEvent</code> for the associated 42 * event occurrence. Implementations should allow for the 43 * possibility of being called with the same argument more that 44 * once, especially the same eventID and seqNum. The factory 45 * should not mutate the event after it returns it. 46 * <p> 47 * The caller will own no locks when calling this method. 48 * @param eventID the event ID the new event should have 49 * @param seqNum the sequence number the new event object should have 50 * @param handback the handback the new event object should have 51 * @return the new event object 52 */ 53 public RemoteEvent createEvent(long eventID, 54 long seqNum, 55 MarshalledObject handback); 56 }