01: package org.jgroups;
02:
03: import java.io.InputStream;
04: import java.io.OutputStream;
05:
06: /**
07: *
08: * <code>ExtendedMessageListener</code> has additional callbacks for:
09: * <ul>
10: * <li>partial state transfer - http://jira.jboss.com/jira/browse/JGRP-118
11: * <li>streaming state transfer - http://jira.jboss.com/jira/browse/JGRP-89
12: * </ul>
13: * <p>
14: * Application channels interested in using streaming state transfer, beside
15: * implementing this interface, have to be configured with
16: * <code>STREAMING_STATE_TRANSFER</code> protocol rather than the default
17: * <code>STATE_TRANSFER</code> protocol.
18: *
19: * <p>
20: * Note:
21: * <p>
22: * This interface will be merged with MessageListener in 3.0 (API changes)
23: *
24: * @author Bela Ban
25: * @author Vladimir Blagojevic
26: * @see org.jgroups.JChannel#getState(Address, long)
27: * @see org.jgroups.JChannel#getState(Address, String, long)
28: * @since 2.3
29: *
30: * @version $Id: ExtendedMessageListener.java,v 1.4 2006/07/28 07:14:33 belaban Exp $
31: */
32: public interface ExtendedMessageListener extends MessageListener {
33:
34: /**
35: * Allows an application to provide a partial state as a byte array
36: *
37: * @param state_id id of the partial state requested
38: * @return partial state for the given state_id
39: */
40: public byte[] getState(String state_id);
41:
42: /**
43: * Allows an application to read a partial state indicated by state_id from
44: * a given state byte array parameter.
45: *
46: * @param state_id id of the partial state requested
47: * @param state partial state for the given state_id
48: */
49: public void setState(String state_id, byte[] state);
50:
51: /**
52: * Allows an application to write a state through a provided OutputStream.
53: * An application is obligated to always close the given OutputStream reference.
54: *
55: * @param ostream the OutputStream
56: * @see OutputStream#close()
57: */
58: public void getState(OutputStream ostream);
59:
60: /**
61: * Allows an application to write a partial state through a provided OutputStream.
62: * An application is obligated to always close the given OutputStream reference.
63: *
64: * @param state_id id of the partial state requested
65: * @param ostream the OutputStream
66: *
67: * @see OutputStream#close()
68: */
69: public void getState(String state_id, OutputStream ostream);
70:
71: /**
72: * Allows an application to read a state through a provided InputStream.
73: * An application is obligated to always close the given InputStream reference.
74: *
75: * @param istream the InputStream
76: * @see InputStream#close()
77: */
78: public void setState(InputStream istream);
79:
80: /**
81: * Allows an application to read a partial state through a provided InputStream.
82: * An application is obligated to always close the given InputStream reference.
83: *
84: * @param state_id id of the partial state requested
85: * @param istream the InputStream
86: *
87: * @see InputStream#close()
88: */
89: public void setState(String state_id, InputStream istream);
90: }
|