Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## griffon.core
[Java] Interface GriffonApplication

    griffon.core.ResourceHandler
      griffon.core.GriffonApplication
          griffon.core.MVCHandler
              griffon.core.ThreadingHandler

All Superinterfaces:
  ResourceHandler, MVCHandler, ThreadingHandler

    public interface GriffonApplication
    extends MVCHandler, ResourceHandler, ThreadingHandler

Defines the basic contract of a Griffon application.

Authors:
  Danno Ferrin
  Andres Almiray

Nested Class Summary
`enum` | `GriffonApplication.Configuration` Defines the names of the configuration scripts.
`enum` | `GriffonApplication.Event` Defines all the events triggered by the application.
`enum` | `GriffonApplication.Lifecycle` Defines the names of the lifecycle scripts.

Method Summary
`void` | `addApplicationEventListener(Object listener)` Adds an application event listener.
`void` | `addApplicationEventListener(String eventName, Closure listener)` Adds a closure as an application event listener.
`void` | `addApplicationEventListener(String eventName, RunnableWithArgs listener)` Adds a runnable as an application event listener.
`void` | `addShutdownHandler(ShutdownHandler handler)` Registers a ShutdownHandler on this application
`boolean` | `canShutdown()` Queries any available ShutdownHandlers.
`Object` | `createApplicationContainer()`
`void` | `event(String eventName)` Publishes an application event.
`void` | `event(String eventName, List params)` Publishes an application event.
`void` | `eventAsync(String eventName)` Publishes an application event asynchronously off the publisher's thread.
`void` | `eventAsync(String eventName, List params)` Publishes an application event asynchronously off the publisher's thread.
`void` | `eventOutside(String eventName)` Publishes an application event asynchronously off the UI thread.
`void` | `eventOutside(String eventName, List params)` Publishes an application event asynchronously off the UI thread.
`void` | `eventOutsideUI(String eventName)` Publishes an application event asynchronously off the UI thread.
`void` | `eventOutsideUI(String eventName, List params)` Publishes an application event asynchronously off the UI thread.
`AddonManager` | `getAddonManager()` Returns the application's AddonManager instance.
`Class` | `getAppConfigClass()` Gets the script class that holds the MVC configuration (i.e.
`ArtifactManager` | `getArtifactManager()` Returns the application's ArtifactManager instance.
`Binding` | `getBindings()`
`Class` | `getBuilderClass()` Gets the script class that holds builder configuration (i.e.
`ConfigObject` | `getBuilderConfig()` Returns the runtime configuration required for instantiating a `CompositeBuilder`
`Map` | `getBuilders()` Returns all currently available builder instances, keyed by group name.
`ConfigObject` | `getConfig()` Returns the merged runtime configuration from `appConfig` and `config`
`Class` | `getConfigClass()` Gets the script class that holds additional configuration (i.e.
`Map` | `getControllers()` Returns all currently available controller instances, keyed by group name.
`Class` | `getEventsClass()` Gets the script class that holds global event handler configuration (i.e.
`Object` | `getEventsConfig()` Returns the runtime configuration for global event handlers.
`Map` | `getGroups()` Returns all currently available groups, keyed by group name.
`Locale` | `getLocale()` Gets the application locale.
`org.slf4j.Logger` | `getLog()` Returns a Logger instance suitable for this application.
`Metadata` | `getMetadata()` Gets the application's configuration set on 'application.properties'.
`Map` | `getModels()` Returns all currently available model instances, keyed by group name.
`MVCGroupManager` | `getMvcGroupManager()` Returns the application's MVCGroupManager instance.
`ApplicationPhase` | `getPhase()` Returns the current phase.
`ServiceManager` | `getServiceManager()` Returns the application's ServiceManager instance.
`Map` | `getServices()` Returns all currently available service instances, keyed by group name.
`String[]` | `getStartupArgs()` Returns the arguments set on the command line (if any).
`Map` | `getViews()` Returns all currently available view instances, keyed by group name.
`void` | `initialize()` Executes the 'Initialize' life cycle phase.
`boolean` | `isEventPublishingEnabled()` Returns whether events will be published by the application's event bus or not.
`Object` | `newInstance(Class clazz, String type)` Creates a new instance of the specified class and type.
`void` | `ready()` Executes the 'Ready' life cycle phase.
`void` | `removeApplicationEventListener(Object listener)` Removes an application event listener.
`void` | `removeApplicationEventListener(String eventName, Closure listener)` Removes a closure as an application event listener.
`void` | `removeApplicationEventListener(String eventName, RunnableWithArgs listener)` Removes a runnable as an application event listener.
`void` | `removeShutdownHandler(ShutdownHandler handler)` Removes a ShutdownHandler from this application
`void` | `setBindings(Binding bindings)`
`void` | `setBuilderConfig(ConfigObject builderConfig)`
`void` | `setConfig(ConfigObject config)`
`void` | `setEventPublishingEnabled(boolean enabled)` Sets the enabled state for event publishing.
`void` | `setEventsConfig(Object eventsConfig)`
`void` | `setLocale(Locale locale)` Sets the application locale.
`boolean` | `shutdown()` Executes the 'Shutdown' life cycle phase.
`void` | `startup()` Executes the 'Startup' life cycle phase.
`GriffonApplication` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
`GriffonApplication` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
`GriffonApplication` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
`GriffonApplication[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.
`GriffonApplication[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.
`GriffonApplication[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

Methods inherited from interface ResourceHandler
getResourceAsStream, getResourceAsURL, getResources

Methods inherited from interface MVCHandler
buildMVCGroup, buildMVCGroup, buildMVCGroup, buildMVCGroup, buildMVCGroup, buildMVCGroup, createMVCGroup, createMVCGroup, createMVCGroup, createMVCGroup, createMVCGroup, createMVCGroup, destroyMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup

Methods inherited from interface ThreadingHandler
execAsync, execFuture, execFuture, execFuture, execFuture, execInsideUIAsync, execInsideUISync, execOutside, execOutsideUI, execSync, isUIThread

Method Detail

### addApplicationEventListener

    public void addApplicationEventListener(Object listener)

  Adds an application event listener.

  Accepted types are: Script, Map and Object.

  Parameters:
    `listener` - an application event listener

### addApplicationEventListener

    public void addApplicationEventListener(String eventName, Closure listener)

  Adds a closure as an application event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an application event listener

### addApplicationEventListener

    public void addApplicationEventListener(String eventName, RunnableWithArgs listener)

  Adds a runnable as an application event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an application event listener

### addShutdownHandler

    public void addShutdownHandler(ShutdownHandler handler)

  Registers a ShutdownHandler on this application
  Parameters:
    `handler` - the shutdown handler to be registered; null and/or duplicated values should be ignored

### canShutdown

    public boolean canShutdown()

  Queries any available ShutdownHandlers.
  Returns:
    true if the shutdown sequence can proceed, false otherwise

### createApplicationContainer

    public Object createApplicationContainer()

### event

    public void event(String eventName)

  Publishes an application event.

  Parameters:
    `eventName` - the name of the event

### event

    public void event(String eventName, List params)

  Publishes an application event.

  Parameters:
    `eventName` - the name of the event
    `params` - event arguments sent to listeners

### eventAsync

    public void eventAsync(String eventName)

  Publishes an application event asynchronously off the publisher's thread.

  Parameters:
    `eventName` - the name of the event

### eventAsync

    public void eventAsync(String eventName, List params)

  Publishes an application event asynchronously off the publisher's thread.

  Parameters:
    `eventName` - the name of the event
    `params` - event arguments sent to listeners

### eventOutside

    @Deprecated
    public void eventOutside(String eventName)

  Publishes an application event asynchronously off the UI thread.

  deprecated:
    use #eventOutsideUI() instead
  Parameters:
    `eventName` - the name of the event

### eventOutside

    @Deprecated
    public void eventOutside(String eventName, List params)

  Publishes an application event asynchronously off the UI thread.

  deprecated:
    use #eventOutsideUI() instead
  Parameters:
    `eventName` - the name of the event
    `params` - event arguments sent to listeners

### eventOutsideUI

    public void eventOutsideUI(String eventName)

  Publishes an application event asynchronously off the UI thread.

  Parameters:
    `eventName` - the name of the event

### eventOutsideUI

    public void eventOutsideUI(String eventName, List params)

  Publishes an application event asynchronously off the UI thread.

  Parameters:
    `eventName` - the name of the event
    `params` - event arguments sent to listeners

### getAddonManager

    public AddonManager getAddonManager()

  Returns the application's AddonManager instance.
  Returns:
    the application's AddonManager

### getAppConfigClass

    public Class getAppConfigClass()

  Gets the script class that holds the MVC configuration (i.e. `Application.groovy`)

### getArtifactManager

    public ArtifactManager getArtifactManager()

  Returns the application's ArtifactManager instance.
  Returns:
    the application's ArtifactManager

### getBindings

    public Binding getBindings()

### getBuilderClass

    public Class getBuilderClass()

  Gets the script class that holds builder configuration (i.e. `Builder.groovy`)

### getBuilderConfig

    public ConfigObject getBuilderConfig()

  Returns the runtime configuration required for instantiating a `CompositeBuilder`

### getBuilders

    public Map getBuilders()

  Returns all currently available builder instances, keyed by group name.

  Returns:
    a Map of all currently instantiated builders.

### getConfig

    public ConfigObject getConfig()

  Returns the merged runtime configuration from `appConfig` and `config`

### getConfigClass

    public Class getConfigClass()

  Gets the script class that holds additional configuration (i.e. `Config.groovy`)

### getControllers

    public Map getControllers()

  Returns all currently available controller instances, keyed by group name.

  Returns:
    a Map of all currently instantiated controllers.

### getEventsClass

    public Class getEventsClass()

  Gets the script class that holds global event handler configuration (i.e. `Events.groovy`)

### getEventsConfig

    public Object getEventsConfig()

  Returns the runtime configuration for global event handlers.

### getGroups

    public Map getGroups()

  Returns all currently available groups, keyed by group name.

  Returns:
    a Map of all currently instantiated groups.

### getLocale

    public Locale getLocale()

  Gets the application locale.
  Returns:
    the current Locale used by the application. Never returns null.

### getLog

    public org.slf4j.Logger getLog()

  Returns a Logger instance suitable for this application.
  Returns:
    a Logger instance.
  Since:
    0.9.2

### getMetadata

    public Metadata getMetadata()

  Gets the application's configuration set on 'application.properties'.

  Returns:
    the application's metadata configuration

### getModels

    public Map getModels()

  Returns all currently available model instances, keyed by group name.

  Returns:
    a Map of all currently instantiated models.

### getMvcGroupManager

    public MVCGroupManager getMvcGroupManager()

  Returns the application's MVCGroupManager instance.
  Returns:
    the application's MVCGroupManager

### getPhase

    public ApplicationPhase getPhase()

  Returns the current phase.
  Returns:
    returns the current ApplicationPhase. Never returns null.

### getServiceManager

    public ServiceManager getServiceManager()

  Returns the application's ServiceManager instance.
  Returns:
    the application's ServiceManager

### getServices

    public Map getServices()

  Returns all currently available service instances, keyed by group name.

  Returns:
    a Map of all currently instantiated services.

### getStartupArgs

    public String[] getStartupArgs()

  Returns the arguments set on the command line (if any).

  Returns:
    an array of command line arguments. Never returns null.
  Since:
    0.9.2

### getViews

    public Map getViews()

  Returns all currently available view instances, keyed by group name.

  Returns:
    a Map of all currently instantiated views.

### initialize

    public void initialize()

  Executes the 'Initialize' life cycle phase.

### isEventPublishingEnabled

    public boolean isEventPublishingEnabled()

  Returns whether events will be published by the application's event bus or not.
  Returns:
    true if event publishing is enabled; false otherwise.

### newInstance

    public Object newInstance(Class clazz, String type)

  Creates a new instance of the specified class and type.
  Triggers the Event.NEW_INSTANCE with the following parameters
  - clazz - the Class of the object
  - type - the symbolical type of the object
  - instance -> the object that was created
  Parameters:
    `clazz` - the Class for which an instance must be created
    `type` - a symbolical type, for example 'controller' or 'service'. May be null.
  Returns:
    a newly instantiated object of type `clazz`. Implementations must be sure to trigger an event of type Event.NEW_INSTANCE.

### ready

    public void ready()

  Executes the 'Ready' life cycle phase.

### removeApplicationEventListener

    public void removeApplicationEventListener(Object listener)

  Removes an application event listener.

  Accepted types are: Script, Map and Object.

  Parameters:
    `listener` - an application event listener

### removeApplicationEventListener

    public void removeApplicationEventListener(String eventName, Closure listener)

  Removes a closure as an application event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an application event listener

### removeApplicationEventListener

    public void removeApplicationEventListener(String eventName, RunnableWithArgs listener)

  Removes a runnable as an application event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an application event listener

### removeShutdownHandler

    public void removeShutdownHandler(ShutdownHandler handler)

  Removes a ShutdownHandler from this application
  Parameters:
    `handler` - the shutdown handler to be removed; null and/or duplicated values should be ignored

### setBindings

    public void setBindings(Binding bindings)

### setBuilderConfig

    public void setBuilderConfig(ConfigObject builderConfig)

### setConfig

    public void setConfig(ConfigObject config)

### setEventPublishingEnabled

    public void setEventPublishingEnabled(boolean enabled)

  Sets the enabled state for event publishing. Events will be automatically discarded when the enabled state is set to false.
  Parameters:
    `enabled` - the value fot the enabled state.

### setEventsConfig

    public void setEventsConfig(Object eventsConfig)

### setLocale

    public void setLocale(Locale locale)

  Sets the application locale.

  This is a bound property.

  Parameters:
    `locale` - the Locale value to use

### shutdown

    public boolean shutdown()

  Executes the 'Shutdown' life cycle phase.
  Returns:
    false if the shutdown sequence was aborted

### startup

    public void startup()

  Executes the 'Startup' life cycle phase.

### valueOf

    GriffonApplication valueOf(String name)

  Returns the enum constant of this type with the specified name.

### valueOf

    GriffonApplication valueOf(String name)

  Returns the enum constant of this type with the specified name.

### valueOf

    GriffonApplication valueOf(String name)

  Returns the enum constant of this type with the specified name.

### values

    GriffonApplication[] values()

  Returns an array containing the constants of this enum type, in the order they are declared.

### values

    GriffonApplication[] values()

  Returns an array containing the constants of this enum type, in the order they are declared.

### values

    GriffonApplication[] values()

  Returns an array containing the constants of this enum type, in the order they are declared.

Groovy Documentation