@Override
  public ContainerBundleAnalyzer analyze(File bundle) {
    packageExports = null;
    Analyzer analyzer = new Analyzer();
    Jar jar = null;
    try {
      jar = new Jar(bundle);
      Manifest manifest = jar.getManifest();
      String exportHeader = manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
      if (exportHeader != null) {
        Map<String, Map<String, String>> exported = analyzer.parseHeader(exportHeader);

        packageExports = exported.keySet();
      } else {
        packageExports = new HashSet<>();
      }
    } catch (Exception e) {
      throw new SmartSpacesException(
          String.format("Could not analyze bundle %s", bundle.getAbsolutePath()), e);
    } finally {
      fileSupport.close(analyzer, false);
      fileSupport.close(jar, false);
    }

    return this;
  }
  /**
   * Construct a new wrapper.
   *
   * @param scriptFile the script file for the wrapper
   * @param scriptService the scripting service
   * @param activityFilesystem the file system for the activity
   * @param configuration the configuration for the activity
   */
  public ScriptActivityWrapper(
      File scriptFile,
      ScriptService scriptService,
      ActivityFilesystem activityFilesystem,
      Configuration configuration) {
    if (!fileSupport.exists(scriptFile)) {
      SimpleSmartSpacesException.throwFormattedException(
          "Script file %s does not exist", scriptFile.getAbsolutePath());
    }

    String filename = scriptFile.getName();
    int periodPos = filename.lastIndexOf(EXTENSION_SEPARATOR);
    String extension = filename.substring(periodPos + 1);
    String baseName = filename.substring(0, periodPos);

    scriptWrapper =
        scriptService.getActivityByExtension(
            extension,
            baseName,
            new FileScriptSource(scriptFile),
            activityFilesystem,
            configuration);
  }