1 /* 2 Copyright 2010 Ramon Servadei 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 package mirrormap; 17 18 19 /** 20 * Receives notifications about the connection status of a local and remote 21 * {@link MirrorMap} instances. 22 * <p> 23 * Local connection events signal when local mirror maps are connected or 24 * disconnected from the server. The remote connection events signal when peer 25 * mirror maps connect or disconnect from the server. 26 * <p> 27 * Knowing about peer mirror map connect/disconnects is useful if one of the 28 * peers is actually sourcing the data for the map; in situations where it knows 29 * there are no further peers of the map it can stop feeding the map with data 30 * from external systems, say. 31 * 32 * @author Ramon Servadei 33 */ 34 public interface IMirrorMapConnectionListener 35 { 36 37 /** 38 * Received when a local {@link MirrorMap} is connected to its server. The 39 * instance will receive remote changes. 40 * 41 * @param mirrorMapName 42 * the name of the mirror map that has connected 43 */ 44 void localConnected(String mirrorMapName); 45 46 /** 47 * Received when a {@link MirrorMap} is disconnected from its server. The 48 * instance will no longer be receiving remote changes. 49 * 50 * @param mirrorMapName 51 * the name of the mirror map that was disconnected 52 */ 53 void localDisconnected(String mirrorMapName); 54 55 /** 56 * Received when any {@link MirrorMap} connects to the server. This is 57 * triggered by remote peers as well as the local instance connecting. 58 * 59 * @param mirrorMapName 60 * the name of the mirror map that has connected 61 */ 62 void peerConnected(String mirrorMapName); 63 64 /** 65 * Received when any {@link MirrorMap} disconnects from the server. This is 66 * only triggered by remote peer disconnects. <b>Disconnecting the local 67 * instance will not trigger this.</b> 68 * 69 * @param mirrorMapName 70 * the name of the mirror map that has disconnected 71 */ 72 void peerDisconnected(String mirrorMapName); 73 }