private void extractNativeResource()

in sdk/host/src/main/java/org/apache/teaclave/javasdk/host/EmbeddedLibOSEnclave.java [60:82]


    private void extractNativeResource() throws EnclaveCreatingException {
        // Extract jni .so and signed tee .so from .jar file.
        // Only once extract and load operation.
        if (extractTempPath == null) {
            synchronized (EmbeddedLibOSEnclave.class) {
                if (extractTempPath == null) {
                    try {
                        String jniTempFilePath = ExtractLibrary.extractLibrary(
                                EmbeddedLibOSEnclave.class.getClassLoader(),
                                JNI_EXTRACTED_PACKAGE_PATH);
                        String embeddedLibOsSignedFilePath = ExtractLibrary.extractAndDeCompressTgz(
                                EmbeddedLibOSEnclave.class.getClassLoader(),
                                EMBEDDED_LIB_OS_ENCLAVE_SIGNED_PACKAGE_PATH) + "/" + EMBEDDED_LIB_OS_ENCLAVE_SIGNED_PACKAGE_PATH_TAIL;
                        extractTempPath = new EmbeddedLibOSEnclave.LibOSExtractTempPath(jniTempFilePath, embeddedLibOsSignedFilePath);
                        System.load(extractTempPath.getJniTempFilePath());
                        registerNatives();
                    } catch (IOException e) {
                        throw new EnclaveCreatingException("extracting embedded lib os enclave jni .so or signed .so failed.", e);
                    }
                }
            }
        }
    }