Package com.ibm.di.eclipse.http
Class ServerAPI
- java.lang.Object
-
- com.ibm.di.eclipse.http.ServerAPI
-
- All Implemented Interfaces:
java.lang.Runnable
public class ServerAPI extends java.lang.Object implements java.lang.Runnable
This class provides a REST based interface to IBM Tivoli Directory Integrator's server api as well as a few other services the server api currently does not provide. Validation is performed by the local server api (e.g. APIEngine.getLocalSession()) and any username/passwords passed in the request is forwarded to the local server api.The HTTPServerConnector is used to handle connections. All commands are delegated to a java class named after the command. A command of "status" will result in attempt to instantiate "com.ibm.di.eclipse.http.commands.StatusCommand". If no such class exists an attempt is made to execute a script
This class is not intended to be used by other clients than the IBM Tivoli Directory Integrator configuration editor. It's functions and services are considered internal use only.
-
-
Field Summary
Fields Modifier and Type Field Description static int
PORT
static java.lang.String
PROP_REST_ON
static java.lang.String
PROP_REST_PORT
static java.lang.String
PROP_REST_SSL
-
Constructor Summary
Constructors Constructor Description ServerAPI()
Initializes this object with the default port (1098)ServerAPI(int port, boolean ssl)
Initializes this object with the provided port number.ServerAPI(HTTPServerConnector conn)
Initializes this object with an established connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPendingCommand(java.lang.String url, RestCommand obj)
Adds a command to be retrieved by a subsequent URL request.void
debugMsg(java.lang.String string)
HTTPServerConnector
getConn()
RestCommand
getPendingCommand(java.lang.String name)
This method returns a pending RestCommand.Entry
getRequest()
Session
getSession()
boolean
isDebugOn()
Returns true if debug level logging is enabledvoid
logmsg(java.lang.String string)
void
run()
java.lang.Thread
start()
Creates a thread to run this object.
-
-
-
Field Detail
-
PROP_REST_ON
public static final java.lang.String PROP_REST_ON
- See Also:
- Constant Field Values
-
PROP_REST_PORT
public static final java.lang.String PROP_REST_PORT
- See Also:
- Constant Field Values
-
PROP_REST_SSL
public static final java.lang.String PROP_REST_SSL
- See Also:
- Constant Field Values
-
PORT
public static final int PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerAPI
public ServerAPI() throws java.lang.Exception
Initializes this object with the default port (1098)- Throws:
java.lang.Exception
-
ServerAPI
public ServerAPI(int port, boolean ssl) throws java.lang.Exception
Initializes this object with the provided port number.- Parameters:
port
- The TCP port number for incoming connections- Throws:
java.lang.Exception
-
ServerAPI
public ServerAPI(HTTPServerConnector conn) throws java.lang.Exception
Initializes this object with an established connection.- Parameters:
conn
- HTTPServerConnector instance- Throws:
java.lang.Exception
-
-
Method Detail
-
start
public java.lang.Thread start()
Creates a thread to run this object.- Returns:
- The thread
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
logmsg
public void logmsg(java.lang.String string)
-
debugMsg
public void debugMsg(java.lang.String string)
-
getConn
public HTTPServerConnector getConn()
-
getSession
public Session getSession()
-
getRequest
public Entry getRequest()
-
addPendingCommand
public void addPendingCommand(java.lang.String url, RestCommand obj)
Adds a command to be retrieved by a subsequent URL request.- Parameters:
url
- The name of the commandobj
- The value for the command
-
getPendingCommand
public RestCommand getPendingCommand(java.lang.String name)
This method returns a pending RestCommand. The object is removed upon retrieval.- Parameters:
name
- The name of the command to retrieve and remove.- Returns:
- The value for the removed command.
-
isDebugOn
public boolean isDebugOn()
Returns true if debug level logging is enabled- Returns:
- debug logging on/off
-
-