📄 jco$client.java
字号:
}
try
{
super.state = (byte)(super.state & 0xf0 | 1 | 4);
if(!isValid())
return;
middleware.disconnect(this);
}
finally
{
super.state &= 0xfb;
}
}
protected void finalize()
{
try
{
if(!isValid())
return;
if(super.pool != null)
try
{
super.pool.tachFromPool(this);
}
catch(on ex) { }
disconnect();
}
catch(on ex) { }
}
public void abort(String message)
{
synchronized(semaphore)
{
if((super.state & 4) != 0)
throw new on(132, "JCO_ERROR_CONCURRENT_CALL", "Connection cannot be disconnected. Connection currently used in another thread.");
}
if(!isValid())
return;
try
{
middleware.abort(this, message);
}
finally
{
super.state = (byte)(super.state & 0xf0 | 1);
}
}
public void execute(n function)
{
try
{
execute(function.getName(), function.getImportParameterList(), function.getTableParameterList(), function.getExportParameterList(), null, null, null, 0);
}
catch(eption ex)
{
if(ex.getKey().equals(ex.getMessage()))
{
eption ex2 = function.getException(ex.getKey());
if(ex2 != null)
ex = ex2;
}
throw ex;
}
}
public void execute(n function, String tid)
{
execute(function, tid, ((String) (null)), 0);
}
public void execute(n function, String tid, String queue_name)
{
execute(function, tid, queue_name, 0);
}
public void execute(n function, String tid, String queue_name, int queue_pos)
{
try
{
execute(function.getName(), function.getImportParameterList(), function.getTableParameterList(), null, null, tid, queue_name, queue_pos);
}
catch(eption ex)
{
if(ex.getKey().equals(ex.getMessage()))
{
eption ex2 = function.getException(ex.getKey());
if(ex2 != null)
ex = ex2;
}
throw ex;
}
}
public void execute(String name, erList input, erList output)
{
execute(name, input, null, output, null, null, null, 0);
}
public void execute(String name, erList input, erList output, erList tables)
{
execute(name, input, tables, output, null, null, null, 0);
}
public void execute(String name, erList input, erList tables, String tid)
{
execute(name, input, tables, null, null, tid, null, 0);
}
public void execute(String name, erList input, erList tables, String tid, String queue_name)
{
execute(name, input, tables, null, null, tid, queue_name, 0);
}
public void execute(String name, erList input, erList tables, String tid, String queue_name, int queue_pos)
{
execute(name, input, tables, null, null, tid, queue_name, queue_pos);
}
public e execute( request)
{
return execute(request, ((String) (null)), ((String) (null)), 0, 0);
}
public void execute( request, String tid)
{
execute(request, tid, ((String) (null)), 0, 0);
}
public void execute( request, String tid, String queue_name)
{
execute(request, tid, queue_name, 0, 0);
}
public void execute( request, String tid, String queue_name, int queue_pos)
{
execute(request, tid, queue_name, queue_pos, 0);
}
protected e execute( request, String tid, String queue_name, int queue_pos, int dummy)
{
e response = null;
erList request_tables = null;
erList response_tables = null;
for(int i = 0; i < ((a) (request)).num_fields; i++)
if(((a) (request)).type[i] == 99 && (((a) (request)).flags[i] & 0x40) != 0)
{
if(request_tables == null)
request_tables = new erList();
request_tables.appendValue(request.getName(i), request.getTable(i));
}
if(((erList) (request)).dependant_meta_data != null && tid == null)
{
response = new e(((erList) (request)).dependant_meta_data, null, ((erList) (request)).exception_list);
for(int i = 0; i < ((a) (response)).num_fields; i++)
if(((a) (response)).type[i] == 99 && (((a) (response)).flags[i] & 0x40) != 0)
{
if(response_tables == null)
response_tables = new erList();
response_tables.appendValue(response.getName(i), response.getTable(i));
}
}
try
{
execute(request.getName(), ((erList) (request)), request_tables, ((erList) (response)), response_tables, tid, queue_name, queue_pos);
return response;
}
catch(eption ex)
{
if(ex.getKey().equals(ex.getMessage()))
{
eption ex2 = request.getException(ex.getKey());
if(ex2 != null)
ex = ex2;
}
throw ex;
}
}
private void traceBeforeExecute(String name, erList input, erList input_tables, erList output, erList output_tables)
{
StringBuffer buf = (new StringBuffer("[JAV-LAYER] JCO.Client.execute (")).append(name).append(") on handle [").append(getConnectionHandle()).append("]");
boolean trace_data = false;
byte unicodeType = (byte)((input == null ? 0 : input.getUnicodeType()) | (output == null ? 0 : output.getUnicodeType()) | (input_tables == null ? 0 : input_tables.getUnicodeType()) | (output_tables == null ? 0 : output_tables.getUnicodeType()));
if(unicodeType == 3)
{
buf.append(" WARNING: mixed unicode/non-unicode metadata");
trace_data = true;
} else
if(unicodeType == 1 && super.attributes.partner_codepage.charAt(0) == '4')
{
buf.append(" WARNING: non-unicode metadata is used for communication with a unicode backend");
trace_data = true;
} else
if(unicodeType == 2 && super.attributes.partner_codepage.charAt(0) != '4')
{
buf.append(" WARNING: unicode metadata is used for communication with a non-unicode backend");
trace_data = true;
}
if(trace_data || JCO.trace_level > 5)
{
buf.append(JCO.CRLF);
buf.append("Function ").append(name).append(JCO.CRLF);
buf.append("Input: ");
if(input != null)
buf.append(JCO.CRLF).append(input.dumpContent());
else
buf.append("null");
buf.append(JCO.CRLF);
buf.append("Input tables: ");
if(input_tables != null)
buf.append(JCO.CRLF).append(input_tables.dumpContent());
else
buf.append("null");
buf.append(JCO.CRLF);
}
JCO.fireTrace(JCO.trace_level, buf.toString());
}
private void traceAfterExecute(String name, erList input, erList input_tables, erList output, erList output_tables)
{
StringBuffer buf = (new StringBuffer("[JAV-LAYER] JCO.Client.execute (")).append(name);
buf.append(") on handle [").append(getConnectionHandle()).append("] returns ");
buf.append(JCO.CRLF);
buf.append("Function ").append(name).append(JCO.CRLF);
buf.append("Output: ");
if(output != null)
buf.append(JCO.CRLF).append(output.dumpContent());
else
buf.append("null");
buf.append(JCO.CRLF);
buf.append("Output tables: ");
if(output_tables != null)
buf.append(JCO.CRLF).append(output_tables.dumpContent());
else
if(input_tables != null)
buf.append(JCO.CRLF).append(input_tables.dumpContent());
else
buf.append("null");
buf.append(JCO.CRLF);
JCO.fireTrace(JCO.trace_level, buf.toString());
}
protected void execute(String name, erList input, erList input_tables, erList output, erList output_tables, String tid, String queue_name,
int queue_pos)
{
if(super.pool != null && (super.state & 0x10) == 0)
throw new on(102, "JCO_ERROR_COMMUNICATION", "Trying to use a JCO.Client from pool " + super.pool.tName() + " which has not been allocated properly");
if((super.state & 2) == 0)
connect();
synchronized(semaphore)
{
if((super.state & 4) != 0)
throw new on(132, "JCO_ERROR_CONCURRENT_CALL", "Concurrent call. Connection currently used in another thread.");
super.state |= 4;
}
try
{
if((JCO.access$000() & 7) != 0)
{
super.rfm_name = name;
super.start_time = System.currentTimeMillis();
beginCall();
}
if(input != null)
{
if(((a) (input)).rec_name == null)
input.rec_name = "INPUT";
input.checkIfInitialized();
for(int i = 0; i < ((a) (input)).num_fields; i++)
if((((a) (input)).flags[i] & 0x10) != 0 || (((a) (input)).flags[i] & 8) != 0)
((a) (input)).flags[i] |= 0x20;
}
if(input_tables != null)
{
if(((a) (input_tables)).rec_name == null)
if(output_tables == null)
input_tables.rec_name = "TABLES";
else
input_tables.rec_name = "INPUT_TABLES";
for(int i = 0; i < ((a) (input_tables)).num_fields; i++)
if((((a) (input_tables)).flags[i] & 0x10) != 0)
((a) (input_tables)).flags[i] |= 0x20;
}
if(output != null)
{
if(((a) (output)).rec_name == null)
output.rec_name = "OUTPUT";
for(int i = 0; i < ((a) (output)).num_fields; i++)
if((((a) (output)).flags[i] & 0x10) != 0)
((a) (output)).flags[i] |= 0x20;
}
if(output_tables != null)
{
if(((a) (output_tables)).rec_name == null)
output_tables.rec_name = "OUTPUT_TABLES";
for(int i = 0; i < ((a) (output_tables)).num_fields; i++)
if((((a) (output_tables)).flags[i] & 0x10) != 0)
((a) (output_tables)).flags[i] |= 0x20;
}
if(JCO.trace_level > 0)
traceBeforeExecute(name, input, input_tables, output, output_tables);
try
{
middleware.execute(this, name, input, input_tables, output, output_tables, tid, queue_name, queue_pos);
}
catch(eption ex)
{
if(JCO.trace_level > 4)
JCO.fireTrace(5, "[JAV-LAYER] JCO.Client.execute (" + name + ") threw an ABAP exception: " + ex.toString());
throw ex;
}
catch(on ex)
{
if(JCO.trace_level > 0)
JCO.fireTrace(1, "[JAV-LAYER] JCO.Client.execute (" + name + ") threw a NON-ABAP exception: " + ex.toString());
super.state = (byte)(super.state & 0xf0 | 1 | 4);
middleware.disconnect(this);
throw ex;
}
finally
{
if(JCO.trace_level > 5)
traceAfterExecute(name, input, input_tables, output, output_tables);
if(input != null)
{
for(int i = 0; i < ((a) (input)).num_fields; i++)
((a) (input)).flags[i] &= 0xdf;
}
if(input_tables != null)
{
for(int i = 0; i < ((a) (input_tables)).num_fields; i++)
((a) (input_tables)).flags[i] &= 0xdf;
}
if(output != null)
{
for(int i = 0; i < ((a) (output)).num_fields; i++)
((a) (output)).flags[i] &= 0xdf;
}
if(output_tables != null)
{
for(int i = 0; i < ((a) (output_tables)).num_fields; i++)
((a) (output_tables)).flags[i] &= 0xdf;
}
}
}
finally
{
super.state &= 0xfb;
super.last_active_timestamp = System.currentTimeMillis();
if((JCO.access$000() & 7) != 0)
endCall();
}
}
public void send(Object idoc, String tid)
{
send(idoc, tid, null, 0, '0');
}
public void send(Object idoc, String tid, String queue_name)
{
send(idoc, tid, queue_name, 0, '0');
}
public void send(Object idoc, String tid, String queue_name, int queue_pos)
{
send(idoc, tid, queue_name, queue_pos, '0');
}
public void send(Object idoc, String tid, char idoc_version)
{
send(idoc, tid, null, 0, idoc_version);
}
public void send(Object idoc, String tid, String queue_name, char idoc_version)
{
send(idoc, tid, queue_name, 0, idoc_version);
}
public void send(Object idoc, String tid, String queue_name, int queue_pos, char idoc_version)
{
if(!(idoc instanceof nt))
{
throw new on(131, "JCO_ILLEGAL_ARGUMENT", "Illegal argument encountered: Expecting IDoc parameter to be an instance of class com.sap.mw.jco.JCO.IDocument.");
} else
{
((nt)idoc).send(this, tid, queue_name, queue_pos, idoc_version, 0);
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -