Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
OfficeServer | 32 | 0 | - | 0 | 0 | ||
OfficeServer.ServerState | 37 | 2 | 0% | 2 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.officeimporter.server; | |
21 | ||
22 | import org.xwiki.component.annotation.Role; | |
23 | import org.xwiki.officeimporter.converter.OfficeConverter; | |
24 | ||
25 | /** | |
26 | * Component interface for managing the office server connection / process. | |
27 | * | |
28 | * @version $Id: 3bc2eef554acb0dcec903c3a9b3d734e24a74482 $ | |
29 | * @since 5.0M2 | |
30 | */ | |
31 | @Role | |
32 | public interface OfficeServer | |
33 | { | |
34 | /** | |
35 | * Enumeration used to represent the office server state. | |
36 | */ | |
37 | enum ServerState | |
38 | { | |
39 | /** | |
40 | * Connected. | |
41 | */ | |
42 | CONNECTED("Connected"), | |
43 | ||
44 | /** | |
45 | * Not connected. | |
46 | */ | |
47 | NOT_CONNECTED("Not connected"), | |
48 | ||
49 | /** | |
50 | * Configuration error. | |
51 | */ | |
52 | CONF_ERROR("Invalid configuration"), | |
53 | ||
54 | /** | |
55 | * Error. | |
56 | */ | |
57 | ERROR("Error"); | |
58 | ||
59 | /** | |
60 | * Description of current server state. | |
61 | */ | |
62 | private String description; | |
63 | ||
64 | /** | |
65 | * Creates a new instance. | |
66 | * | |
67 | * @param description description of current server state | |
68 | */ | |
69 | 184 | ServerState(String description) |
70 | { | |
71 | 184 | this.description = description; |
72 | } | |
73 | ||
74 | 437 | @Override |
75 | public String toString() | |
76 | { | |
77 | 437 | return this.description; |
78 | } | |
79 | } | |
80 | ||
81 | /** | |
82 | * @return current server state | |
83 | */ | |
84 | ServerState getState(); | |
85 | ||
86 | /** | |
87 | * If an internally managed office server is configured (xwiki.properties), this method will start an office server | |
88 | * process and connect to it. Otherwise this method will try to connect to an external office server instance | |
89 | * configured through xwiki.properties. Calling {@link #start()} on an already started / connected server has no | |
90 | * effect. | |
91 | * | |
92 | * @throws OfficeServerException if the start operation fails | |
93 | */ | |
94 | void start() throws OfficeServerException; | |
95 | ||
96 | /** | |
97 | * If an internally managed office server is configured (xwiki.properties), this method will disconnect from the | |
98 | * office server and terminate the server process. Otherwise this method will simply disconnect from the external | |
99 | * office server. Calling {@link #stop()} on an already stopped / disconnected server has no effect. | |
100 | * | |
101 | * @throws OfficeServerException if stop operation fails | |
102 | */ | |
103 | void stop() throws OfficeServerException; | |
104 | ||
105 | /** | |
106 | * @return {@link OfficeConverter} instance suitable for performing document conversion tasks | |
107 | */ | |
108 | OfficeConverter getConverter(); | |
109 | } |