Class OfficeServerScriptService
- java.lang.Object
-
- org.xwiki.officeimporter.server.script.OfficeServerScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("officemanager") @Singleton public class OfficeServerScriptService extends Object implements org.xwiki.script.service.ScriptService
Exposes the office manager APIs to server-side scripts.- Since:
- 4.1M1
- Version:
- $Id: 6af704e73ed6231f7d73e504c15575438c5647c4 $
-
-
Field Summary
Fields Modifier and Type Field Description static String
OFFICE_MANAGER_ERROR
The key used to place any error messages while trying to control the office server instance.
-
Constructor Summary
Constructors Constructor Description OfficeServerScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
displayServerState()
Display the translated state of the server.OfficeServerConfiguration
getConfig()
String
getLastErrorMessage()
String
getServerState()
Deprecated.Since 12.3 this method shouldn't be used anymore: if the goal is to know if the server is connected or not, thenisConnected()
should be used instead.boolean
isConnected()
Determine if the server is connected.boolean
startServer()
Tries to start the office server process.boolean
stopServer()
Tries to stop the office server process.
-
-
-
Field Detail
-
OFFICE_MANAGER_ERROR
public static final String OFFICE_MANAGER_ERROR
The key used to place any error messages while trying to control the office server instance.- See Also:
- Constant Field Values
-
-
Method Detail
-
startServer
public boolean startServer()
Tries to start the office server process.- Returns:
- true if the operation succeeds, false otherwise
-
stopServer
public boolean stopServer()
Tries to stop the office server process.- Returns:
- true if the operation succeeds, false otherwise
-
isConnected
public boolean isConnected()
Determine if the server is connected. This method should be used as a check whenever to activate a feature that needs Office Server.- Returns:
true
iff the server state is connected.- Since:
- 12.3, 11.10.5
-
displayServerState
public String displayServerState()
Display the translated state of the server. This should only be used in the administration to have a precise view on the state. For other usages,isConnected()
should be used.- Returns:
- a translated string describing the server state.
- Since:
- 12.3, 11.10.5
-
getServerState
@Deprecated public String getServerState()
Deprecated.Since 12.3 this method shouldn't be used anymore: if the goal is to know if the server is connected or not, thenisConnected()
should be used instead. If the goal is to display the state of the server thendisplayServerState()
should be used.- Returns:
- current status of the office server process as a string
-
getConfig
public OfficeServerConfiguration getConfig()
- Returns:
- the office server configuration
-
getLastErrorMessage
public String getLastErrorMessage()
- Returns:
- any error messages encountered
-
-