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

📄 jco$basicrepository.java

📁 SAP这个系统的一个转换器
💻 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:   JCO.java

package com.sap.mw.jco;

import java.io.*;
import java.util.*;

// Referenced classes of package com.sap.mw.jco:
//            IMetaData, IRepository, JCO, IFunctionTemplate

public static abstract class JCO$BasicRepository
    implements IRepository
{

    public String getName()
    {
        return name;
    }

    public IFunctionTemplate getFunctionTemplate(String function_name)
    {
        if(function_name == null)
            throw new (131, "JCO_ERROR_ILLEGAL_ARGUMENT", "Function name equals null is not allowed.");
        IMetaData fmeta = null;
        IMetaData smeta = null;
        try
        {
            fmeta = getFunctionInterface(function_name);
        }
        catch(JCO$AbapException ex)
        {
            if(!ex.().equalsIgnoreCase("FU_NOT_FOUND"))
                throw ex;
        }
        if(fmeta == null)
            return null;
        function_name = fmeta.getName();
        int num_fields = fmeta.getFieldCount();
        int ifields = 0;
        int efields = 0;
        int tfields = 0;
        int xfields = 0;
        for(int i = 0; i < num_fields; i++)
            if(fmeta.isImport(i) || fmeta.isExport(i))
            {
                if(fmeta.isExport(i))
                    efields++;
                if(fmeta.isImport(i))
                    ifields++;
            } else
            if(fmeta.isTable(i))
                tfields++;
            else
            if(fmeta.isException(i))
                xfields++;

        JCO$MetaData imeta = ifields <= 0 ? null : new JCO$MetaData("INPUT", ifields);
        JCO$MetaData emeta = efields <= 0 ? null : new JCO$MetaData("OUTPUT", efields);
        JCO$MetaData tmeta = tfields <= 0 ? null : new JCO$MetaData("TABLES", tfields);
        Vector xmeta = xfields <= 0 ? null : new Vector(xfields);
        for(int i = 0; i < num_fields; i++)
        {
            int flags = fmeta.isOptional(i) ? 4 : 0;
            if(fmeta.isNestedType1Structure(i))
                flags |= 0x80;
            if(fmeta.isImport(i) && !fmeta.isExport(i))
            {
                flags |= 1;
                int length;
                int charlength;
                if(fmeta.getType(i) == 17 || fmeta.getType(i) == 99)
                {
                    smeta = getStructureDefinition(fmeta.getTabName(i));
                    if(smeta == null)
                        return null;
                    length = fmeta.getName(i).length();
                    charlength = length;
                } else
                {
                    length = fmeta.getInternalLength(i);
                    charlength = fmeta.getLength(i);
                }
                imeta.(fmeta.getName(i), fmeta.getType(i), charlength, length, -1, fmeta.getDecimals(i), fmeta.getDefault(i), fmeta.getDescription(i), flags, smeta, fmeta.getExtendedFieldMetaData(i));
            } else
            if(fmeta.isExport(i) && !fmeta.isImport(i))
            {
                flags |= 2;
                int length;
                int charlength;
                if(fmeta.getType(i) == 17 || fmeta.getType(i) == 99)
                {
                    smeta = getStructureDefinition(fmeta.getTabName(i));
                    if(smeta == null)
                        return null;
                    length = fmeta.getName(i).length();
                    charlength = length;
                } else
                {
                    length = fmeta.getInternalLength(i);
                    charlength = fmeta.getLength(i);
                }
                emeta.(fmeta.getName(i), fmeta.getType(i), charlength, length, -1, fmeta.getDecimals(i), fmeta.getDefault(i), fmeta.getDescription(i), flags, smeta, fmeta.getExtendedFieldMetaData(i));
            } else
            if(fmeta.isImport(i) && fmeta.isExport(i))
            {
                flags |= 3;
                int length;
                int charlength;
                if(fmeta.getType(i) == 17 || fmeta.getType(i) == 99)
                {
                    smeta = getStructureDefinition(fmeta.getTabName(i));
                    if(smeta == null)
                        return null;
                    length = fmeta.getName(i).length();
                    charlength = length;
                } else
                {
                    length = fmeta.getInternalLength(i);
                    charlength = fmeta.getLength(i);
                }
                imeta.(fmeta.getName(i), fmeta.getType(i), charlength, length, -1, fmeta.getDecimals(i), fmeta.getDefault(i), fmeta.getDescription(i), flags, smeta, fmeta.getExtendedFieldMetaData(i));
                emeta.(fmeta.getName(i), fmeta.getType(i), charlength, length, -1, fmeta.getDecimals(i), fmeta.getDefault(i), fmeta.getDescription(i), flags, smeta, fmeta.getExtendedFieldMetaData(i));
            } else
            if(fmeta.isTable(i))
            {
                smeta = getTableDefinition(fmeta.getTabName(i));
                if(smeta == null)
                    return null;
                int length = fmeta.getName(i).length();
                tmeta.(fmeta.getName(i), fmeta.getType(i), length, length, -1, fmeta.getDecimals(i), fmeta.getDefault(i), fmeta.getDescription(i), flags, smeta, fmeta.getExtendedFieldMetaData(i));
            } else
            if(fmeta.isException(i))
                xmeta.addElement(new JCO$AbapException(fmeta.getName(i), fmeta.getDescription(i)));
        }

        return new (function_name, imeta, emeta, tmeta, xmeta);
    }

    public IMetaData getFunctionInterface(String function_name)
    {
        if(function_name == null)
            throw new JCO$Exception(131, "JCO_ERROR_ILLEGAL_ARGUMENT", "Function name equals null is not allowed.");
        else
            return (IMetaData)function_cache.get(function_name);
    }

    public IMetaData getStructureDefinition(String structure_name)
    {
        if(structure_name == null)
            throw new JCO$Exception(131, "JCO_ERROR_ILLEGAL_ARGUMENT", "Structure name equals null is not allowed.");
        else
            return (IMetaData)structure_cache.get(structure_name);
    }

    public IMetaData getTableDefinition(String table_name)
    {
        return getStructureDefinition(table_name);
    }

    public IRepository getNextRepository()
    {
        return next_repository;
    }

    public void setNextRepository(IRepository next)
    {
        next_repository = next;
    }

    public synchronized void addFunctionInterfaceToCache(IMetaData meta)
    {
        if(meta != null)
            addFunctionInterfaceToCache(meta.getName(), meta);
    }

    public synchronized void addFunctionInterfaceToCache(String key, IMetaData meta)
    {
        if(key == null || meta == null)
            return;
        if(JCO.trace_level > 4)
            JCO.fireTrace(5, "[JAV-LAYER] addFunctionInterfaceToCache(\"" + key + "\") inserting into cache");
        function_cache.put(key, meta);
    }

    public synchronized void addStructureDefinitionToCache(IMetaData meta)
    {
        if(meta != null)
            addStructureDefinitionToCache(meta.getName(), meta);
    }

    public synchronized void addStructureDefinitionToCache(String key, IMetaData meta)
    {
        if(key == null || meta == null)
            return;
        if(JCO.trace_level > 4)
            JCO.fireTrace(5, "[JAV-LAYER] addStructureDefinitionToCache(\"" + key + "\") inserting into cache");
        structure_cache.put(key, meta);
    }

    public synchronized void removeFunctionInterfaceFromCache(String function_name)
    {
        function_cache.remove(function_name);
    }

    public synchronized void removeStructureDefinitionFromCache(String structure_name)
    {
        structure_cache.remove(structure_name);
    }

    public synchronized String[] getCachedFunctionInterfaces()
    {
        String list[] = new String[function_cache.size()];
        int i = 0;
        for(Enumeration e = function_cache.keys(); e.hasMoreElements();)
            list[i++] = (String)e.nextElement();

        return list;
    }

    public synchronized String[] getCachedStructureDefinitions()
    {
        String list[] = new String[structure_cache.size()];
        int i = 0;
        for(Enumeration e = structure_cache.keys(); e.hasMoreElements();)
            list[i++] = (String)e.nextElement();

        return list;
    }

    public synchronized void save(String filename)
        throws IOException
    {
        ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(filename));
        try
        {
            os.writeObject(name);
            os.writeObject(function_cache);
            os.writeObject(structure_cache);
        }
        catch(NotSerializableException ex)
        {
            throw new IOException("NotSerializableException: " + ex.getMessage());
        }
    }

    public synchronized void load(String filename)
        throws IOException
    {
        ObjectInputStream is = new ObjectInputStream(new FileInputStream(filename));
        try
        {
            name = (String)is.readObject();
            function_cache = (Hashtable)is.readObject();
            structure_cache = (Hashtable)is.readObject();
        }
        catch(ClassNotFoundException ex)
        {
            throw new IOException(ex.getMessage());
        }
    }

    protected void writeHTML(String html_filename)
    {
        try
        {
            PrintWriter os = new PrintWriter(new FileWriter(html_filename));
            os.println("<html><head></head>");
            os.println("<body bgcolor='" + JCO.getProperty("jco.html.background") + "'>");
            String th = JCO.getProperty("jco.html.table_header_background2");
            String hc = JCO.getProperty("jco.html.table_header_background3");
            String bdr = JCO.getProperty("jco.html.table_border");
            String fface = JCO.getProperty("jco.html.font_face");
            String fsize = JCO.getProperty("jco.html.font_size");
            os.println("<table border='0' bgcolor='" + th + "' width='100%'>" + JCO.CRLF);
            os.println("<tr align='CENTER' bgcolor='" + hc + "'><th align='left'>Name:</th>");
            os.println("<tr align='LEFT' bgcolor='" + hc + "'>" + function_cache.size() + " Function Cache Entries</tr>" + JCO.CRLF);
            for(Enumeration e = function_cache.elements(); e.hasMoreElements(); os.println(JCO.CRLF + "</tr>" + JCO.CRLF))
            {
                JCO$MetaData meta = (JCO$MetaData)e.nextElement();
                os.println("<tr align='LEFT' bgcolor='" + hc + "'>" + meta.() + "</tr><tr>" + JCO.CRLF);
                meta.ML(os, meta, 0);
            }

            os.println("<tr align='LEFT' bgcolor='" + hc + "'>" + structure_cache.size() + " Structure Cache Entries</tr>" + JCO.CRLF);
            for(Enumeration e = structure_cache.keys(); e.hasMoreElements(); os.println(JCO.CRLF + "</tr>" + JCO.CRLF))
            {
                String key = (String)e.nextElement();
                JCO$MetaData meta = (ts)structure_cache.get(key);
                os.println("<tr align='LEFT' bgcolor='" + hc + "'>" + key + "</tr><tr>" + JCO.CRLF);
                meta.ML(os, meta, 0);
            }

            os.println("</table></body></html>");
            os.close();
        }
        catch(IOException ex)
        {
            throw new ion("Cannot write repository " + getName() + " to HTML file " + html_filename);
        }
    }

    protected String name;
    protected IRepository next_repository;
    protected Hashtable function_cache;
    protected Hashtable structure_cache;

    public JCO$BasicRepository(String name)
    {
        function_cache = new Hashtable(13);
        structure_cache = new Hashtable(13);
        this.name = name;
    }
}

⌨️ 快捷键说明

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