1 /* 2 * Copyright 2006-2009 the original author or authors. 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 17 package org.springframework.osgi.service.importer.event; 18 19 import org.springframework.context.ApplicationEvent; 20 import org.springframework.osgi.service.importer.OsgiServiceDependency; 21 import org.springframework.util.Assert; 22 23 /** 24 * Base event type used for sending dependencies notifications. Usually these 25 * are sent by Spring-DM OSGi importers. 26 * 27 * @author Costin Leau 28 * 29 */ 30 public abstract class OsgiServiceDependencyEvent extends ApplicationEvent { 31 32 private final OsgiServiceDependency dependency; 33 34 35 /** 36 * Constructs a new <code>OsgiServiceDependencyEvent</code> instance. 37 * 38 * @param source event source (usually the service importer) 39 * @param dependency dependency description 40 */ 41 public OsgiServiceDependencyEvent(Object source, OsgiServiceDependency dependency) { 42 super(source); 43 Assert.notNull(dependency); 44 this.dependency = dependency; 45 } 46 47 /** 48 * Returns the OSGi service dependency filter for which this event is 49 * triggered. 50 * 51 * @return Returns the dependencyServiceFilter 52 */ 53 public OsgiServiceDependency getServiceDependency() { 54 return dependency; 55 } 56 }