|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sap.mw.jco.JCO.Connection | +--com.sap.mw.jco.JCO.Server
Encapsulates the basic JCO server functionality. Application programmers will extend this class and at least override the handleRequest() method to implement a specific server. e.g.:
class MyServer extends JCO.Server { // Process incoming requests public void handleRequest(JCO.Function fct) { // Application specific processing goes here } }Depending on the type of middleware layer loaded, the properties recognized by the JCO server may vary.
jco.server.gwhost | Gateway host |
jco.server.gwserv | Gateway service |
jco.server.progid | Program ID of the server |
jco.server.trace | Enable/disable RFC trace (1 or 0) |
jco.server.params | Arbitrary parameters for RFC library |
jco.server.snc_myname | SNC name |
jco.server.snc_qop | SNC level of security, 1 to 9 |
jco.server.snc_lib | Path to the SNC library |
jco.server.unicode | Flags whether to connect in unicode mode (1 or 0) |
jco.server.max_startup_delay | Maximum server startup delay time in seconds |
Field Summary | |
static int |
AUTHORIZATION_MODE_BASIC
Authorization mode basic |
static int |
AUTHORIZATION_MODE_SNC
Authorization mode SNC |
static int |
FUNCTION_MODEL
Call void handleRequest(Function) method on incoming requests |
static int |
REQUEST_RESPONSE_MODEL
Call Response handleRequest(Request) method on incoming requests |
Constructor Summary | |
JCO.Server(java.util.Properties properties)
Creates an instance of a server connection |
|
JCO.Server(java.util.Properties properties,
IRepository repository)
Creates an instance of a server connection |
|
JCO.Server(java.util.Properties properties,
IServerThread thread,
IRepository repository)
Creates an instance of a server connection |
|
JCO.Server(java.lang.String[][] params,
IRepository repository)
Creates an instance of a server using an array to specify the connection parameters. |
|
JCO.Server(java.lang.String[] argv,
IRepository repository)
Creates an instance of a server using an arv array as passed by void main(String[] argv) |
|
JCO.Server(java.lang.String gwhost,
java.lang.String gwserv,
java.lang.String progid,
IRepository repository)
Creates an instance of a server connection |
|
JCO.Server(java.lang.String gwhost,
java.lang.String gwserv,
java.lang.String progid,
IServerThread thread,
IRepository repository)
Creates an instance of a server connection |
Method Summary | |
void |
abort(java.lang.String message)
Aborts the connection to the remote system, i.e. tries to send a final message to the host before it disconnects. |
void |
disconnect()
Closes the connection to the remote system. |
JCO.Attributes |
getAttributes()
Returns the attributes object for this server. |
int |
getCallModel()
Returns the call model which can be either JCO.Server.FUNCTION_MODEL or JCO.Server.REQUEST_RESPONSE_MODEL. |
java.lang.String |
getGWHost()
Returns the gateway server |
java.lang.String |
getGWServ()
Returns the gateway service |
java.lang.String |
getProgID()
Returns the program id |
java.lang.String[][] |
getPropertyInfo()
Returns the property info for the server |
byte |
getState()
Returns the server's state as a bit vector |
java.lang.Thread |
getThread()
Returns the thread this server is running in |
boolean |
getTrace()
Returns whether trace is enabled or not. |
void |
handleRequest(JCO.Function function)
Called after a request for a service has arrived. Derived servers will override this function to actually implement a specific request handling. When this routine exits without any pending exception the output parameters and tables will be sent back to the calling SAP system. |
void |
handleRequest(JCO.Request request,
JCO.Response response)
Called after a request for a service has arrived. Derived servers will override this function to actually implement a specific request handling. When this routine exits without any pending exception the output parameters and tables will be sent back to the calling SAP system. |
boolean |
isAlive()
Checks whether the server is still alive |
boolean |
onCheckTID(java.lang.String tid)
This function will be invoked when a transactional RFC is being called from a SAP system. |
void |
onCommit(java.lang.String tid)
This function will be called after all RFC functions belonging to a certain transaction have been successfully completed. |
void |
onConfirmTID(java.lang.String tid)
This function will be called after the local transaction has been completed. |
void |
onRollback(java.lang.String tid)
This function will be called if an error in one of the RFC functions belonging to a certain transaction has occurred. Derived servers can override this method to locally rollback the transaction. |
void |
run()
Implements the run method from the runnable interface |
void |
setCallModel(int call_model)
Sets the call model which can be either JCO.Server.FUNCTION_MODEL or JCO.Server.REQUEST_RESPONSE_MODEL. |
void |
setTrace(boolean trace)
Enables/disables trace |
void |
start()
Starts or resumes execution of the server thread |
void |
stop()
Forces the server and its underlying thread to stop execution The server can not be restarted after this method has been called. |
void |
suspend()
Forces the server to temporarily stop execution. |
Methods inherited from class com.sap.mw.jco.JCO.Connection |
clone, getProperties, getProperty, getThroughput, isValid, setThroughput |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int AUTHORIZATION_MODE_SNC
public static final int AUTHORIZATION_MODE_BASIC
public static final int FUNCTION_MODEL
public static final int REQUEST_RESPONSE_MODEL
Constructor Detail |
public JCO.Server(java.util.Properties properties)
properties
- the connection parameters passed as a properties objectpublic JCO.Server(java.util.Properties properties, IRepository repository)
properties
- the connection parameters passed as a properties objectrepository
- the repository used by the server to lookup the definitions of an incoming function callpublic JCO.Server(java.util.Properties properties, IServerThread thread, IRepository repository)
properties
- the connection parameters passed as a properties objectthread
- the thread this server is running inrepository
- the repository used by the server to lookup the definitions of an incoming function callpublic JCO.Server(java.lang.String[][] params, IRepository repository)
static String[][] login_params = { { "gwhost" , "bin20" }, { "gwserv" , "gwbin20" }, { "progid" , "PROGRAM01" }, };
params
- the connection parameters as an two-dimemsional arrayrepository
- the repository used by the server to lookup the definitions of an incoming function callpublic JCO.Server(java.lang.String[] argv, IRepository repository)
arv
- the array of argument as passed by void main(String[] argv)repository
- the repository used by the server to lookup the definitions of an incoming function callpublic JCO.Server(java.lang.String gwhost, java.lang.String gwserv, java.lang.String progid, IRepository repository)
gwhost
- the gateway hostgwserv
- the gateway service numberprogid
- the program idrepository
- the repository used by the server to lookup the definitions of an incoming function callpublic JCO.Server(java.lang.String gwhost, java.lang.String gwserv, java.lang.String progid, IServerThread thread, IRepository repository)
gwhost
- the gateway hostgwserv
- the gateway service numberprogid
- the program idthread
- the thread this server is running inrepository
- the repository used by the server to lookup the definitions of an incoming function callMethod Detail |
public final java.lang.String[][] getPropertyInfo()
getPropertyInfo
in class JCO.Connection
public void setCallModel(int call_model)
call_model
- the call model which this server usesgetCallModel()
public int getCallModel()
setCallModel(int)
,
handleRequest(JCO.Function)
,
handleRequest(JCO.Request, JCO.Response)
public byte getState()
Flag | Description |
---|---|
JCO.STATE_STOPPED | The server has been stopped |
JCO.STATE_STARTED | The server has been started |
JCO.STATE_LISTENING | The server is listening for incoming requests |
JCO.STATE_BUSY | The server is currently processing an incoming request |
JCO.STATE_TRANSACTION | The server incoming request is a transaction |
public java.lang.Thread getThread()
public final JCO.Attributes getAttributes()
getAttributes
in class JCO.Connection
JCO.Exception
- thrown if the attributes could not be retrieved.JCO.Attributes
public final java.lang.String getGWHost()
public final java.lang.String getGWServ()
public final java.lang.String getProgID()
public final boolean getTrace()
getTrace
in class JCO.Connection
public final void setTrace(boolean trace)
setTrace
in class JCO.Connection
trace
- if true enables the trace and disables it otherwise.public void disconnect()
disconnect
in class JCO.Connection
public void abort(java.lang.String message)
abort
in class JCO.Connection
message
- the final message which will be sent to the remote system.public void start()
public void stop()
suspend()
public void suspend()
start()
public void run()
run
in interface java.lang.Runnable
public boolean isAlive()
isAlive
in class JCO.Connection
protected void handleRequest(JCO.Function function)
function
- the function that has been called by a remote clientprotected void handleRequest(JCO.Request request, JCO.Response response)
request
- the request container filled with the data from the calling programresponse
- the response container whose contents will be send back to
the calling SAP system.protected boolean onCheckTID(java.lang.String tid)
tid
- the transaction IDprotected void onConfirmTID(java.lang.String tid)
tid
- the transaction IDprotected void onCommit(java.lang.String tid)
tid
- the transaction IDprotected void onRollback(java.lang.String tid)
tid
- the transaction ID
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |