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

📄 middlewarerfc.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        private static final String JCO_EXTIDDATA = "jco.client.extiddata";
        private static final String JCO_EXTIDTYPE = "jco.client.extidtype";
        private static final String JCO_LCHECK = "jco.client.lcheck";
        private static final String JCO_GRT_DATA = "jco.client.grt_data";
        private static final String JCO_USE_SAPGUI = "jco.client.use_sapgui";
        private static final String JCO_GUISERV = "jco.client.use_guiserv";
        private static final String JCO_GUIHOST = "jco.client.use_guihost";
        private static final String JCO_GUIPROGID = "jco.client.use_guiprogid";
        private static final String JCO_SNC_PARTNERNAME = "jco.client.snc_partnername";
        private static final String JCO_SNC_QOP = "jco.client.snc_qop";
        private static final String JCO_SNC_MYNAME = "jco.client.snc_myname";
        private static final String JCO_SNC_MODE = "jco.client.snc_mode";
        private static final String JCO_SNC_LIBRARY = "jco.client.snc_lib";
        private static final String JCO_DEST = "jco.client.dest";
        private static final String JCO_SAPLOGON_ID = "jco.client.saplogon_id";
        private static final String JCO_MSSERV = "jco.client.msserv";
        private static final String JCO_ICCE = "jco.client.icce";
        private static final String JCO_PROFILE_NAME = "jco.client.profile_name";
        private static final String JCO_IDLE_TIMEOUT = "jco.client.idle_timeout";
        private static final String JCO_TOUPPER = "jco.client.toupper";
        private static final String pinfo[][] = {
            {
                "jco.client.client", "Logon client"
            }, {
                "jco.client.user", "Logon user"
            }, {
                "jco.client.alias_user", "Alias user name"
            }, {
                "jco.client.passwd", "Logon password"
            }, {
                "jco.client.lang", "Logon language"
            }, {
                "jco.client.sysnr", "R/3 system number"
            }, {
                "jco.client.ashost", "R/3 application server"
            }, {
                "jco.client.mshost", "R/3 message server"
            }, {
                "jco.client.gwhost", "Gateway host"
            }, {
                "jco.client.gwserv", "Gateway service"
            }, {
                "jco.client.r3name", "R/3 name"
            }, {
                "jco.client.group", "Group of application servers"
            }, {
                "jco.client.tpname", "Program ID of external server program"
            }, {
                "jco.client.tphost", "Host of external server program"
            }, {
                "jco.client.type", "Type of remote host 3 = R/3, E = External"
            }, {
                "jco.client.codepage", "Initial codepage for logon"
            }, {
                "jco.client.use_sapgui", "Use remote SAP graphical user interface (0/1/2)"
            }, {
                "jco.client.mysapsso2", "Use the specified SAP Cookie Version 2 as logon ticket"
            }, {
                "jco.client.grt_data", "Additional data for GUI"
            }, {
                "jco.client.use_guihost", "Host to which to redirect the remote GUI"
            }, {
                "jco.client.use_guiserv", "Service to which to redirect of the remote GUI"
            }, {
                "jco.client.use_guiprogid", "Progid of the server which starts the remote GUI"
            }, {
                "jco.client.snc_partnername", "SNC partner name (e.g. \"p:CN=B20, O=SAP-AG, C=DE\")"
            }, {
                "jco.client.snc_qop", "SNC level of security (1 to 9)"
            }, {
                "jco.client.snc_myname", "SNC name. Overrides default SNC partner"
            }, {
                "jco.client.snc_lib", "Path to library"
            }, {
                "jco.client.dest", "R/2 destination"
            }, {
                "jco.client.saplogon_id", "String defined for SAPLOGON on 32-bit Windows"
            }, {
                "jco.client.extiddata", "Data for external authentication (PAS)"
            }, {
                "jco.client.extidtype", "Type of external authentication (PAS)"
            }, {
                "jco.client.x509cert", "Use the specified X509-certificate as logon ticket"
            }, {
                "jco.client.msserv", "R/3 port number of message server"
            }, {
                "jco.client.profile_name", "Profile name used for shared memory communication"
            }, {
                "jco.client.idle_timeout", "Idle timeout for the connection"
            }, {
                "jco.client.icce", "Ignore RFC library character conversion errors (1 or 0)"
            }, {
                "jco.client.lcheck", "Enable/Disable logon check at open time (1 or 0)"
            }, {
                "jco.client.trace", "Enable/disable RFC trace (1 or 0)"
            }, {
                "jco.client.abap_debug", "Enable ABAP debugging (1 or 0)"
            }, {
                "jco.client.getsso2", "Get/Don't get a SSO ticket after logon (1 or 0)"
            }, {
                "jco.client.snc_mode", "SNC mode (0 or 1)"
            }, {
                "jco.client.toupper", "Enable/Disable uppercase character conversions for logon"
            }
        };
        private static int pinfo_binary_properties = 34;


        protected Client(MiddlewareRFC parent)
        {
            this.parent = parent;
        }
    }


    protected static int compareVersions(String version1, String version2)
        throws NumberFormatException
    {
        if(version1 == null)
        {
            if(version2 == null)
                return 0;
            if(version2.length() == 0)
                return -1;
            if(version2.equals("0"))
                return -1;
            version1 = "0";
        }
        if(version2 == null)
        {
            if(version1.length() == 0)
                return 1;
            if(version1.equals("0"))
                return 1;
            version2 = "0";
        }
        if(version1.length() == 0)
        {
            if(version2.length() == 0)
                return 0;
            if(version2.equals("0"))
                return -1;
            version1 = "0";
        }
        if(version2.length() == 0)
        {
            if(version1.equals("0"))
                return 1;
            version2 = "0";
        }
        int e1 = -1;
        int e2 = -1;
        int v1 = 0;
        int v2 = 0;
        do
        {
            int s1 = e1 + 1;
            int s2 = e2 + 1;
            e1 = version1.indexOf('.', s1);
            e2 = version2.indexOf('.', s2);
            if(e1 == -1)
                e1 = version1.length();
            if(e2 == -1)
                e2 = version2.length();
            v1 = Integer.parseInt(version1.substring(s1, e1));
            v2 = Integer.parseInt(version2.substring(s2, e2));
            if(v1 > v2)
                return 1;
            if(v1 < v2)
                return -1;
        } while(e1 < version1.length() && e2 < version2.length());
        if(e1 == version1.length() && e2 == version2.length())
            return 0;
        return e1 != version1.length() ? 1 : -1;
    }

    protected static String extractRFCLibraryVersion(String version)
    {
        if(version == null)
            return "N/A";
        int start = version.indexOf("***");
        if(start > -1)
            for(start += 3; start < version.length() - 1 && version.charAt(start) == ' '; start++);
        else
            return "N/A";
        int end = version.indexOf("***", start);
        if(end == -1)
            return "N/A";
        for(; end > start && version.charAt(end - 1) == ' '; end--);
        StringBuffer numVersion = new StringBuffer(version.substring(start, end));
        for(int i = 0; i < numVersion.length(); i++)
            if(numVersion.charAt(i) == ',')
                numVersion.setCharAt(i, '.');

        return numVersion.toString();
    }

    protected static String loadLibrary(String libname)
    {
        String path = null;
        String altlib = null;
        String syslib = System.mapLibraryName(libname);
        if(syslib == null || syslib.length() == 0)
            syslib = "lib" + libname + ".so";
        String platform = System.getProperty("os.name", "unknown").toLowerCase();
        if(platform.startsWith("aix"))
            altlib = "lib" + libname + ".o";
        else
        if(platform.startsWith("os/390") || platform.startsWith("z/os"))
            altlib = "lib" + libname + ".dll";
        else
        if(platform.startsWith("os/400"))
            altlib = libname;
        if(syslib.equals(altlib))
            altlib = null;
        try
        {
            Class myClass = com.sap.mw.jco.rfc.MiddlewareRFC.class;
            String myResourceName = myClass.getName().replace('.', '/') + ".class";
            URL myUrl = myClass.getClassLoader().getResource(myResourceName);
            String myUrlProtocol = myUrl == null ? null : myUrl.getProtocol();
            if("bundleresource".equals(myUrlProtocol))
            {
                Class classPlatform = myClass.getClassLoader().loadClass("org.eclipse.core.runtime.Platform");
                Method methodResolve = classPlatform.getDeclaredMethod("resolve", new Class[] {
                    java.net.URL.class
                });
                myUrl = (URL)methodResolve.invoke(classPlatform, new Object[] {
                    myUrl
                });
                myUrlProtocol = myUrl == null ? null : myUrl.getProtocol();
            }
            if("jar".equals(myUrlProtocol) || "file".equals(myUrlProtocol))
            {
                try
                {
                    Method urlDecode = (java.net.URLDecoder.class).getMethod("decode", new Class[] {
                        java.lang.String.class, java.lang.String.class
                    });
                    path = (String)urlDecode.invoke(null, new String[] {
                        myUrl.getFile(), "UTF-8"
                    });
                }
                catch(Throwable t) { }
                if(path == null)
                    path = myUrl.getFile();
                path = path.substring(0, path.length() - myResourceName.length() - 1);
                if(path.startsWith("jar:"))
                    path = path.substring(4);
                if(path.startsWith("file:"))
                    path = path.substring(5);
                if(File.separatorChar != '/')
                    path = path.replace(File.separatorChar, '/');
                if("jar".equals(myUrlProtocol))
                {
                    int index = path.lastIndexOf('/');
                    if(index > 0)
                        path = path.substring(0, index);
                    else
                        path = "";
                }
                File file = new File(path + "/" + syslib);
                if((file.isFile() || platform.startsWith("os/400") && file.exists()) && file.canRead())
                    path = file.getCanonicalPath();
                else
                if(altlib != null)
                {
                    file = new File(path + "/" + altlib);
                    if((file.isFile() || platform.startsWith("os/400") && file.exists()) && file.canRead())
                        path = file.getCanonicalPath();
                    else
                        path = null;
                } else
                {
                    path = null;
                }
                if(path != null)
                {
                    System.load(path);
                    return path;
                }
            }
        }
        catch(Throwable ex) { }
        try
        {
            path = System.getProperty("java.library.path", "");
            StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator);
            while(tokenizer.hasMoreTokens()) 
                try
                {
                    path = tokenizer.nextToken();
                    if(path == null || path.length() == 0)
                        continue;
                    File file = new File(path + File.separator + syslib);
                    if(file.isFile() && file.canRead())
                    {
                        path = file.getCanonicalPath();
                    } else
                    {
                        if(altlib == null)
                            continue;
                        file = new File(path + File.separator + altlib);
                        if(!file.isFile() || !file.canRead())
                            continue;
                        path = file.getCanonicalPath();
                    }
                    System.load(path);
                    return path;
                }
                catch(Throwable ex) { }
        }
        catch(Throwable ex) { }
        System.loadLibrary(libname);
        return "System-defined path to " + syslib;
    }

    protected final String quote(String input)
    {
        if(input == null || input.length() == 0)
            return input;
        char first = input.charAt(0);
        char last = input.charAt(input.length() - 1);
        if(first == '"' && last == '"')
            return input;
        StringBuffer sb = new StringBuffer(input);
        if(first != '"')
            sb.insert(0, '"');
        if(last != '"')
            sb.append('"');
        return sb.toString();
    }

    public MiddlewareRFC()
    {
    }

⌨️ 快捷键说明

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