Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7f8a02d4e116c6768efb14cbc122307285c26537 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jem.internal.proxy.core;
/*


 */

import java.io.InputStream;

/**
 * Users will create a callback of this interface
 * and register it with the factory. Then when ever
 * the callback occurs, this callback will be called
 * with data from the proxy. It can return a value too.
 *
 * Or an InputStream can be returned to supply the data.
 *  
 * @since 1.0.0
 */
public interface ICallback {

	/**
	 * This is the entry point of the callback.
	 * It will be called whenever the callback
	 * occurred. It will be on its own thread.
	 * A particular thread cannot be requested.
	 * <p>
	 * The implementation MUST return. This is 
	 * because the callback will not be completed
	 * until it is returned, and the process will
	 * not continue on the remote vm until it is
	 * returned.
	 * <p>
	 * The value returned must either be an
	 * IBeanProxy or IBeanProxy[]. It is typed
	 * to Object to allow either one, but it
	 * will be checked, and if it isn't, then
	 * null will be returned instead to the
	 * caller.
	 * 
	 * @param msgID
	 * @param parm The beanproxy - will not be null
	 * @return
	 * 
	 * @since 1.0.0
	 */
	public Object calledBack(int msgID, IBeanProxy parm);

	/**
	 * This is the entry point of the callback.
	 * It will be called whenever the callback
	 * occurred. It will be on its own thread.
	 * A particular thread cannot be requested.
	 * <p>
	 * The parms will be an array of IBeanProxys,
	 * or an entry could be another array of IBeanProxys,
	 * or null if null was sent to callBackWithParms.
	 * The final component of any entry will be an
	 * IBeanProxy. It is up to the developers to
	 * agree on the format of the parms.
	 * <p>
	 * The implementation MUST return. This is 
	 * because the callback will not be completed
	 * until it is returned, and the process will
	 * not continue on the remote vm until it is
	 * returned.
	 * <p>
	 * The value returned must either be an
	 * IBeanProxy or IBeanProxy[]. It is typed
	 * to Object to allow either one, but it
	 * will be checked, and if it isn't, then
	 * null will be returned instead to the
	 * caller.
	 * 
	 * @param msgID
	 * @param parms
	 * @return
	 * 
	 * @see org.eclipse.jem.internal.proxy.common.ICallbackHandler#callbackWithParms(int, int, Object[])
	 * @since 1.0.0
	 */
	public Object calledBack(int msgID, Object[] parms);
	
	/**
	 * This is the entry point of the callback.
	 * It will be called whenever the callback
	 * occurred. It will be on its own thread.
	 * A particular thread cannot be requested.
	 * <p>
	 * The parm will be an object. This occurs
	 * if remote vm just wanted to send some objects.
	 * They will not be proxies. It is recommended
	 * that this be used only for small items. For
	 * anything large, the callbackStream should be
	 * used instead.
	 * <p>
	 * The implementation MUST return. This is 
	 * because the callback will not be completed
	 * until it is returned, and the process will
	 * not continue on the remote vm until it is
	 * returned.
	 * <p>
	 * The value returned must either be an
	 * IBeanProxy or IBeanProxy[]. It is typed
	 * to Object to allow either one, but it
	 * will be checked, and if it isn't, then
	 * null will be returned instead to the
	 * caller.
	 * 
	 * @param msgID
	 * @param parm The parm or <code>null</code> if null was sent.
	 * @return
	 * 
	 * @see ICallback#calledBackStream(int, InputStream)
	 * @since 1.0.0
	 */
	public Object calledBack(int msgID, Object parm);

	/**
	 * This is the entry point of the callback.
	 * It will be called whenever the callback stream
	 * occurred. It will be on its own thread.
	 * A particular thread cannot be requested.
	 * <p>
	 * The callback should continue to read from the InputStream
	 * until it returns -1 indicating no more data. The stream can
	 * be closed. In that case the next time the remote vm wants to
	 * send data it will first check that the stream has not been closed.
	 * If it has, it will raise an exception on that side.
	 * <p>
	 * The implementation MUST return. This is 
	 * because the callback will not be completed
	 * until it is returned, and the process will
	 * not continue on the remote vm until it is
	 * returned.
	 * 
	 * @param msgID
	 * @param is
	 * 
	 * @since 1.0.0
	 */
	public void calledBackStream(int msgID, InputStream is);	
}

Back to the top