View Javadoc
1   /*
2    * Copyright 2013 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  package org.openehealth.ipf.commons.core.extend.config;
17  
18  /**
19   * DSL extensions implementing this marker interface can be auto discovered
20   * by IPF's extension configuration framework.
21   * <p>
22   * This is an alternative to the standard Extension Module mechanism provided by Groovy
23   * Instead of a module descriptor in META-INF/services you simply define a Spring bean that
24   * extends this type and adheres to the structure described in
25   * http://docs.codehaus.org/display/GROOVY/Creating+an+extension+module.
26   * </p><p>
27   * This interface defines method that provide information that the module descriptor
28   * would usually deliver. Bean instance of this type are picked up by Spring when
29   * it contains a {@link DynamicExtensionConfigurer} and dynamically registered in
30   * Groovy's metaclass/metamethod registry.
31   * </p><p>
32   * The advantage is that due to late initialization your extensions can be stateful (e.g.
33   * providing a configuration object), which is normally only possible by accessing a
34   * global registry via {@link org.openehealth.ipf.commons.core.config.ContextFacade#getBean(Class)}.
35   * The disadvantage is that you need to define a bunch of Spring beans (including the extension
36   * bean) in order to get the machinery working.
37   *
38   * @see DynamicExtensionConfigurer
39   * 
40   * @author Christian Ohr
41   */
42  public interface DynamicExtension {
43  
44      String getModuleName();
45      String getModuleVersion();
46  
47      /**
48       * @return true if the extensions methods shall have static access from
49       * the extended class, false otherwise.
50       */
51      boolean isStatic();
52  
53  }