📄 jco$server.java
字号:
}
protected void dispatchRequest(n function)
throws Exception
{
if(JCO.trace_level > 2)
JCO.fireTrace(3, "[JAV-LAYER] dispatchRequest( " + (function != null ? function.getName() : "null") + ") enter");
try
{
erList input = function.getImportParameterList();
erList output = function.getExportParameterList();
if(input != null)
{
int num_parameters = input.getFieldCount();
for(int i = 0; i < num_parameters; i++)
if(input.isExport(i))
try
{
int j = output.indexOf(input.getName(i));
if(output.isImport(j))
output.setValue(input.getValue(i), j);
}
catch(Exception ex) { }
}
if(m_call_model != 0)
{
String old_request_name = null;
String old_response_name = null;
erList table_parameters = function.getTableParameterList();
request = ()function.getImportParameterList();
if(request == null && table_parameters != null)
request = new (function.getName(), function.getExceptionList());
if(request != null)
{
old_request_name = ((a) (request)).rec_name;
request.rec_type |= 0x10;
request.rec_name = function.getName();
}
e response = (e)function.getExportParameterList();
if(response == null && table_parameters != null)
response = new e(function.getName(), function.getExceptionList());
int num_response_params = 0;
if(response != null)
{
old_response_name = ((a) (response)).rec_name;
response.rec_type |= 0x20;
response.rec_name = function.getName();
num_response_params = ((a) (response)).num_fields;
}
int num_tables = table_parameters == null ? 0 : table_parameters.getFieldCount();
for(int i = 0; i < num_tables; i++)
{
request.appendValue(table_parameters.getName(i), table_parameters.getTable(i));
((a) (request)).flags[((a) (request)).num_fields - 1] |= 0x40;
response.appendValue(table_parameters.getName(i), table_parameters.getTable(i));
((a) (response)).flags[((a) (response)).num_fields - 1] |= 0x40;
}
try
{
if(JCO.trace_level > 0)
traceBeforeDispatchRequest(request, response);
handleRequest(request, response);
if(JCO.trace_level > 0)
traceAfterDispatchRequest(request, response);
for(int i = 0; i < num_tables; i++)
{
JCO$Table table = table_parameters.getTable(i);
if(response.getTable(num_response_params + i) != table)
if((m_dispatch_mode & 1) != 0)
{
table.lear();
table.opyFrom(response.getTable(num_response_params + i));
} else
{
table_parameters.setValue(response.getTable(num_response_params + i), i);
}
}
}
finally
{
if(request != null)
{
request.rec_type &= 0xef;
request.rec_name = old_request_name;
}
if(response != null)
{
response.rec_type &= 0xdf;
response.rec_name = old_response_name;
}
}
} else
{
if(JCO.trace_level > 0)
traceBeforeDispatchRequest(function);
handleRequest(function);
if(JCO.trace_level > 0)
traceAfterDispatchRequest(function);
}
}
catch(Throwable t)
{
if(JCO.trace_level > 2)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.close();
JCO.fireTrace(3, "[JAV-LAYER] Exception in dispatchRequest( " + (function != null ? function.getName() : "null") + "):" + sw.getBuffer());
}
if(t instanceof Error)
throw (Error)t;
if(t instanceof Exception)
throw (Exception)t;
}
finally
{
if(JCO.trace_level > 2)
JCO.fireTrace(3, "[JAV-LAYER] dispatchRequest( " + (function != null ? function.getName() : "null") + ") leave");
}
}
protected void handleRequest(n n)
throws Exception
{
}
protected void handleRequest( , e e)
throws Exception
{
}
protected boolean onCheckTID(String tid)
{
return true;
}
protected void onConfirmTID(String s)
{
}
protected void onCommit(String s)
{
}
protected void onRollback(String s)
{
}
protected void beginCall()
{
if((JCO.access$000() & 7) != 0)
{
super.jarm_monitor = Jarm.getRequestMonitor(null, "com.sap.mw.jco.JCO.Server");
if(super.jarm_monitor != null)
super.jarm_monitor.startComponent("com.sap.mw.jco.JCO.Server");
if(super.dsr_monitor == null && super.passport_bytes != null)
super.dsr_monitor = Dsr.createMonitor();
if(super.dsr_monitor != null && super.passport_bytes != null)
super.dsr_monitor.openDsrRecord(getConnectionHandle(), 1, super.passport_bytes, super.start_time);
}
}
protected void endCall()
{
if((JCO.access$000() & 7) != 0)
{
if(super.jarm_monitor != null)
{
tes attributes = getAttributes();
super.jarm_monitor.setUser(attributes == null ? (String)null : attributes.getUser());
super.jarm_monitor.endComponent();
super.jarm_monitor.endRequest();
}
if(super.dsr_monitor != null && super.passport_bytes != null)
super.dsr_monitor.closeDsrRecord(getConnectionHandle(), 1, super.rfm_name, super.time_total, super.time_middleware, super.time_handle_request, super.num_sent_bytes, super.num_received_bytes);
}
}
public static final int AUTHORIZATION_MODE_SNC = 0;
public static final int AUTHORIZATION_MODE_BASIC = 1;
public static final int FUNCTION_MODEL = 0;
public static final int REQUEST_RESPONSE_MODEL = 1;
protected .IServer m_middleware;
private volatile IServerThread m_thread;
private IRepository m_repository;
private Object m_semaphore;
private int m_call_model;
private final int TABLE_COPY = 1;
private int m_dispatch_mode;
private static final String JCO_MAX_STARTUP_DELAY = "jco.server.max_startup_delay";
private int m_startup_delay;
private int m_max_startup_delay;
public JCO$Server(Properties properties)
{
this(properties, ((IServerThread) (null)), ((IRepository) (null)));
}
public JCO$Server(Properties properties, IRepository repository)
{
this(properties, ((IServerThread) (null)), repository);
}
public JCO$Server(Properties properties, IServerThread thread, IRepository repository)
{
m_semaphore = new Object();
m_call_model = 0;
m_dispatch_mode = 1;
m_startup_delay = 0;
m_max_startup_delay = -1;
if(thread != null && !(thread instanceof Thread))
throw new IllegalArgumentException("thread argument must be subclass of Thread");
m_thread = ((IServerThread) (thread == null ? ((IServerThread) (new hread(this))) : thread));
m_repository = repository;
if(properties != null)
super.properties = (Properties)properties.clone();
m_middleware = getServerInterface();
}
public JCO$Server(String params[][], IRepository repository)
{
this(((Properties) (null)), ((IServerThread) (null)), repository);
for(int i = 0; i < params.length; i++)
{
String key;
String val;
if((key = params[i][0]) != null && (val = params[i][1]) != null)
{
key = key.toLowerCase().trim();
if(key.indexOf("jco.server.") != 0)
key = "jco.server." + key;
super.properties.put(key, val);
}
}
}
public JCO$Server(String argv[], IRepository repository)
{
this(((Properties) (null)), ((IServerThread) (null)), repository);
if(argv != null)
{
StringBuffer sb = new StringBuffer();
for(int i = 0; i < argv.length; i++)
{
if(i > 0)
sb.append(' ');
sb.append(argv[i]);
}
super.properties.put("jco.server.params", sb.toString());
}
}
public JCO$Server(String gwhost, String gwserv, String progid, IRepository repository)
{
this(gwhost, gwserv, progid, null, repository);
}
public JCO$Server(String gwhost, String gwserv, String progid, IServerThread thread, IRepository repository)
{
this(((Properties) (null)), thread, repository);
if(gwhost != null)
super.properties.put("jco.server.gwhost", gwhost);
if(gwserv != null)
super.properties.put("jco.server.gwserv", gwserv);
if(progid != null)
super.properties.put("jco.server.progid", progid);
}
protected JCO$Server(String gwhost, String gwserv, String progid)
{
m_semaphore = new Object();
m_call_model = 0;
m_dispatch_mode = 1;
m_startup_delay = 0;
m_max_startup_delay = -1;
if(gwhost != null)
super.properties.put("jco.server.gwhost", gwhost);
if(gwserv != null)
super.properties.put("jco.server.gwserv", gwserv);
if(progid != null)
super.properties.put("jco.server.progid", progid);
m_middleware = getServerInterface();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -