org.apache.maven.mae.app
Class AbstractMAEApplication

java.lang.Object
  extended by org.apache.maven.mae.app.AbstractMAEApplication
All Implemented Interfaces:
MAEApplication, MAELibrary

public abstract class AbstractMAEApplication
extends Object
implements MAEApplication

MAEApplication implementation that provides support for loading a full Maven component environment, complete with MAELibrary's, ComponentSelector and InstanceRegistry. This class supervises the assembly of the environment, giving the application developer an easy way to inject the behavior he needs.

Author:
John Casey

Constructor Summary
protected AbstractMAEApplication()
           
 
Method Summary
protected  void afterLoading(MAEEmbedder embedder)
          Hook allowing application developers access to the MAEEmbedder just after the registered external component instances have been injected, but before loading is considered complete.
protected  void configureBuilder(MAEEmbedderBuilder builder)
          Fine-tune the MAEEmbedderBuilder instance before it is used to create the MAEEmbedder that will be used to load the application components.
 ComponentSelector getComponentSelector()
           
 ExtensionConfiguration getConfiguration()
           
 Set<ComponentKey<?>> getExportedComponents()
           
 InstanceRegistry getInstanceRegistry()
           
 String getLabel()
           
 org.apache.log4j.Logger getLogger()
           
 String getLogHandle()
           
 Map<Class<?>,Set<ComponentKey<?>>> getManagementComponents()
           
 Set<ComponentKey<?>> getManagementComponents(Class<?> managementType)
           
 String getVersion()
           
protected  VersionProvider getVersionProvider()
           
 MAEApplication load()
          Assemble the component environment, based on the information given in implementors of this abstract class and auto-detected libraries.
 void loadConfiguration(MAEConfiguration embConfig)
           
protected
<C,T extends C>
void
setVirtualInstance(Class<C> virtualKey, T instance)
          Set the actual instance on a VirtualInstance that was registered previously.
protected
<C,T extends C>
void
setVirtualInstance(ComponentKey<C> virtualKey, T instance)
          Set the actual instance on a VirtualInstance that was registered previously.
protected
<C> void
withComponentInstance(ComponentKey<C> componentKey, C instance)
          Register a new, external component instance to make it available for injection, or to allow other components to be injected into it.
protected  void withComponentInstance(Object instance)
          Register a new, external component instance for injection into other components, or to have components injected into it.
protected  AbstractMAEApplication withLibrary(MAELibrary library)
          Programmatically add a new MAELibrary instance, beyond those that are automatically detected via the /META-INF/services/org.apache.maven.mae.conf.MAELibrary files on the classpath.
protected
<C> void
withVirtualComponent(Class<C> virtualClass)
          Register a new VirtualInstance, which allows the component environment to bind its requirements without actually having access to the component instance.
protected
<C> void
withVirtualComponent(ComponentKey<C> virtualKey)
          Register a new VirtualInstance, which allows the component environment to bind its requirements without actually having access to the component instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.mae.conf.MAELibrary
getId, getName
 

Constructor Detail

AbstractMAEApplication

protected AbstractMAEApplication()
Method Detail

withLibrary

protected final AbstractMAEApplication withLibrary(MAELibrary library)
Programmatically add a new MAELibrary instance, beyond those that are automatically detected via the /META-INF/services/org.apache.maven.mae.conf.MAELibrary files on the classpath.


load

public MAEApplication load()
                    throws MAEException
Assemble the component environment, based on the information given in implementors of this abstract class and auto-detected libraries.

Specified by:
load in interface MAEApplication
Throws:
MAEException
See Also:
MAEApplication.load()

withComponentInstance

protected final void withComponentInstance(Object instance)
Register a new, external component instance for injection into other components, or to have components injected into it.


withVirtualComponent

protected final <C> void withVirtualComponent(Class<C> virtualClass)
Register a new VirtualInstance, which allows the component environment to bind its requirements without actually having access to the component instance. The instance itself will be injected into the VirtualInstance later.


setVirtualInstance

protected final <C,T extends C> void setVirtualInstance(Class<C> virtualKey,
                                                        T instance)
Set the actual instance on a VirtualInstance that was registered previously.


withComponentInstance

protected final <C> void withComponentInstance(ComponentKey<C> componentKey,
                                               C instance)
Register a new, external component instance to make it available for injection, or to allow other components to be injected into it.


withVirtualComponent

protected final <C> void withVirtualComponent(ComponentKey<C> virtualKey)
Register a new VirtualInstance, which allows the component environment to bind its requirements without actually having access to the component instance. The instance itself will be injected into the VirtualInstance later.


setVirtualInstance

protected final <C,T extends C> void setVirtualInstance(ComponentKey<C> virtualKey,
                                                        T instance)
Set the actual instance on a VirtualInstance that was registered previously.


configureBuilder

protected void configureBuilder(MAEEmbedderBuilder builder)
                         throws MAEException
Fine-tune the MAEEmbedderBuilder instance before it is used to create the MAEEmbedder that will be used to load the application components.

Throws:
MAEException

afterLoading

protected void afterLoading(MAEEmbedder embedder)
                     throws MAEException
Hook allowing application developers access to the MAEEmbedder just after the registered external component instances have been injected, but before loading is considered complete.

Throws:
MAEException

getLogger

public org.apache.log4j.Logger getLogger()
Specified by:
getLogger in interface MAELibrary

getConfiguration

public ExtensionConfiguration getConfiguration()
Specified by:
getConfiguration in interface MAELibrary

getComponentSelector

public ComponentSelector getComponentSelector()
Specified by:
getComponentSelector in interface MAELibrary

getExportedComponents

public Set<ComponentKey<?>> getExportedComponents()
Specified by:
getExportedComponents in interface MAELibrary

getManagementComponents

public Set<ComponentKey<?>> getManagementComponents(Class<?> managementType)
Specified by:
getManagementComponents in interface MAELibrary

getManagementComponents

public Map<Class<?>,Set<ComponentKey<?>>> getManagementComponents()
Specified by:
getManagementComponents in interface MAELibrary

getLabel

public String getLabel()
Specified by:
getLabel in interface MAELibrary

getLogHandle

public String getLogHandle()
Specified by:
getLogHandle in interface MAELibrary

loadConfiguration

public void loadConfiguration(MAEConfiguration embConfig)
                       throws ExtensionConfigurationException
Specified by:
loadConfiguration in interface MAELibrary
Throws:
ExtensionConfigurationException

getInstanceRegistry

public final InstanceRegistry getInstanceRegistry()
Specified by:
getInstanceRegistry in interface MAELibrary

getVersion

public String getVersion()
Specified by:
getVersion in interface MAELibrary

getVersionProvider

protected VersionProvider getVersionProvider()


Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.