## org.eclipse.wst.server.core.model
Class ModuleDelegate

    java.lang.Object
      org.eclipse.wst.server.core.model.ModuleDelegate

Direct Known Subclasses:
  ProjectModule

    public abstract class ModuleDelegate

extends java.lang.Object

A module delegate provides a mechanism for discovering information about individual modules. Modules are returned from module factory delegates; their delegates are created when ModuleFactoryDelegate.createModule() is called.

When the module needs to be given a delegate, the delegate class specified for the module is instantiated with a 0-argument constructor.

Module delegates may keep state in instance fields, but that state is transient and will not be persisted across workbench sessions.

This abstract class is intended to be extended only by clients to extend the `moduleFactories` extension point.

Since:
  1.0
See Also:
  `IModule`, `ModuleFactoryDelegate`

Constructor Summary
`ModuleDelegate()` Delegates must have a public 0-arg constructor.

Method Summary
`abstract IModule[]` `getChildModules()` Returns the child modules of this module.
`IModule` `getModule()` Returns the module that this module delegate corresponds to.
`void` `initialize()` Initializes this module delegate.
`void` `initialize(IModule newModule)` Initializes this module delegate with its life-long module instance.
`abstract IModuleResource[]` `members()` Returns the current array of module artifacts.
`abstract IStatus` `validate()` Validates this module instance.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ModuleDelegate

    public ModuleDelegate()

  Delegates must have a public 0-arg constructor.

Method Detail

### initialize

    public final void initialize(IModule newModule)

  Initializes this module delegate with its life-long module instance.

  This method is called by the server core framework. Clients should never call this method.

  Parameters:
    `newModule` - the module instance

### initialize

    public void initialize()

  Initializes this module delegate. This method gives delegates a chance to do their own initialization.

  This method is called by the server core framework. Clients should never call this method.

### getModule

    public IModule getModule()

  Returns the module that this module delegate corresponds to.

  Returns:
    the module

### validate

    public abstract IStatus validate()

  Validates this module instance. Subclasses should override and call super.validate() for basic validation.

  This method is called by the web server core framework. Clients should never call this method.

  Returns:
    a status object with code `IStatus.OK` if this module is valid, otherwise a status object indicating what is wrong with it

### getChildModules

    public abstract IModule[] getChildModules()

  Returns the child modules of this module.

  Returns:
    a possibly empty array of child modules

### members

    public abstract IModuleResource[] members()
                                       throws CoreException

  Returns the current array of module artifacts.

  Returns:
    a possibly empty array containing the module resources
  Throws:
    `CoreException` - thrown if there is a problem getting the members