1// BEGIN LICENSE BLOCK 2// Version: CMPL 1.1 3// 4// The contents of this file are subject to the Cisco-style Mozilla Public 5// License Version 1.1 (the "License"); you may not use this file except 6// in compliance with the License. You may obtain a copy of the License 7// at www.eclipse-clp.org/license. 8// 9// Software distributed under the License is distributed on an "AS IS" 10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11// the License for the specific language governing rights and limitations 12// under the License. 13// 14// The Original Code is The ECLiPSe Constraint Logic Programming System. 15// The Initial Developer of the Original Code is Cisco Systems, Inc. 16// Portions created by the Initial Developer are 17// Copyright (C) 2000 - 2006 Cisco Systems, Inc. All Rights Reserved. 18// 19// Contributor(s): Stefano Novello / Josh Singer, Parc Technologies 20// 21// END LICENSE BLOCK 22 23//Title: Java/ECLiPSe interface 24//Version: $Id: QueueListener.java,v 1.1 2006/09/23 01:54:11 snovello Exp $ 25//Author: Josh Singer / Stefano Novello 26//Company: Parc Technologies 27//Description: Interface for queue handlers. 28package com.parctechnologies.eclipse; 29 30/** 31 * Interface for handlers of incoming data or data requests on queues. 32 * Any object which implements <i>QueueListener</i> can be 33 * attached to a {@link FromEclipseQueue} or a {@link ToEclipseQueue} using the 34 * <code>setListener()</code> methods of those classes.<p> 35 * If attached to a <i>FromEclipseQueue</i>, when ECLiPSe 36 * flushes the queue, 37 * the <code>dataAvailable()</code> method is called with the flushed FromEclipseQueue as the 38 * <code>source</code> parameter.<p> 39 * If attached to a <i>ToEclipseQueue</i>, when ECLiPSe 40 * tries to read data from that queue and it is empty, 41 * the <code>dataRequest()</code> method is called with the ToEclipseQueue as the 42 * <code>source</code> parameter. 43 */ 44public interface QueueListener 45{ 46 /** 47 * Called with <i>FromEclipseQueue</i> as <code>source</code> when the 48 * <i>QueueListener</i> is attached and ECLiPSe flushes the queue. If used 49 * with an instance of <i>RemoteEclipse</i>, the <code>resume()</code> 50 * method should not be invoked during <code>dataAvailable()</code>. 51 */ 52 public void dataAvailable(Object source); 53 54 /** 55 * Called with <i>ToEclipseQueue</i> as <code>source</code> when the 56 * <i>QueueListener</i> is attached and ECLiPSe tries to read data from 57 * the queue when it is empty. If used 58 * with an instance of <i>RemoteEclipse</i>, the <code>resume()</code> 59 * method should not be invoked during <code>dataRequest()</code>. 60 */ 61 public void dataRequest(Object source); 62} 63