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.support.scanning;
18  
19  import org.osgi.framework.Bundle;
20  
21  /**
22   * Convenience scanner locating suitable Spring configurations inside an OSGi
23   * bundle. This interface can be implemented to customize Spring-DM default
24   * definition of a 'Spring-powered' bundle by using different locations or
25   * supplying defaults for bundles that do not provide a proper configuration.
26   * 
27   * <p/> Additionally, non-XML configurations (for example annotation-based) can
28   * be plugged in. This would normally imply a custom application context creator
29   * as well.
30   * 
31   * <p/><b>Note:</b>It is strongly recommended that the default locations (<tt>META-INF/spring/*.xml</tt>
32   * or <tt>Spring-Context</tt> manifest header) are supported (through chaining
33   * or by extending the default implementation) to avoid breaking bundles using
34   * them.
35   * 
36   * <p/>This interface is intended for usage with the default
37   * {@link org.springframework.osgi.extender.OsgiApplicationContextCreator}
38   * implementation.
39   * 
40   * @see org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator
41   * @see org.springframework.osgi.extender.OsgiApplicationContextCreator
42   * 
43   * @author Costin Leau
44   */
45  public interface ConfigurationScanner {
46  
47  	/**
48  	 * Returns an array of existing Spring configuration locations (as Strings)
49  	 * for the given bundle. If no resource was found, an empty/null array
50  	 * should be returned.
51  	 * 
52  	 * @param bundle non-null bundle intended for scanning
53  	 * @return Spring configuration locations
54  	 */
55  	String[] getConfigurations(Bundle bundle);
56  }