Starting Server From a Program

Class jet.server.ServerThread

java.lang.Object
|
+----jet.server.ServerThread

public class ServerThread
extends Object

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.

 o ServerThread()

Constructs a server thread.

 o getPropValue(String, boolean)

Gets a property value as boolean type.

 o getPropValue(String, int)

Gets a property value as integer type.

 o getPropValue(String, String)

Gets a property value as String type.

 o hasProp(String)

Tests if there is a property which exists.

 o init()

Initializes the server.

 o isStarted()

 o main(String[])

 o removeProp(String)

Removes a property for the server.

 o setProp(String, String)

Sets a property for the server.

 o shutdown()

Shuts down the server.  All the resouces held by the server will be released.

 o start()

Launches the server thread.

 o stop()

Stops the server thread.

กก

 o ServerThread
public ServerThread()

Constructs a server thread.

 o 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

 o getPropValue


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.

 o getPropValue


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.

 o getPropValue


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.

 o setProp


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

 o removeProp


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.

 o init


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.

 o isStarted


public boolean isStarted()

Returns:
true if the server has started

 o start


public void start() throws IOException

Launches the server thread.  Before calling this method, init() should be called first.
Throws: IOException if start up fails.

 o stop


public void stop() throws IOException

Stops the server thread.  You can use start to restart the server.

 o shutdown


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.

 o main


public static void main(String args[]) throws IOException