Starting Server From a Program
java.lang.Object
|
+----jet.server.ServerThread
This class represents the external interface for JReport Server.
init() : to initialize the server.
start() : to start the server.
stop() : to stop the server.
shutdown() : to shutdown the server.
All the properties used by the server can be found in the file " server.properties ". This file is located at the <reporthome> path. This is an "automatic-file". I.e., if it does not exist, it will be generated by the server automatically.
getPropValue() : to get property value of the server.
setProp() : to set property of the server.
removeProp() : to remove a property of the server.
Constructs a server thread.
getPropValue(String,
boolean)
Gets a property value as boolean type.
getPropValue(String, int)
Gets a property value as integer type.
getPropValue(String,
String)
Gets a property value as String type.
hasProp(String)
Tests if there is a property which exists.
init()
Initializes the server.
main(String[])
removeProp(String)
Removes a property for the server.
setProp(String, String)
Sets a property for the server.
shutdown()
Shuts down the server. All the resouces held by the server will be released.
start()
Launches the server thread.
stop()
Stops the server thread.
กก
ServerThread
public ServerThread()
Constructs a server thread.
hasProp
public boolean hasProp(String propName)
Tests if there is a property which exists
Parameters:
propName - the name of the property
Returns:
true if exists
public String getPropValue(String propName, String defValue)
Gets a property value as String type. If the property cannot be loaded, the defValue will be returned.
Parameters:
propName - the name of the property
defValue - if the property does not exist, the defValue will be returned.
Returns:
the value of the property, if the property does not exist, the defValue will be returned.
public boolean getPropValue(String propName, boolean defValue)
Gets a property value as boolean type. If the property cannot be loaded, the defValue will be returned.
Parameters:
propName - the name of the property
defValue - if the property does not exist, the defValue will be returned.
Returns:
the value of the property, if the property does not exist, the defValue will be returned.
public int getPropValue(String propName,int defValue)
Gets a property value as integer type. If the property cannot be loaded, the defValue will be returned.
Parameters:
propName - the name of the property
defValue - if the property does not exist, the defValue will be returned.
Returns:
the value of the property, if the property does not exist, the defValue will be returned.
public void setProp(String propName,String value)
Sets a property for the server. The sever needs to be restarded to enable the modification of it.
Parameters:
propName - the name of the property will be set.
value - the value of the property
public void removeProp(String propName)
Removes a property from the server. The sever needs to be restarted to enable the modification of it.
Parameters:
propName - the name of the property will be removed.
public void init() throws IOException
Initializes the server. This method should be called for only one time. Only the first call of the method takes effect.
Throws: IOException if init fails.
public boolean isStarted()
Returns:
true if the server has started
public void start() throws IOException
Launches the server thread. Before calling this method, init() should be called first.
Throws: IOException if start up fails.
public void stop() throws IOException
Stops the server thread. You can use start to restart the server.
public void shutdown() throws IOException
Shuts down the server. All the resouces held by the server will be released, If you want to start the server after shutdown, you should call init() again.
public static void main(String args[]) throws IOException