01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.server;
07:
08: import java.sql.SQLException;
09:
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: */
23: void init(String[] args) throws Exception;
24:
25: /**
26: * Get the URL of this service in a human readable form
27: *
28: * @return the url
29: */
30: String getURL();
31:
32: /**
33: * Start the service. This usually means create the server socket.
34: * This method must not block.
35: */
36: void start() throws SQLException;
37:
38: /**
39: * Listen for incoming connections.
40: * This method blocks.
41: */
42: void listen();
43:
44: /**
45: * Stop the service.
46: */
47: void stop();
48:
49: /**
50: * Check if the service is running.
51: *
52: * @return if the server is running
53: */
54: boolean isRunning();
55:
56: /**
57: * Check if remote connections are allowed.
58: *
59: * @return true if remote connections are allowed
60: */
61: boolean getAllowOthers();
62:
63: /**
64: * Get the human readable name of the service.
65: *
66: * @return the name
67: */
68: String getName();
69:
70: /**
71: * Get the human readable short name of the service.
72: *
73: * @return the type
74: */
75: String getType();
76: }
|