View Javadoc

1   /*
2    * Copyright 2006-2008 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.extender.event;
18  
19  import org.osgi.framework.Bundle;
20  import org.springframework.context.ApplicationContext;
21  import org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent;
22  import org.springframework.osgi.service.importer.event.OsgiServiceDependencyEvent;
23  import org.springframework.util.Assert;
24  
25  /**
26   * Spring-DM Extender bootstrapping event. This event is used during the
27   * application context discovery phase, before an application context is fully
28   * initialized.
29   * 
30   * <p/> It can be used to receive status updates for contexts started by the
31   * extender.
32   * 
33   * @author Costin Leau
34   * 
35   */
36  public class BootstrappingDependencyEvent extends OsgiBundleApplicationContextEvent {
37  
38  	private final OsgiServiceDependencyEvent dependencyEvent;
39  
40  
41  	/**
42  	 * Constructs a new <code>BootstrappingDependencyEvent</code> instance.
43  	 * 
44  	 * @param source
45  	 */
46  	public BootstrappingDependencyEvent(ApplicationContext source, Bundle bundle, OsgiServiceDependencyEvent nestedEvent) {
47  		super(source, bundle);
48  		Assert.notNull(nestedEvent);
49  		this.dependencyEvent = nestedEvent;
50  	}
51  
52  	/**
53  	 * Returns the nested, dependency event that caused the bootstrapping event
54  	 * to be raised.
55  	 * 
56  	 * @return associated dependency event
57  	 */
58  	public OsgiServiceDependencyEvent getDependencyEvent() {
59  		return dependencyEvent;
60  	}
61  }