## org.eclipse.wst.server.core
Class ServerEvent

    java.lang.Object
      org.eclipse.wst.server.core.ServerEvent

    public class ServerEvent

extends java.lang.Object

An event fired when a server change or module changes.

Since:
  1.0

Field Summary
`static int` `MODULE_CHANGE` For event on module changes.
`static int` `PUBLISH_STATE_CHANGE` Fired when published is needed or no longer needs to be published, or it's state has changed.
`static int` `RESTART_STATE_CHANGE` For notification when the server isRestartNeeded() property changes.
`static int` `SERVER_CHANGE` For event on server changes.
`static int` `STATE_CHANGE` For notification when the state has changed.

Constructor Summary
`ServerEvent(int kind, IServer server, IModule[] module, int state, int publishingState, boolean restartState)` Create a new ServerEvent for module change events.
`ServerEvent(int kind, IServer server, int state, int publishingState, boolean restartState)` Create a new server event for server change events.

Method Summary
`int` `getKind()` Returns the kind of the server event.
`IModule[]` `getModule()` Returns the module tree of the module involved in the module change event, or `null` if the event is not a module event, i.e. isModuleEvent() is false.
`int` `getPublishState()` Get the publish state after the change that triggers this server event.
`boolean` `getRestartState()` Get the restart state after isRestartNeeded() property change event.
`IServer` `getServer()` Returns the server involved in the change event.
`int` `getState()` Get the state after the change that triggers this server event.

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

Field Detail

### STATE_CHANGE

    public static final int STATE_CHANGE

  For notification when the state has changed.

  This kind is mutually exclusive with `PUBLISH_STATE_CHANGE` and `RESTART_STATE_CHANGE`.

  See Also:
    `getKind()`, Constant Field Values

### PUBLISH_STATE_CHANGE

    public static final int PUBLISH_STATE_CHANGE

  Fired when published is needed or no longer needs to be published, or it's state has changed.

  This kind is mutually exclusive with `STATE_CHANGE` and `RESTART_STATE_CHANGE`.

  See Also:
    `getKind()`, Constant Field Values

### RESTART_STATE_CHANGE

    public static final int RESTART_STATE_CHANGE

  For notification when the server isRestartNeeded() property changes.

  This kind is mutually exclusive with `STATE_CHANGE` and `PUBLISH_STATE_CHANGE`.

  See Also:
    `getKind()`, Constant Field Values

### SERVER_CHANGE

    public static final int SERVER_CHANGE

  For event on server changes. This kind is mutually exclusive with `MODULE_CHANGE`.

  See Also:
    `getKind()`, Constant Field Values

### MODULE_CHANGE

    public static final int MODULE_CHANGE

  For event on module changes. This kind is mutually exclusive with `SERVER_CHANGE`.

  See Also:
    `getKind()`, Constant Field Values

Constructor Detail

### ServerEvent

    public ServerEvent(int kind,
                       IServer server,
                       int state,
                       int publishingState,
                       boolean restartState)

  Create a new server event for server change events.

  Parameters:
    `kind` - the kind of the change. (`XXX_CHANGE`). If the kind does not include the `SERVER_CHANGE` kind, the SERVER_CHANGE will be added automatically. constants declared on `ServerEvent`
    `server` - the server that the server event takes place
    `state` - the server state after the change (`STATE_XXX`) constants declared on `IServer`
    `publishingState` - the server publishing state after the change (`PUBLISH_STATE_XXX`) constants declared on `IServer`
    `restartState` - get the server restart state after the server is restart needed property change event

### ServerEvent

    public ServerEvent(int kind,
                       IServer server,
                       IModule[] module,
                       int state,
                       int publishingState,
                       boolean restartState)

  Create a new ServerEvent for module change events.

  Parameters:
    `kind` - the kind of the change. (`XXX_CHANGE`). If the kind does not include the `MODULE_CHANGE` kind, the MODULE_CHANGE will be added automatically. constants declared on `ServerEvent`
    `server` - the server that the module event takes place
    `module` - the module that has changed
    `state` - the module state after the change (`STATE_XXX`) constants declared on `IServer`
    `publishingState` - the module publishing state after the change (`PUBLISH_STATE_XXX`) constants declared on `IServer`
    `restartState` - get the module restart state after the module is restart needed property change event.

Method Detail

### getKind

    public int getKind()

  Returns the kind of the server event.

  This kind can be used to test whether this event is a server event or module event by using the following code (the example is checking for the server event): ((getKind() | SERVER_CHANGE) != 0) the following code (the example is checking for the module event): ((getKind() | MODULE_CHANGE) != 0)

  Returns:
    the kind of the change (`XXX_CHANGE` constants declared on `ServerEvent`

### getModule

    public IModule[] getModule()

  Returns the module tree of the module involved in the module change event, or `null` if the event is not a module event, i.e. isModuleEvent() is false.

  Returns:
    the module tree of the module involved in the module change event, or `null` if the event is not a module event, i.e. isModuleEvent() is false.

### getPublishState

    public int getPublishState()

  Get the publish state after the change that triggers this server event. If this event is of the SERVER_CHANGE kind, then the publishing state is the server publishing state. If this event is of the MODULE_CHANGE kind, then the publishing state is the module publishing state.

  Returns:
    the publishing state after the change (`PUBLISH_STATE_XXX`) constants declared on `IServer`

### getRestartState

    public boolean getRestartState()

  Get the restart state after isRestartNeeded() property change event. If this event is of the SERVER_CHANGE kind, then the restart state is the server restart state. If this event is of the MODULE_CHANGE kind, then the restart state is the module restart state.

  Returns:
    `true` if restart is needed, and `false` otherwise

### getState

    public int getState()

  Get the state after the change that triggers this server event. If this event is of the SERVER_CHANGE kind, then the state is the server state. If this event is of the MODULE_CHANGE kind, then the state is the module state.

  Returns:
    the server state after the change (`STATE_XXX`) constants declared on `IServer`

### getServer

    public IServer getServer()

  Returns the server involved in the change event.

  Returns:
    the server involved in the change event.