1 /* 2 * Copyright (c) 1998-2006 The Jgroup Team. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License version 2 as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * 17 */ 18 19 package jgroup.relacs.gmi.protocols; 20 21 import java.io.IOException; 22 import java.io.InputStream; 23 24 import jgroup.relacs.gmi.InvocationResult; 25 26 /** 27 * ProtocolDispatcher must be implemented by GMI protocols. 28 * 29 * @author Hein Meling <hein.meling@uis.no> 30 */ 31 public interface ProtocolDispatcher 32 { 33 34 /** 35 * Invoked to dispatch a method invocation on the local endpoint or on 36 * multiple external endpoints. The method may block until a result can 37 * be returned to the caller. It may also return <code>null</code> if 38 * problems occur, e.g. connectivity problems. 39 * 40 * @param in the method to invoke, encoded in the provided <code>InputStream</code>. 41 * @return the result of the method invocation. 42 * @throws IOException Raised if the method invocation read from the 43 * <code>InputStream</code> could not be executed for some reason. 44 */ 45 public InvocationResult dispatch(InputStream in) 46 throws IOException; 47 48 /** 49 * Pass the server reference to the protocol implementation. 50 */ 51 public void setServer(Object server); 52 53 } // END ProtocolDispatcher