📄 dsr.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Dsr.java
package com.sap.mw.jco.util;
import com.sap.jdsr.writer.*;
import com.sap.mw.jco.JCO;
public class Dsr
{
public Dsr()
{
action_type = 0;
}
public static void setDsrComponentName(String dsrName)
{
if(dsrName != null && dsrName.length() > 0)
dsrCompName = dsrName;
}
public static void setState(String value)
{
if(value == null)
return;
if("1".equals(value))
{
if(!initDsr())
{
JCO.fireTrace(1, "[JAV-LAYER] jDSR library not found in CLASSPATH. Please check CLASSPATH.");
throw new com.sap.mw.jco.JCO.Exception(150, "JCO_ERROR_DSR_LOAD_ERROR", "jDSR library not found in CLASSPATH. Please check CLASSPATH.");
}
if((dsr_state & 4) == 0)
try
{
dsr_state |= 4;
nativeInitRfcDsr(dsrCompName);
}
catch(Exception ex)
{
JCO.fireTrace(1, "[JAV-LAYER] DSR init of dsr context in native layer caused: " + ex.toString());
}
dsr_state |= 8;
JCO.setMiddlewareProperty("jco.middleware.mode", "1");
} else
if("0".equals(value))
dsr_state &= 0xf7;
}
public static Dsr createMonitor()
{
if(dsr_state == 15)
return new Dsr();
else
return null;
}
public static boolean initDsr()
{
if((dsr_state & 1) == 0)
try
{
Class.forName("com.sap.jdsr.writer.DsrFactory");
dsr_state |= 2;
}
catch(Exception ex) { }
finally
{
dsr_state |= 1;
}
return (dsr_state & 2) != 0;
}
public void openDsrRecord(long handle, int action_type, byte passport_bytes[], long start_time)
{
int trace_level = JCO.getTraceLevel();
if(trace_level > 4)
JCO.fireTrace(5, "[JAV-LAYER] openDsrRecord for connection with handle " + handle + " [enter]");
if(passport_bytes != null)
{
if(dsrPassport == null)
dsrPassport = DsrFactory.makeDsrPassport();
if(dsrRecordSet == null)
if(action_type == 1)
{
dsrRecordSet = DsrFactory.makeDsrRecordSet(dsrCompName);
} else
{
dsrPassport.setByNetPassport(passport_bytes);
dsrRecordSet = DsrFactory.makeDsrRecordSet(dsrPassport.getCompName());
}
dsrRecordSet.getCertRecord().setByNetPassport(passport_bytes);
dsrMainRecord = dsrRecordSet.getMainRecord();
dsrMainRecord.setStartTime(start_time);
} else
if(trace_level > 0)
JCO.fireTrace(1, "[JAV-LAYER] openDsrRecord(): passport isn't set");
if(trace_level > 4)
JCO.fireTrace(5, "[JAV-LAYER] openDsrRecord for connection with handle " + handle + " [leave]");
}
public void closeDsrRecord(long handle, int dsr_action, String rfm_name, long time_total, long time_middleware, long time_handle_request, long num_sent_bytes, long num_received_bytes)
{
int trace_level = JCO.getTraceLevel();
boolean isWritten = false;
if(trace_level > 4)
JCO.fireTrace(5, "[JAV-LAYER] closeDsrRecord for connection with handle " + handle + " [enter]");
if(dsrMainRecord != null)
{
dsrMainRecord.setAction(action_info[dsr_action]);
dsrMainRecord.setActionType(dsr_action);
dsrMainRecord.setRespTime((int)time_total);
dsrMainRecord.setCpuTime(0);
dsrMainRecord.setWaitTime(dsr_action != 0 ? (int)time_handle_request : (int)time_middleware);
StringBuffer addInfo = new StringBuffer("Calling rfc module ");
addInfo.append(rfm_name);
addInfo.append(" [bytes received ");
addInfo.append(num_received_bytes);
addInfo.append(", bytes sent ");
addInfo.append(num_sent_bytes);
addInfo.append("]");
dsrMainRecord.setAddInfo(addInfo.toString());
dsrMainRecord.setGenTime(0);
dsrMainRecord.setLoadTime(0);
dsrMainRecord.setMaxMem(0);
dsrMainRecord.setNetTime(0);
dsrMainRecord.setService(0);
dsrMainRecord.setTransId(dsrPassport.getTransId());
isWritten = dsrRecordSet.write();
}
if(!isWritten)
JCO.fireTrace(1, "[JAV-LAYER] Dsr Recordset cannot be written.");
if(trace_level > 4)
JCO.fireTrace(5, "[JAV-LAYER] writeDsrRecord for connection with handle " + handle + " returns " + isWritten);
dsrRecordSet.clear();
dsrMainRecord.clear();
dsrPassport.clear();
if(trace_level > 4)
JCO.fireTrace(5, "[JAV-LAYER] closeDsrRecord for connection with handle " + handle + " [leave]");
}
protected static native void nativeInitRfcDsr(String s);
private static String dsrCompName = "SAP Java Connector";
private static final byte INITED = 1;
private static final byte DSR_IN_CLASSPATH = 2;
private static final byte RFC_DSR_INITED = 4;
private static final byte DSR_STATE_ON = 8;
public static final int DSR_ACTION_CLIENT_EXECUTE = 0;
public static final int DSR_ACTION_SERVER_DISPATCH = 1;
private static final String action_info[] = {
"JCO.Client.execute", "JCO.Server.dispatchRequest"
};
private int action_type;
private static byte dsr_state = 0;
private DsrIRecordSet dsrRecordSet;
private DsrIMainRecord dsrMainRecord;
private DsrIPassport dsrPassport;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -