org.dvb.application
Class AppStateChangeEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.dvb.application.AppStateChangeEvent
All Implemented Interfaces:
java.io.Serializable

public class AppStateChangeEvent
extends java.util.EventObject

The AppStateChangeEvent class indicates a state transition of the application. These events are only generated for running applications or for non-running applications where an attempt to control the application fails. If the state transition was requested by an application through this API, the method hasFailed indicates whether the state change failed or not. Where a state change succeeds, fromState and toState shall indicate the original and destination state of the transition. If it failed, fromState shall return the state the application was in before the state transition was requested and the toState method shall return the state the application would have been in if the state transition had succeeded.

Attempting to start an application which is already in the active state shall fail and generate an AppStateChangeEvent with hasFailed returning true and both fromstate and tostate being STARTED.

Since:
MHP1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
AppStateChangeEvent(AppID appid, int fromstate, int tostate, java.lang.Object source, boolean hasFailed)
          Create an AppStateChangeEvent object.
 
Method Summary
 AppID getAppID()
          The application the listener was tracking has made a state transition from fromState to toState.
 int getFromState()
          The application the listener is tracking was infromState, where the value of fromState is one of the state values defined in the AppProxy interface or in the interfaces inheriting from it.
 int getToState()
          If the hasFailed method returns false, then the application the listener is tracking is now in toState.
 boolean hasFailed()
          This method determines whether an attempt to change the state of an application has failed.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppStateChangeEvent

public AppStateChangeEvent(AppID appid,
                           int fromstate,
                           int tostate,
                           java.lang.Object source,
                           boolean hasFailed)
Create an AppStateChangeEvent object.

Parameters:
appid - a registry entry representing the tracked application
fromstate - the state the application was in before the state transition was requested, where the value of fromState is one of the state values defined in the AppProxy interface or in the interfaces inheriting from it
tostate - state the application would be in if the state transition succeeds, where the value of toState is one of the state values defined in the AppProxy interface or in the interfaces inheriting from it
hasFailed - an indication of whether the transition failed (true) or succeeded (false)
source - the AppProxy where the state transition happened
Method Detail

getAppID

public AppID getAppID()
The application the listener was tracking has made a state transition from fromState to toState.

Returns:
a registry entry representing the tracked application
Since:
MHP1.0

getFromState

public int getFromState()
The application the listener is tracking was infromState, where the value of fromState is one of the state values defined in the AppProxy interface or in the interfaces inheriting from it.

Returns:
the old state
Since:
MHP1.0

getToState

public int getToState()
If the hasFailed method returns false, then the application the listener is tracking is now in toState. If the hasFailed method returns true, then the toState is the state where the state transition was attempted to but the transition failed. The value of toState is one of the state values defined in the AppProxy interface or in the interfaces inheriting from it.

Returns:
the intended or actual new state
Since:
MHP1.0

hasFailed

public boolean hasFailed()
This method determines whether an attempt to change the state of an application has failed.

Returns:
true if the attempt to change the state of the application failed, false otherwise
Since:
MHP1.0