test_class.declarator: LOGGER = LoggerFactory.getLogger(OpearFileTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(OpearFileTest.class);
test_class.type: Logger
test_class.var_name: LOGGER
test_class.declarator: baseDir = new File("src/test/resources/OpearFileTest")
test_class.modifier: final
test_class.original_string: final File baseDir = new File("src/test/resources/OpearFileTest");
test_class.type: File
test_class.var_name: baseDir
test_class.declarator: testTarget = new File("target/test-output/OpearFileTest")
test_class.modifier: final
test_class.original_string: final File testTarget = new File("target/test-output/OpearFileTest");
test_class.type: File
test_class.var_name: testTarget
test_class.declarator: deepTestSrc = new File(baseDir, "deep_test_src")
test_class.modifier: final
test_class.original_string: final File deepTestSrc = new File(baseDir, "deep_test_src");
test_class.type: File
test_class.var_name: deepTestSrc
test_class.declarator: deepTestTarget = new File(testTarget, "deep_test.jar")
test_class.modifier: final
test_class.original_string: final File deepTestTarget = new File(testTarget, "deep_test.jar");
test_class.type: File
test_class.var_name: deepTestTarget
test_class.declarator: embedModuleSrc = new File(baseDir, "embedded_module_src")
test_class.modifier: final
test_class.original_string: final File embedModuleSrc = new File(baseDir, "embedded_module_src");
test_class.type: File
test_class.var_name: embedModuleSrc
test_class.declarator: embedModuleTarget = new File(testTarget, "embedded_module.jar")
test_class.modifier: final
test_class.original_string: final File embedModuleTarget = new File(testTarget, "embedded_module.jar");
test_class.type: File
test_class.var_name: embedModuleTarget
test_class.file: core/src/test/java/net/adamcin/oakpal/core/opear/OpearFileTest.java
test_class.identifier: OpearFileTest
test_case.body: @Test
      public void testCacheJar_fail() throws Exception {
          buildDeepTestJar();
          final File cacheDir = new File("target/test-output/OpearFileTest/testCacheJar_fail/cache");
          if (cacheDir.exists()) {
              FileUtils.deleteDirectory(cacheDir);
          }
          new File(cacheDir, "deep-plan.json").mkdirs();
          assertTrue("fail to cache entry",
                  OpearFile.cacheJar(new JarFile(deepTestTarget), cacheDir).isFailure());
  
          FileUtils.deleteDirectory(cacheDir);
          FileUtils.touch(new File(cacheDir, "META-INF"));
          assertTrue("fail to cache directory entry",
                  OpearFile.cacheJar(new JarFile(deepTestTarget), cacheDir).isFailure());
      }
test_case.class_method_signature: OpearFileTest.testCacheJar_fail()
test_case.full_signature: @Test public void testCacheJar_fail()
test_case.identifier: testCacheJar_fail
test_case.invocations: buildDeepTestJar exists deleteDirectory mkdirs assertTrue isFailure cacheJar deleteDirectory touch assertTrue isFailure cacheJar
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCacheJar_fail()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(OpearFile.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(OpearFile.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: NAME_BUNDLE_SYMBOLICNAME = new Attributes.Name(MF_BUNDLE_SYMBOLICNAME)
focal_class.modifier: public static final
focal_class.original_string: public static final Attributes.Name NAME_BUNDLE_SYMBOLICNAME = new Attributes.Name(MF_BUNDLE_SYMBOLICNAME);
focal_class.type: Attributes.Name
focal_class.var_name: NAME_BUNDLE_SYMBOLICNAME
focal_class.declarator: NAME_BUNDLE_VERSION = new Attributes.Name(MF_BUNDLE_VERSION)
focal_class.modifier: public static final
focal_class.original_string: public static final Attributes.Name NAME_BUNDLE_VERSION = new Attributes.Name(MF_BUNDLE_VERSION);
focal_class.type: Attributes.Name
focal_class.var_name: NAME_BUNDLE_VERSION
focal_class.declarator: NAME_CLASS_PATH = new Attributes.Name(MF_CLASS_PATH)
focal_class.modifier: public static final
focal_class.original_string: public static final Attributes.Name NAME_CLASS_PATH = new Attributes.Name(MF_CLASS_PATH);
focal_class.type: Attributes.Name
focal_class.var_name: NAME_CLASS_PATH
focal_class.declarator: NAME_OAKPAL_VERSION = new Attributes.Name(MF_OAKPAL_VERSION)
focal_class.modifier: public static final
focal_class.original_string: public static final Attributes.Name NAME_OAKPAL_VERSION = new Attributes.Name(MF_OAKPAL_VERSION);
focal_class.type: Attributes.Name
focal_class.var_name: NAME_OAKPAL_VERSION
focal_class.declarator: NAME_OAKPAL_PLAN = new Attributes.Name(MF_OAKPAL_PLAN)
focal_class.modifier: public static final
focal_class.original_string: public static final Attributes.Name NAME_OAKPAL_PLAN = new Attributes.Name(MF_OAKPAL_PLAN);
focal_class.type: Attributes.Name
focal_class.var_name: NAME_OAKPAL_PLAN
focal_class.declarator: cacheDir
focal_class.modifier: final
focal_class.original_string: final File cacheDir;
focal_class.type: File
focal_class.var_name: cacheDir
focal_class.declarator: metadata
focal_class.modifier: final
focal_class.original_string: final OpearMetadata metadata;
focal_class.type: OpearMetadata
focal_class.var_name: metadata
focal_class.file: core/src/main/java/net/adamcin/oakpal/core/opear/OpearFile.java
focal_class.identifier: OpearFile
focal_class.interfaces: implements Opear
focal_class.class_method_signature: OpearFile.OpearFile(final File cacheDir, final OpearMetadata metadata)
focal_class.full_signature:   OpearFile(final File cacheDir, final OpearMetadata metadata)
focal_class.identifier: OpearFile
focal_class.parameters: (final File cacheDir, final OpearMetadata metadata)
focal_class.signature:  OpearFile(final File cacheDir, final OpearMetadata metadata)
focal_class.class_method_signature: OpearFile.getDefaultPlan()
focal_class.full_signature: @Override public URL getDefaultPlan()
focal_class.identifier: getDefaultPlan
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: URL
focal_class.signature: URL getDefaultPlan()
focal_class.class_method_signature: OpearFile.getSpecificPlan(final @NotNull String planName)
focal_class.full_signature: @Override public Result<URL> getSpecificPlan(final @NotNull String planName)
focal_class.identifier: getSpecificPlan
focal_class.modifiers: @Override public
focal_class.parameters: (final @NotNull String planName)
focal_class.return: Result<URL>
focal_class.signature: Result<URL> getSpecificPlan(final @NotNull String planName)
focal_class.class_method_signature: OpearFile.getPlanClassLoader(final @NotNull ClassLoader parent)
focal_class.full_signature: @Override public ClassLoader getPlanClassLoader(final @NotNull ClassLoader parent)
focal_class.identifier: getPlanClassLoader
focal_class.modifiers: @Override public
focal_class.parameters: (final @NotNull ClassLoader parent)
focal_class.return: ClassLoader
focal_class.signature: ClassLoader getPlanClassLoader(final @NotNull ClassLoader parent)
focal_class.class_method_signature: OpearFile.readExpectedManifest(final @NotNull File mfFile)
focal_class.full_signature: static Result<Manifest> readExpectedManifest(final @NotNull File mfFile)
focal_class.identifier: readExpectedManifest
focal_class.modifiers: static
focal_class.parameters: (final @NotNull File mfFile)
focal_class.return: Result<Manifest>
focal_class.signature: Result<Manifest> readExpectedManifest(final @NotNull File mfFile)
focal_class.class_method_signature: OpearFile.metaForSimpleDir(final @NotNull File directory)
focal_class.full_signature: static OpearMetadata metaForSimpleDir(final @NotNull File directory)
focal_class.identifier: metaForSimpleDir
focal_class.modifiers: static
focal_class.parameters: (final @NotNull File directory)
focal_class.return: OpearMetadata
focal_class.signature: OpearMetadata metaForSimpleDir(final @NotNull File directory)
focal_class.class_method_signature: OpearFile.validateUriHeaderValuesWithDefaultForMissing(final @NotNull Manifest manifest,
                                                                           final @NotNull Attributes.Name headerName,
                                                                           final @NotNull String... defaultValue)
focal_class.full_signature: static Result<String[]> validateUriHeaderValuesWithDefaultForMissing(final @NotNull Manifest manifest,
                                                                           final @NotNull Attributes.Name headerName,
                                                                           final @NotNull String... defaultValue)
focal_class.identifier: validateUriHeaderValuesWithDefaultForMissing
focal_class.modifiers: static
focal_class.parameters: (final @NotNull Manifest manifest,
                                                                           final @NotNull Attributes.Name headerName,
                                                                           final @NotNull String... defaultValue)
focal_class.return: Result<String[]>
focal_class.signature: Result<String[]> validateUriHeaderValuesWithDefaultForMissing(final @NotNull Manifest manifest,
                                                                           final @NotNull Attributes.Name headerName,
                                                                           final @NotNull String... defaultValue)
focal_class.class_method_signature: OpearFile.validateUriHeaderValues(final @NotNull Manifest manifest,
                                                      final @NotNull Attributes.Name headerName)
focal_class.full_signature: static Result<String[]> validateUriHeaderValues(final @NotNull Manifest manifest,
                                                      final @NotNull Attributes.Name headerName)
focal_class.identifier: validateUriHeaderValues
focal_class.modifiers: static
focal_class.parameters: (final @NotNull Manifest manifest,
                                                      final @NotNull Attributes.Name headerName)
focal_class.return: Result<String[]>
focal_class.signature: Result<String[]> validateUriHeaderValues(final @NotNull Manifest manifest,
                                                      final @NotNull Attributes.Name headerName)
focal_class.class_method_signature: OpearFile.validateOpearManifest(final @Nullable Manifest manifest)
focal_class.full_signature: static Result<OpearMetadata> validateOpearManifest(final @Nullable Manifest manifest)
focal_class.identifier: validateOpearManifest
focal_class.modifiers: static
focal_class.parameters: (final @Nullable Manifest manifest)
focal_class.return: Result<OpearMetadata>
focal_class.signature: Result<OpearMetadata> validateOpearManifest(final @Nullable Manifest manifest)
focal_class.class_method_signature: OpearFile.fromDirectory(final @NotNull File directory)
focal_class.full_signature: public static Result<OpearFile> fromDirectory(final @NotNull File directory)
focal_class.identifier: fromDirectory
focal_class.modifiers: public static
focal_class.parameters: (final @NotNull File directory)
focal_class.return: Result<OpearFile>
focal_class.signature: Result<OpearFile> fromDirectory(final @NotNull File directory)
focal_class.class_method_signature: OpearFile.getHashCacheKey(final @NotNull String path)
focal_class.full_signature: static Result<String> getHashCacheKey(final @NotNull String path)
focal_class.identifier: getHashCacheKey
focal_class.modifiers: static
focal_class.parameters: (final @NotNull String path)
focal_class.return: Result<String>
focal_class.signature: Result<String> getHashCacheKey(final @NotNull String path)
focal_class.class_method_signature: OpearFile.fromJar(final @NotNull JarFile jarFile, final @NotNull File cacheBaseDir)
focal_class.full_signature: public static Result<OpearFile> fromJar(final @NotNull JarFile jarFile, final @NotNull File cacheBaseDir)
focal_class.identifier: fromJar
focal_class.modifiers: public static
focal_class.parameters: (final @NotNull JarFile jarFile, final @NotNull File cacheBaseDir)
focal_class.return: Result<OpearFile>
focal_class.signature: Result<OpearFile> fromJar(final @NotNull JarFile jarFile, final @NotNull File cacheBaseDir)
focal_class.class_method_signature: OpearFile.cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_class.full_signature: static Result<File> cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_class.identifier: cacheJar
focal_class.modifiers: static
focal_class.parameters: (final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_class.return: Result<File>
focal_class.signature: Result<File> cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_method.body: static Result<File> cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir) {
          return jarFile.stream()
                  .map(entry -> {
                      final File cacheFile = new File(cacheDir, entry.getName());
                      if (entry.isDirectory()) {
                          if (cacheFile.isDirectory() || cacheFile.mkdirs()) {
                              return Result.success(cacheFile);
                          }
                      } else {
                          if (cacheFile.getParentFile().isDirectory() || cacheFile.getParentFile().mkdirs()) {
                              try (InputStream input = jarFile.getInputStream(entry)) {
                                  FileIOUtils.copyInputStreamToFile(input, cacheFile);
                                  return Result.success(cacheFile);
                              } catch (IOException e) {
                                  return Result.<File>failure("failed to cache entry " + entry.getName(), e);
                              }
                          }
                      }
                      return Result.<File>failure("failed to cache entry " + entry.getName());
                  })
                  .filter(Result::isFailure).findFirst()
                  .map(failed -> failed.getError().map(Result::<File>failure)
                          .orElseGet(() -> Result.<File>failure("failed to cache jarFile" + jarFile.getName())))
                  .orElse(Result.success(cacheDir));
      }
focal_method.class_method_signature: OpearFile.cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_method.full_signature: static Result<File> cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_method.identifier: cacheJar
focal_method.invocations: orElse map findFirst filter map stream getName isDirectory isDirectory mkdirs success isDirectory getParentFile mkdirs getParentFile getInputStream copyInputStreamToFile success failure getName failure getName orElseGet map getError failure getName success
focal_method.modifiers: static
focal_method.parameters: (final @NotNull JarFile jarFile, final @NotNull File cacheDir)
focal_method.return: Result<File>
focal_method.signature: Result<File> cacheJar(final @NotNull JarFile jarFile, final @NotNull File cacheDir)