1 /* 2 * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/WireAdminListener.java,v 1.10 2006/07/11 00:54:10 hargrave Exp $ 3 * 4 * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * 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.osgi.service.wireadmin; 19 20 /** 21 * Listener for Wire Admin Events. 22 * 23 * <p> 24 * <code>WireAdminListener</code> objects are registered with the Framework 25 * service registry and are notified with a <code>WireAdminEvent</code> object 26 * when an event is broadcast. 27 * <p> 28 * <code>WireAdminListener</code> objects can inspect the received 29 * <code>WireAdminEvent</code> object to determine its type, the <code>Wire</code> 30 * object with which it is associated, and the Wire Admin service that 31 * broadcasts the event. 32 * 33 * <p> 34 * <code>WireAdminListener</code> objects must be registered with a service 35 * property {@link WireConstants#WIREADMIN_EVENTS} whose value is a bitwise OR 36 * of all the event types the listener is interested in receiving. 37 * <p> 38 * For example: 39 * 40 * <pre> 41 * Integer mask = new Integer(WIRE_TRACE | WIRE_CONNECTED | WIRE_DISCONNECTED); 42 * Hashtable ht = new Hashtable(); 43 * ht.put(WIREADMIN_EVENTS, mask); 44 * context.registerService(WireAdminListener.class.getName(), this, ht); 45 * </pre> 46 * 47 * If a <code>WireAdminListener</code> object is registered without a service 48 * property {@link WireConstants#WIREADMIN_EVENTS}, then the 49 * <code>WireAdminListener</code> will receive no events. 50 * 51 * <p> 52 * Security Considerations. Bundles wishing to monitor <code>WireAdminEvent</code> 53 * objects will require <code>ServicePermission[WireAdminListener,REGISTER]</code> 54 * to register a <code>WireAdminListener</code> service. Since 55 * <code>WireAdminEvent</code> objects contain <code>Wire</code> objects, care must 56 * be taken in assigning permission to register a <code>WireAdminListener</code> 57 * service. 58 * 59 * @see WireAdminEvent 60 * 61 * @version $Revision: 1.10 $ 62 */ 63 public interface WireAdminListener { 64 /** 65 * Receives notification of a broadcast <code>WireAdminEvent</code> object. 66 * 67 * The event object will be of an event type specified in this 68 * <code>WireAdminListener</code> service's 69 * {@link WireConstants#WIREADMIN_EVENTS} service property. 70 * 71 * @param event The <code>WireAdminEvent</code> object. 72 */ 73 void wireAdminEvent(WireAdminEvent event); 74 } 75