Debian Codegraph @

src/main/org/h2/server/Service.java

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