01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
14:
15: package org.quickserver.net;
16:
17: /**
18: * This interface is for any class that would like to follow
19: * Service Configurator Pattern.
20: * <p>
21: * Thanks to Markus Elfring for his email.
22: * </p>
23: * @author Akshathkumar Shetty
24: * @since 1.2
25: */
26: public interface Service {
27: /** Un initialised or unknown */
28: public static int UNKNOWN = -1;
29: public static int STOPPED = 0;
30: public static int INIT = 1;
31: public static int SUSPENDED = 2;
32: public static int RUNNING = 5;
33:
34: /** Initialise and create the service */
35: public boolean initService(Object config[]);
36:
37: /**Start the service */
38: public boolean startService();
39:
40: /** Stop the service */
41: public boolean stopService();
42:
43: /** Suspend the service */
44: public boolean suspendService(); //Sets max_client =0;
45:
46: /** Resume the service */
47: public boolean resumeService(); //Set max_client back to its value
48:
49: /**
50: * Information about the service, recommended format given below.
51: * <p><code>
52: * <<ServiceName>> v<<Version_No>>\n<br>
53: * <<IP_ADDRESS>> <<PORT_NO>>\n<br>
54: * <<ANY OTHET INFORMATION>>
55: * </code></p>
56: */
57: public String info();
58:
59: /**
60: * Returns the state of the process
61: * As any constant of {@link Service} interface.
62: */
63: public int getServiceState();
64:
65: /**
66: * Returns service error if any.
67: * @since 1.4.7
68: */
69: public Throwable getServiceError();
70: }
|