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

📄 jco.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
// 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.DsrFactory;
import com.sap.jdsr.writer.DsrIPassport;
import com.sap.mw.jco.rfc.MiddlewareRFC;
import com.sap.mw.jco.util.Codecs;
import com.sap.mw.jco.util.Dsr;
import com.sap.mw.jco.util.Jarm;
import com.sap.mw.jco.util.LimitedList;
import com.sap.mw.jco.util.ObjectList;
import com.sap.mw.jco.util.SyncDateFormat;
import com.sap.mw.jco.util.TraceWriter;
import com.sap.mw.jco.util.XMLReaderBase;
import com.sap.mw.jco.util.XMLWriterBase;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.*;

// Referenced classes of package com.sap.mw.jco:
//            IMiddleware, IMetaData, IRepository, IExtendedFieldMetaData, 
//            IFunctionTemplate, IServerThread

public class JCO
{
    public static class Repository extends BasicRepository
        implements IRepository
    {

        public synchronized void setName(String name)
        {
            super.name = name;
        }

        public synchronized String[] getPoolNames()
        {
            return pool_names;
        }

        public synchronized void setPoolNames(String pool_names[])
        {
            if(pool_names != null)
                this.pool_names = pool_names;
            else
                this.pool_names = new String[0];
        }

        protected final int getVersion(Client client)
        {
            if(client == null || !client.isValid())
                throw new Exception(102, "JCO_ERROR_COMMUNICATION", "JCO.Client not connected in repository call");
            try
            {
                repository_version = client.getAttributes().getPartnerReleaseNumber();
            }
            catch(Throwable t) { }
            return repository_version;
        }

        protected void execute(Client client, Function function)
        {
            if(client == this.client)
                synchronized(client)
                {
                    client.execute(function);
                }
            else
                client.execute(function);
        }

        protected IMetaData queryFunctionInterface(String function_name, String pool_name)
        {
            Client client = null;
            IMetaData meta = null;
            try
            {
                client = pool_name == null ? this.client : JCO.getClient(pool_name);
                if(client == null && pool_name != null && JCO.trace_level > 0)
                {
                    Throwable t = (new Throwable()).fillInStackTrace();
                    StringWriter sw = new StringWriter();
                    t.printStackTrace(new PrintWriter(sw));
                    JCO.fireTrace(1, "[JAV-LAYER] Error: client equals null, pool " + pool_name + " stack des calls:" + sw.getBuffer() + "\n");
                }
                meta = queryFunctionInterface(client, function_name);
            }
            catch(Exception first_ex)
            {
                if((first_ex.getGroup() == 102 || first_ex.getGroup() == 105) && client != null)
                    try
                    {
                        client.disconnect(false);
                        client.connect();
                        meta = queryFunctionInterface(client, function_name);
                    }
                    catch(java.lang.Exception ex)
                    {
                        throw first_ex;
                    }
                else
                    throw first_ex;
            }
            finally
            {
                if(pool_name != null && client != null)
                    JCO.releaseClient(client);
            }
            return meta;
        }

        protected IMetaData queryStructureDefinition(String structure_name, String pool_name)
        {
            Client client = null;
            IMetaData meta = null;
            try
            {
                client = pool_name == null ? this.client : JCO.getClient(pool_name);
                if(client == null && pool_name != null && JCO.trace_level > 0)
                {
                    Throwable t = (new Throwable()).fillInStackTrace();
                    StringWriter sw = new StringWriter();
                    t.printStackTrace(new PrintWriter(sw));
                    JCO.fireTrace(1, "[JAV-LAYER] Error: client equals null, pool " + pool_name + " stack des calls:" + sw.getBuffer() + "\n");
                }
                meta = queryStructureDefinition(client, structure_name);
            }
            catch(Exception first_ex)
            {
                if((first_ex.getGroup() == 102 || first_ex.getGroup() == 105) && client != null)
                    try
                    {
                        client.disconnect(false);
                        client.connect();
                        meta = queryStructureDefinition(client, structure_name);
                    }
                    catch(java.lang.Exception ex)
                    {
                        throw first_ex;
                    }
                else
                    throw first_ex;
            }
            finally
            {
                if(pool_name != null && client != null)
                    JCO.releaseClient(client);
            }
            return meta;
        }

        public IMetaData getFunctionInterface(String function_name)
        {
            com.sap.mw.jco.util.Jarm.Monitor jarm_monitor = null;
            try
            {
                if((JCO.jco_mode & 7) != 0)
                {
                    jarm_monitor = Jarm.getRequestMonitor(null, "com.sap.mw.jco.JCO.Repository");
                    if(jarm_monitor != null)
                        jarm_monitor.startComponent();
                }
                IMetaData meta = null;
                meta = (IMetaData)super.function_cache.get(function_name);
                if(meta != null)
                {
                    IMetaData imetadata = meta;
                    return imetadata;
                }
                Exception exc = null;
                for(int i = 0; i < (pool_names.length <= 0 ? 1 : pool_names.length); i++)
                {
                    try
                    {
                        meta = queryFunctionInterface(function_name, i >= pool_names.length ? null : pool_names[i]);
                    }
                    catch(AbapException ex)
                    {
                        if(exc == null && !"FU_NOT_FOUND".equalsIgnoreCase(ex.getKey()))
                            exc = ex;
                    }
                    catch(Exception ex)
                    {
                        if(exc == null)
                            exc = ex;
                    }
                    if(meta != null)
                        break;
                }

                if(meta != null)
                {
                    super.function_cache.put(function_name, meta);
                } else
                {
                    IRepository rep = getNextRepository();
                    if(rep != null)
                        try
                        {
                            meta = rep.getFunctionInterface(function_name);
                        }
                        catch(Exception ex2) { }
                    if(meta == null && exc != null)
                        throw exc;
                }
                IMetaData imetadata1 = meta;
                return imetadata1;
            }
            finally
            {
                if(jarm_monitor != null)
                {
                    jarm_monitor.compAction(function_name);
                    jarm_monitor.endComponent();
                    jarm_monitor.endRequest();
                }
            }
        }

        public IMetaData getStructureDefinition(String structure_name)
        {
            com.sap.mw.jco.util.Jarm.Monitor jarm_monitor = null;
            try
            {
                if((JCO.jco_mode & 7) != 0)
                {
                    jarm_monitor = Jarm.getRequestMonitor(null, "com.sap.mw.jco.JCO.Repository");
                    if(jarm_monitor != null)
                        jarm_monitor.startComponent();
                }
                IMetaData meta = null;
                meta = (IMetaData)super.structure_cache.get(structure_name);
                if(meta != null)
                {
                    IMetaData imetadata = meta;
                    return imetadata;
                }
                Exception exc = null;
                for(int i = 0; i < (pool_names.length <= 0 ? 1 : pool_names.length); i++)
                {
                    try
                    {
                        meta = queryStructureDefinition(structure_name, i >= pool_names.length ? null : pool_names[i]);
                    }
                    catch(AbapException ex)
                    {
                        if(exc == null && !"NOT_FOUND".equalsIgnoreCase(ex.getKey()) && !"TABLE_NOT_ACTIVE".equalsIgnoreCase(ex.getKey()))
                            exc = ex;
                    }
                    catch(Exception ex)
                    {
                        if(exc == null)
                            exc = ex;
                    }
                    if(meta != null)
                        break;
                }

                if(meta != null)
                {
                    super.structure_cache.put(structure_name, meta);
                } else
                {
                    IRepository rep = getNextRepository();
                    if(rep != null)
                        try
                        {
                            meta = rep.getStructureDefinition(structure_name);
                        }
                        catch(Exception ex2) { }
                    if(meta == null && exc != null)

⌨️ 快捷键说明

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