org.dvb.application.AppStateChangeEvent Maven / Gradle / Ivy
package org.dvb.application;
import java.util.*;
/**
* 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
*/
public class AppStateChangeEvent extends EventObject {
/**
* Create an AppStateChangeEvent object.
*
* @param appid a registry entry representing the tracked application
* @param 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
* @param 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
* @param hasFailed an indication of whether the transition failed (true) or succeeded (false)
* @param source the AppProxy
where the state transition happened
*/
public AppStateChangeEvent(AppID appid, int fromstate, int tostate, Object source, boolean hasFailed) {
super (source) ;
}
/**
* The application the listener was tracking has made a state
* transition from fromState
to toState
.
*
* @return a registry entry representing the tracked application
* @since MHP1.0
*/
public AppID getAppID () {
return null ;
}
/**
* 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.
*
* @return the old state
* @since MHP1.0
*/
public int getFromState () {
return 0 ;
}
/**
* 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.
* @return the intended or actual new state
* @since MHP1.0
*/
public int getToState () {
return 0 ;
}
/**
* This method determines whether an attempt to change the state of an application
* has failed.
*
* @return true if the attempt to change the state of the application failed, false otherwise
* @since MHP1.0
*/
public boolean hasFailed () {
return false ;
}
}