All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.refcodes.component.ext.observer.LifeCycleObserver Maven / Gradle / Ivy

Go to download

Artifact for providing event based extended functionality for the refcodes-component artifact.

There is a newer version: 1.0.4
Show newest version
// /////////////////////////////////////////////////////////////////////////////
// REFCODES.ORG
// =============================================================================
// This code is copyright (c) by Siegfried Steiner, Munich, Germany and licensed
// under the following (see "http://en.wikipedia.org/wiki/Multi-licensing")
// licenses:
// =============================================================================
// GNU General Public License, v3.0 ("http://www.gnu.org/licenses/gpl-3.0.html")
// together with the GPL linking exception applied; as being applied by the GNU
// Classpath ("http://www.gnu.org/software/classpath/license.html")
// =============================================================================
// Apache License, v2.0 ("http://www.apache.org/licenses/LICENSE-2.0")
// =============================================================================
// Please contact the copyright holding author(s) of the software artifacts in
// question for licensing issues not being covered by the above listed licenses,
// also regarding commercial licensing models or regarding the compatibility
// with other open source licenses.
// /////////////////////////////////////////////////////////////////////////////

package org.refcodes.component.ext.observer;

import org.refcodes.component.ext.observer.LifeCycleEvent.LifeCycleRequestEvent;
import org.refcodes.exception.VetoException;
import org.refcodes.observer.Observer;

/**
 * A listener for listening to {@link LifeCycleEvent} instances.
 */
public interface LifeCycleObserver extends Observer {

	// /////////////////////////////////////////////////////////////////////////
	// CONVENIANCE METHODS:
	// /////////////////////////////////////////////////////////////////////////

	/**
	 * In case a component is to be initialized, then the
	 * {@link InitializedEvent} event is fired.
	 * 
	 * @param aEvent The according {@link InitializedEvent}.
	 */
	public void onInitialized( InitializedEvent aEvent );

	/**
	 * In case a component is to be initialized, then the {@link StartedEvent}
	 * event is fired.
	 * 
	 * @param aEvent The according {@link StartedEvent}.
	 */
	public void onStarted( StartedEvent aEvent );

	/**
	 * In case a component is to be initialized, then the {@link ResumedEvent}
	 * event is fired.
	 * 
	 * @param aEvent The according {@link ResumedEvent}.
	 */
	public void onResumed( ResumedEvent aEvent );

	/**
	 * In case a component is to be initialized, then the {@link StartedEvent}
	 * event is fired.
	 * 
	 * @param aEvent The according {@link StartedEvent}.
	 */
	public void onPaused( PausedEvent aEvent );

	/**
	 * In case a component is to be initialized, then the {@link StoppedEvent}
	 * event is fired.
	 * 
	 * @param aEvent The according {@link StoppedEvent}.
	 */
	public void onStopped( StoppedEvent aEvent );

	/**
	 * In case a component is to be initialized, then the {@link DesrtroyEvent}
	 * event is fired.
	 * 
	 * @param aEvent The according {@link SestroyEvent}.
	 */
	public void onDestroyed( DestroyedEvent aEvent );

	/**
	 * A listener for listening to {@link LifeCycleRequestEvent} instances.
	 */
	public interface LifeCycleRequestObserver extends LifeCycleObserver {

		// /////////////////////////////////////////////////////////////////////////
		// CONVENIANCE METHODS:
		// /////////////////////////////////////////////////////////////////////////

		/**
		 * In case a component is to be initialized, then the
		 * {@link InitializedEvent} event is fired.
		 * 
		 * @param aEvent The according {@link InitializedEvent}.
		 * 
		 * @throws VetoException thrown to signal that an operation is being
		 *         vetoed by a third party observing the invocation of the given
		 *         operation.
		 */
		public void onInitialize( InitializeEvent aEvent ) throws VetoException;

		/**
		 * In case a component is to be initialized, then the {@link StartEvent}
		 * event is fired.
		 * 
		 * @param aEvent The according {@link StartEvent}.
		 * 
		 * @throws VetoException thrown to signal that an operation is being
		 *         vetoed by a third party observing the invocation of the given
		 *         operation.
		 */
		public void onStart( StartEvent aEvent ) throws VetoException;;

		/**
		 * In case a component is to be initialized, then the
		 * {@link ResumeEvent} event is fired.
		 * 
		 * @param aEvent The according {@link ResumeEvent}.
		 * 
		 * @throws VetoException thrown to signal that an operation is being
		 *         vetoed by a third party observing the invocation of the given
		 *         operation.
		 */
		public void onResume( ResumeEvent aEvent ) throws VetoException;;

		/**
		 * In case a component is to be initialized, then the {@link PauseEvent}
		 * event is fired.
		 * 
		 * @param aEvent The according {@link PauseEvent}.
		 * 
		 * @throws VetoException thrown to signal that an operation is being
		 *         vetoed by a third party observing the invocation of the given
		 *         operation.
		 */
		public void onPause( PauseEvent aEvent ) throws VetoException;

		/**
		 * In case a component is to be initialized, then the {@link StopEvent}
		 * event is fired.
		 * 
		 * @param aEvent The according {@link StopEvent}.
		 * 
		 * @throws VetoException thrown to signal that an operation is being
		 *         vetoed by a third party observing the invocation of the given
		 *         operation.
		 */
		public void onStop( StopEvent aEvent ) throws VetoException;;

		/**
		 * In case a component is to be initialized, then the
		 * {@link DesrtroyEvent} event is fired.
		 * 
		 * @param aEvent The according {@link DestroyEvent}.
		 * 
		 * @throws VetoException thrown to signal that an operation is being
		 *         vetoed by a third party observing the invocation of the given
		 *         operation.
		 */
		// This method must not be vetoed:
		// public void onDestroy( DestroyEvent aEvent ) throws VetoException;;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy