Source code: mucode/GroupHandler.java
1 /* mucode - A lightweight and flexible mobile code toolkit
2 * Copyright (C) 2000, Gian Pietro Picco
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 package mucode;
19
20 /** Classes implementing this interface can access a group before its content
21 * is installed on the receiving <i>µ</i>Server. A requirement for the
22 * classes implementing this interface is that they must:
23 *
24 * <OL>
25 * <LI> be declared as <code>public</code>, and
26 * <LI> implement a public, parameterless constructor.
27 * </ol>
28 *
29 * @author <a href="mailto:picco@elet.polimi.it">Gian Pietro Picco</a>
30 * @version 1.0
31 *
32 * @see Group
33 * @see MuServer */
34 public interface GroupHandler {
35 /** This method is called automatically by the <i>µ</i>Server that
36 * receives the group specified as a parameter. At this point, the
37 * <i>µ</i>Server has already inserted in the private class space
38 * associated with the group all the classes that came with it. <br>
39 *
40 * Access to the <i>µ</i>Server (e.g., to retrieve the private class
41 * space associated with the group) can be obtained by invoking the method
42 * {@link mucode.Group#getServer() getServer()} on the group. <br>
43 *
44 * Typical implementations of this method will use the content of the group
45 * to create a new object that can be used to start a new thread in the
46 * <i>µ</i>Server. Such thread object is passed to the
47 * <i>µ</i>Server as a return value of this method. if the
48 * implementation of the method does not need to spawn any thread,
49 * <code>null</code> should be returned.
50 *
51 * @exception MuCodeException may be thrown within the method to signal
52 * abnormal conditions, and can contain nested exceptions.
53 *
54 * @param group the group to be handled. It is passed to the method directly
55 * by the <i>µ</i>Server that received the group.
56 *
57 * @return a <code>Thread</code> object, that will be used by the
58 * <code>MuServer</code> to spawn a new thread of execution. If no such
59 * object is generated within the implementation of this method,
60 * <code>null</code> should be returned. */
61 public Thread unpack(Group group) throws MuCodeException;
62 }
63
64