|
SAP NetWeaver 2004S SPS 10 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.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) {
try {
// Application specific processing goes here
}
catch(JCO.AbapException ex) {
throw ex;
}
catch(Throwable t) {
throw new JCO.AbapException("SYSTEM_FAILURE", t.getMessage());
}
}
}
| jco.server.gwhost | Gateway host |
| jco.server.gwserv | Gateway service (usually sapgwNN) |
| 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 |
| jco.server.dsr | Enable/Disable dsr support (0 or 1) |
| 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 |
protected com.sap.mw.jco.IMiddleware.IServer |
m_middleware
|
static int |
REQUEST_RESPONSE_MODEL
Call Response handleRequest(Request) method on incoming requests |
| Fields inherited from class com.sap.mw.jco.JCO.Connection |
attributes, codepage_converter, conn_object, conn_params, connection_cpc_mode, dsr_monitor, jarm_monitor, last_active_timestamp, num_received_bytes, num_sent_bytes, passport_bytes, pool, properties, rfc_handle, rfm_name, start_time, state, throughput, time_handle_request, time_middleware, time_total |
| Constructor Summary | |
|
JCO.Server(Properties properties)
Creates an instance of a server connection |
|
JCO.Server(Properties properties,
IRepository repository)
Creates an instance of a server connection |
|
JCO.Server(Properties properties,
IServerThread thread,
IRepository repository)
Creates an instance of a server connection |
|
JCO.Server(String[][] params,
IRepository repository)
Creates an instance of a server using an array to specify the connection parameters. |
|
JCO.Server(String[] argv,
IRepository repository)
Creates an instance of a server using an arv array as passed by void main(String[] argv) |
protected |
JCO.Server(String gwhost,
String gwserv,
String progid)
Creates an instance of a server connection Note: before this server can be used one must set the repository and thread !!! |
|
JCO.Server(String gwhost,
String gwserv,
String progid,
IRepository repository)
Creates an instance of a server connection |
|
JCO.Server(String gwhost,
String gwserv,
String progid,
IServerThread thread,
IRepository repository)
Creates an instance of a server connection |
| Method Summary | |
void |
abort(String message)
Aborts the connection to the remote system, i.e. |
protected void |
beginCall()
Notify about begin of call processing |
protected boolean |
checkAuthorization(String function_name,
int authorization_mode,
String authorization_partner,
byte[] authorization_key)
Called by the jni-layer to check for authorization in case of SNC usage for the server connection. |
void |
disconnect()
Closes the connection to the remote system hardly and cleans up the connection context. |
protected void |
dispatchRequest(JCO.Function function)
Called by the jni-layer after a request for a service has arrived. |
protected void |
endCall()
Notify about end of call processing |
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. |
com.sap.jdsr.writer.DsrIPassport |
getDsrPassport()
Deprecated. only for internal use |
protected JCO.Function |
getFunction(String function_name)
Called by the jni-layer after a request for a service has arrived. |
String |
getGWHost()
Returns the gateway server |
String |
getGWServ()
Returns the gateway service |
protected com.sap.mw.jco.IMiddleware.IServer |
getMiddlewareImplementation()
Returns the middleware implementation Note: This method is for internal use only. |
String |
getProgID()
Returns the program id |
String[][] |
getPropertyInfo()
Returns the property info for the server |
protected IRepository |
getRepository()
Returns the server's associated repository or null if not set |
protected static com.sap.mw.jco.IMiddleware.IServer |
getServerInterface()
Creates a new middleware server object |
byte |
getState()
Returns the server's state as a bit vector |
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. |
void |
handleRequest(JCO.Request request,
JCO.Response response)
Called after a request for a service has arrived. |
boolean |
isAlive()
Checks whether the server is still alive |
protected void |
listen()
Opens a server connection and listens for incoming calls |
boolean |
onCheckTID(String tid)
This function will be invoked when a transactional RFC is being called from a SAP system. |
void |
onCommit(String tid)
This function will be called after all RFC functions belonging to a certain transaction have been successfully completed. |
void |
onConfirmTID(String tid)
This function will be called after the local transaction has been completed. |
void |
onRollback(String tid)
This function will be called if an error in one of the RFC functions belonging to a certain transaction has occurred. |
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. |
protected void |
setProperty(String key,
String value)
Sets the property for the given key. |
protected void |
setRepository(IRepository repository)
Sets the repository the server will be using to lookup incoming function calls |
protected void |
setState(byte state)
Sets the state of the server and invokes the registered stateChangedListener |
protected void |
setThread(IServerThread thread)
Sets the thread in which this server is running in |
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 |
checkProperties, clone, finalize, getConnectionHandle, getProperties, getProperty, getThroughput, hideConnection, 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
protected com.sap.mw.jco.IMiddleware.IServer m_middleware
| Constructor Detail |
public JCO.Server(Properties properties)
properties - the connection parameters passed as a properties object
public JCO.Server(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 call
public JCO.Server(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 call
public JCO.Server(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 call
public JCO.Server(String[] argv,
IRepository repository)
argv - the array of arguments as passed by void main(String[] argv)repository - the repository used by the server to lookup the definitions of an incoming function call
public JCO.Server(String gwhost,
String gwserv,
String progid,
IRepository repository)
gwhost - the gateway hostgwserv - the gateway service number (usually sapgwNN)progid - the program idrepository - the repository used by the server to lookup the definitions of an incoming function call
public JCO.Server(String gwhost,
String gwserv,
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 call
protected JCO.Server(String gwhost,
String gwserv,
String progid)
gwhost - the gateway hostgwserv - the gateway service numberprogid - the program id| Method Detail |
protected static com.sap.mw.jco.IMiddleware.IServer getServerInterface()
protected void setThread(IServerThread thread)
protected IRepository getRepository()
protected void setRepository(IRepository repository)
protected com.sap.mw.jco.IMiddleware.IServer getMiddlewareImplementation()
public final String[][] getPropertyInfo()
getPropertyInfo in class JCO.Connection
protected void setProperty(String key,
String value)
setProperty in class JCO.Connectionpublic 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)protected void setState(byte state)
setState in class JCO.Connectionstate - the new state of the servergetState()public byte getState()
getState in class JCO.Connection| 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 Thread getThread()
public final JCO.Attributes getAttributes()
getAttributes in class JCO.ConnectionJCO.Exception - thrown if the attributes could not be retrieved.JCO.Attributespublic final String getGWHost()
public final String getGWServ()
public final String getProgID()
public final boolean getTrace()
getTrace in class JCO.Connectionpublic final void setTrace(boolean trace)
setTrace in class JCO.Connectiontrace - if true enables the trace and disables it otherwise.public com.sap.jdsr.writer.DsrIPassport getDsrPassport()
JCO.Exception - if DSR library wasn't found in classpath or
dsp passport wasn't send by partner sidepublic void disconnect()
stop-method instead. Calling this method on a running
server can cause RFC errors and/or memory access violations.
disconnect in class JCO.Connectionstop()public void abort(String message)
abort in class JCO.Connectionmessage - 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 Runnablepublic boolean isAlive()
isAlive in class JCO.Connectionprotected void listen()
protected JCO.Function getFunction(String function_name)
function_name - the name of the function that has been called
JCO.Exception - if either the specified function or one of
the associated data structures could not be retrieved from the repository.
protected boolean checkAuthorization(String function_name,
int authorization_mode,
String authorization_partner,
byte[] authorization_key)
function_name - the function that has been called by a remote clientauthorization_mode - the mode of the authorization:
| Mode | Description |
|---|---|
| AUTHORIZATION_SNC | Secure Network compliant authorization |
| AUTHORIZATION_BASIC | Basic authorization |
authorization_partner - the partner (system) name where the request comes fromauthorization_key - the authorization key as binary data depending on the mode
protected void dispatchRequest(JCO.Function function)
throws Exception
function - the function that has been called by a remote client
Exception
public void handleRequest(JCO.Function function)
throws Exception
function - the function that has been called by a remote client
Exception
public void handleRequest(JCO.Request request,
JCO.Response response)
throws Exception
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.
Exceptionpublic boolean onCheckTID(String tid)
tid - the transaction ID
public void onConfirmTID(String tid)
tid - the transaction IDpublic void onCommit(String tid)
tid - the transaction IDpublic void onRollback(String tid)
tid - the transaction IDprotected void beginCall()
beginCall in class JCO.Connectionprotected void endCall()
JCO.Connection
endCall in class JCO.Connection
|
SAP NetWeaver 2004S SPS 10 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||