⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jco$client.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
// 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:   JCO.java

package com.sap.mw.jco;

import com.sap.jdsr.writer.DsrIPassport;
import com.sap.mw.jco.util.Dsr;
import com.sap.mw.jco.util.Jarm;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
import java.util.Properties;

// Referenced classes of package com.sap.mw.jco:
//            IMiddleware, JCO

public static class JCO$Client extends ion
{

    protected static synchronized .IClient getClientInterface()
    {
        try
        {
            IMiddleware mw = (IMiddleware)JCO.middleware_class.newInstance();
            return mw.getClientInterface();
        }
        catch(Exception ex)
        {
            JCO.fireTrace(0, "[JAV-LAYER] JCO.Client(): could not get middleware interface");
        }
        return null;
    }

    public synchronized Object clone()
    {
        JCO$Client client = (JCO$Client)super.clone();
        client.rfc_handle = 0L;
        client.state = 1;
        client.middleware = getClientInterface();
        return client;
    }

    protected final JCO$Client hide()
    {
        JCO$Client hidden = null;
        synchronized(semaphore)
        {
            if((super.state & 4) != 0)
                throw new on(132, "JCO_ERROR_CONCURRENT_CALL", "Concurrent call. Connection currently used in another thread.");
            hidden = (JCO$Client)clone();
            hidden.rfc_handle = super.rfc_handle;
            hidden.state = super.state;
            hidden.authorizationTraceID = authorizationTraceID;
            super.rfc_handle = 0L;
            super.state |= 1;
        }
        return hidden;
    }

