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

domino.java.ServiceWatcherEvent Maven / Gradle / Ivy

There is a newer version: 0.3.1
Show newest version
package domino.java;

/**
 * A Service watcher events.
 * 
 * The possible events types are defined by {@link EventType} an can be
 * retrieved via {@link #eventType()}.
 * 
 * @param service
 *            Service affected by the state transition.
 * @param context
 *            Additional event data.
 */
public class ServiceWatcherEvent {

	/**
	 * Contains the possible service watcher event types.
	 */
	public static enum EventType {
		/** A service is being added to the ServiceTracker. */
		ADDING,
		/** A service tracked by the ServiceTracker has been modified. */
		MODIFIED,
		/** A service tracked by the ServiceTracker has been removed. */
		REMOVED;
	}

	private final S service;
	private final ServiceWatcherContext context;
	private final EventType eventType;

	public ServiceWatcherEvent(
			final S service,
			final ServiceWatcherContext context,
			final EventType eventType) {
		this.service = service;
		this.context = context;
		this.eventType = eventType;
	}

	public S service() {
		return service;
	}

	public ServiceWatcherContext context() {
		return context;
	}

	public EventType eventType() {
		return eventType;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() +
				"(service=" + service +
				",context=" + context +
				",eventType=" + eventType +
				")";
	}

}