File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\server\Service.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.server;
8
9 import java.sql.SQLException;
10
11 /**
12 * Classes implementing this interface usually provide a
13 * TCP/IP listener such as an FTP server.
14 * The can be started and stopped, and may or may not
15 * allow remote connections.
16 */
17 public interface Service {
18
19 /**
20 * Initialize the service from command line options.
21 *
22 * @param args the command line options
23 */
24 void init(String... args) throws Exception;
25
26 /**
27 * Get the URL of this service in a human readable form
28 *
29 * @return the url
30 */
31 String getURL();
32
33 /**
34 * Start the service. This usually means create the server socket.
35 * This method must not block.
36 */
37 void start() throws SQLException;
38
39 /**
40 * Listen for incoming connections.
41 * This method blocks.
42 */
43 void listen();
44
45 /**
46 * Stop the service.
47 */
48 void stop();
49
50 /**
51 * Check if the service is running.
52 *
53 * @param traceError if errors should be written
54 * @return if the server is running
55 */
56 boolean isRunning(boolean traceError);
57
58 /**
59 * Check if remote connections are allowed.
60 *
61 * @return true if remote connections are allowed
62 */
63 boolean getAllowOthers();
64
65 /**
66 * Get the human readable name of the service.
67 *
68 * @return the name
69 */
70 String getName();
71
72 /**
73 * Get the human readable short name of the service.
74 *
75 * @return the type
76 */
77 String getType();
78
79 /**
80 * Gets the port this service is listening on.
81 *
82 * @return the port
83 */
84 int getPort();
85
86 /**
87 * Check if a daemon thread should be used.
88 *
89 * @return true if a daemon thread should be used
90 */
91 boolean isDaemon();
92
93 }
94