    public void reset()
    {
        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(isAlive())
                middleware.reset(this);
        }
        finally
        {
            super.state &= 0xfb;
        }
    }

    public final String[][] getPropertyInfo()
    {
        return middleware.getPropertyInfo();
    }

    public void setProperty(String key, String value)
    {
        key = key.toLowerCase().trim();
        if(key.indexOf("jco.client.") != 0)
            key = "jco.client." + key;
        super.setProperty(key, value);
    }

    public final String getUser()
    {
        return super.properties.getProperty("jco.client.user");
    }

    protected final String getPassword()
    {
        return "******";
    }

    public final String getClient()
    {
        return super.properties.getProperty("jco.client.client");
    }

    public final String getLanguage()
    {
        return super.properties.getProperty("jco.client.lang");
    }

    public final String getSystemNumber()
    {
        return super.properties.getProperty("jco.client.sysnr");
    }

    public final String getASHost()
    {
        return super.properties.getProperty("jco.client.ashost");
    }

    public final String getMSHost()
    {
        return super.properties.getProperty("jco.client.mshost");
    }

    public final String getGWHost()
    {
        return super.properties.getProperty("jco.client.gwhost");
    }

    public final String getGWServ()
    {
        return super.properties.getProperty("jco.client.gwserv");
    }

    public final String getSystemID()
    {
        return super.properties.getProperty("jco.client.r3name");
    }

    public final String getGroup()
    {
        return super.properties.getProperty("jco.client.group");
    }

    public final String getTPName()
    {
        return super.properties.getProperty("jco.client.tpname");
    }

    public final URL getURL()
    {
        URL url = null;
        try
        {
            String uri = super.properties.getProperty("jco.client.url");
            if(uri != null)
                url = new URL(uri);
        }
        catch(MalformedURLException ex)
        {
            url = null;
        }
        return url;
    }

    public final boolean getTrace()
    {
        String value = super.properties.getProperty("jco.client.trace");
        return value != null && value.equals("1");
    }

    public final void setTrace(boolean trace)
    {
        if(JCO.trace_level > 5)
            JCO.fireTrace(7, "[JAV-LAYER] JCO.Client.setTrace(" + trace + "), current state " + getTrace());
        if(getTrace() == trace)
            return;
        setProperty("jco.client.trace", trace ? "1" : "0");
        if((super.state & 2) != 0)
        {
            if(super.pool != null)
                disconnect(true);
            else
                disconnect(false);
            connect();
        }
    }

    public boolean getAbapDebug()
    {
        String value = super.properties.getProperty("jco.client.abap_debug");
        return value != null && value.equals("1");
    }

    public void setAbapDebug(boolean debug)
    {
        if(JCO.trace_level > 5)
            JCO.fireTrace(7, "[JAV-LAYER] JCO.Client.setAbapDebug(" + debug + "), current state " + getAbapDebug());
        if(getAbapDebug() == debug)
            return;
        setProperty("jco.client.abap_debug", debug ? "1" : "0");
        if((super.state & 2) != 0 && (super.state & 4) == 0)
        {
            middleware.disconnect(this);
            connect();
        }
    }

    public int getSapGui()
    {
        String value = super.properties.getProperty("jco.client.use_sapgui");
        if(value == null)
            return 0;
        if(value.equals("0"))
            return 0;
        if(value.equals("1"))
            return 1;
        return !value.equals("2") ? 0 : 2;
    }

    public void setSapGui(int use_sapgui)
    {
        if(use_sapgui < 0)
            use_sapgui = 0;
        if(use_sapgui > 2)
            use_sapgui = 2;
        setProperty("jco.client.use_sapgui", Integer.toString(use_sapgui));
    }

    public byte getState()
    {
        return super.getState();
    }

    public final tes getAttributes()
    {
        if(super.attributes == null)
            if(super.pool != null && super.pool.ster != null && ((ion) (super.pool.ster)).attributes != null)
            {
                super.attributes = ((ion) (super.pool.ster)).attributes;
            } else
            {
                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
                {
                    middleware.getAttributes(this);
                }
                finally
                {
                    super.state &= 0xfb;
                    super.last_active_timestamp = System.currentTimeMillis();
                }
            }
        if(super.pool != null && super.pool.ster != null)
        {
            if(((ion) (super.pool.ster)).attributes == null)
                super.pool.ster.attributes = super.attributes;
            if(((ion) (super.pool.ster)).codepage_converter == 0L)
                super.pool.ster.codepage_converter = super.codepage_converter;
        }
        return super.attributes;
    }

    public String getHashKey(boolean personalized)
    {
        StringBuffer sb = new StringBuffer();
        String value;
        if(personalized)
        {
            value = getUser();
            sb.append(value == null ? "" : value);
            sb.append('|');
        }
        value = getClient();
        sb.append(value == null ? "" : value);
        sb.append('|');
        value = getLanguage();
        sb.append(value == null ? "" : value);
        sb.append('|');
        if(getASHost() != null)
        {
            sb.append("AS=[");
            value = getASHost();
            sb.append(value == null ? "" : value);
            sb.append('|');
            value = getSystemNumber();
            sb.append(value == null ? "" : value);
            sb.append('|');
            sb.append("]");
        } else
        if(getMSHost() != null)
        {
            sb.append("MS=[");
            value = getSystemID();
            sb.append(value == null ? "" : value);
            sb.append('|');
            value = getMSHost();
            sb.append(value == null ? "" : value);
            sb.append('|');
            value = getGroup();
            sb.append(value == null ? "" : value);
            sb.append('|');
            sb.append("]");
        } else
        if(getURL() != null)
        {
            sb.append("URL=[");
            sb.append(getURL());
            sb.append("]");
        }
        if(getGWHost() != null)
        {
            sb.append("GW=[");
            value = getGWHost();
            sb.append(value == null ? "" : value);
            sb.append('|');
            value = getGWServ();
            sb.append(value == null ? "" : value);
            sb.append('|');
            value = getTPName();
            sb.append(value == null ? "" : value);
            sb.append('|');
            sb.append("]");
        }
        value = super.properties.getProperty("jco.client.use_sapgui");
        if(value != null)
        {
            sb.append('G');
            sb.append(value);
            sb.append('|');
        }
        value = super.properties.getProperty("jco.client.abap_debug");
        if(value != null)
        {
            sb.append('D');
            sb.append(value);
            sb.append('|');
        }
        return sb.toString();
    }

    public boolean isAlive()
    {
        return middleware.isAlive(this);
    }

    public void connect()
    {
        if(isValid())
            return;
        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
        {
            checkProperties();
            middleware.initialize(this, super.properties);
            middleware.connect(this, super.conn_params);
        }
        finally
        {
            super.state &= 0xfb;
        }
        super.state = (byte)(super.state & 0xfffffff0 | 2);
        super.last_active_timestamp = System.currentTimeMillis();
    }

    public boolean isPooled()
    {
        return super.pool != null;
    }

    public void disconnect()
    {
        disconnect(false);
    }

    protected void disconnect(boolean is_pooled)
    {
        authorizationTraceID = null;
        if(!is_pooled && super.pool != null && !getAbapDebug() && getSapGui() == 0)
            throw new on(106, "JCO_ERROR_RESOURCE", "A client allocated from pool " + super.pool.tName() + " cannot be disconnected directly." + JCO.CRLF + "Please, use JCO.releaseClient(JCO.Client) instead." + (stack_trace != null ? JCO.CRLF + "The client was allocated at: " + JCO.CRLF + stack_trace : ""));
        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.");
            super.state |= 4;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -