Creates an archive containing the server dumps, server configurations.

@param packageFile
@return
174972
private ReturnCode packageServerDumps(File packageFile, List<String> javaDumps) {
        DumpProcessor processor = new DumpProcessor(serverName, packageFile, bootProps, javaDumps);
        return processor.execute();
    }
1022505
@Override
    public T addAsModule(final Archive<?> archive) throws IllegalArgumentException {
        Validate.notNull(archive, "Archive must be specified");

        // Add as ZIP, as JARs are :)
        return add(archive, getModulePath(), ZipExporter.class);
    }
434133
private void addApiDocRoots(String packageListUrl) {
	BufferedReader br = null;
	packageListUrl = fixApiDocRoot(packageListUrl);
	try {
	    URL url = new URL(packageListUrl + "/package-list");
	    br = new BufferedReader(new InputStreamReader(url.openStream()));
	    String line;
	    while((line = br.readLine()) != null) {
		line = line + ".";
		Pattern pattern = Pattern.compile(line.replace(".", "\\.") + "[^\\.]*");
		apiDocMap.put(pattern, packageListUrl);
	    }
	} catch(IOException e) {
	    System.err.println("Errors happened while accessing the package-list file at "
		    + packageListUrl);
	} finally {
	    if(br != null)
		try {
		    br.close();
		} catch (IOException e) {}
	}
	
    }
999884
public void installFile(PackageFile packageFile) {
    File file = packageFile.getFile();
    if (!file.exists()) {
      throw new PackageManagerException("File does not exist: " + file.getAbsolutePath());
    }

    try (CloseableHttpClient httpClient = pkgmgr.getHttpClient()) {

      // before install: if bundles are still stopping/starting, wait for completion
      pkgmgr.waitForBundlesActivation(httpClient);

      if (packageFile.isInstall()) {
        log.info("Upload and install " + (packageFile.isForce() ? "(force) " : "") + file.getName() + " to " + props.getPackageManagerUrl());
      }
      else {
        log.info("Upload " + file.getName() + " to " + props.getPackageManagerUrl());
      }

      VendorPackageInstaller installer = VendorInstallerFactory.getPackageInstaller(props.getPackageManagerUrl());
      if (installer != null) {
        installer.installPackage(packageFile, pkgmgr, httpClient, props, log);
      }
    }
    catch (IOException ex) {
      throw new PackageManagerException("Install operation failed.", ex);
    }
  }
1283432
public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
        YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlFile);
        return createDataSource(config.getDataSources(), config.getShardingRule(), config.getProps(), config.getOrchestration());
    }
1347509
@Override
    public T addPackages(final boolean recursive, final Filter<ArchivePath> filter, final Package... packages)
        throws IllegalArgumentException {
        return addPackages(recursive, filter, null, packages);
    }
430142
def src_archive
      from_directory do
        Find.find(File.join("packages", name)) do |file|
          if File.file?(file) && file.match(/\.(spec)|(sh)|(patch)$/).nil?
            return File.basename(file)
          end
        end
        nil
      end
    end
798353
function createSourceFilesMiddleware (filesPromise, serveFile, basePath, urlRoot) {
  return function (request, response, next) {
    const requestedFilePath = composeUrl(request.url, basePath, urlRoot)
    // When a path contains HTML-encoded characters (e.g %2F used by Jenkins for branches with /)
    const requestedFilePathUnescaped = composeUrl(querystring.unescape(request.url), basePath, urlRoot)

    request.pause()

    log.debug(`Requesting ${request.url}`)
    log.debug(`Fetching ${requestedFilePath}`)

    return filesPromise.then(function (files) {
      // TODO(vojta): change served to be a map rather then an array
      const file = findByPath(files.served, requestedFilePath) || findByPath(files.served, requestedFilePathUnescaped)
      const rangeHeader = request.headers['range']

      if (file) {
        const acceptEncodingHeader = request.headers['accept-encoding']
        const matchedEncoding = Object.keys(file.encodings).find(
          (encoding) => new RegExp(`(^|.*, ?)${encoding}(,|$)`).test(acceptEncodingHeader)
        )
        const content = file.encodings[matchedEncoding] || file.content

        serveFile(file.contentPath || file.path, rangeHeader, response, function () {
          if (/\?\w+/.test(request.url)) {
            common.setHeavyCacheHeaders(response) // files with timestamps - cache one year, rely on timestamps
          } else {
            common.setNoCacheHeaders(response) // without timestamps - no cache (debug)
          }
          if (matchedEncoding) {
            response.setHeader('Content-Encoding', matchedEncoding)
          }
        }, content, file.doNotCache)
      } else {
        next()
      }

      request.resume()
    })
  }
}
398053
private File createBuildTarBall(BuildDirs buildDirs, List<ArchiverCustomizer> archiverCustomizers,
                                    AssemblyConfiguration assemblyConfig, ArchiveCompression compression) throws MojoExecutionException {
        File archive = new File(buildDirs.getTemporaryRootDirectory(), "docker-build." + compression.getFileSuffix());
        try {
            TarArchiver archiver = createBuildArchiver(buildDirs.getOutputDirectory(), archive, assemblyConfig);
            for (ArchiverCustomizer customizer : archiverCustomizers) {
                if (customizer != null) {
                    archiver = customizer.customize(archiver);
                }
            }
            archiver.setCompression(compression.getTarCompressionMethod());
            archiver.createArchive();
            return archive;
        } catch (NoSuchArchiverException e) {
            throw new MojoExecutionException("No archiver for type 'tar' found", e);
        } catch (IOException e) {
            throw new MojoExecutionException("Cannot create archive " + archive, e);
        }
    }
645357
@Override
    public T addPackages(boolean recursive, final Filter<ArchivePath> filter, String... packageNames)
        throws IllegalArgumentException {
        Validate.notNull(filter, "Filter must be specified");
        Validate.notNull(packageNames, "PackageNames must be specified");

        // Get the CLs for this archive
        final Iterable<ClassLoader> classLoaders = getArchiveClassLoaders();

        for (String packageName : packageNames) {
            for (final ClassLoader classLoader : classLoaders) {
                addPackage(recursive, filter, classLoader, packageName);
            }
        }
        return covarientReturn();
    }
1198724
public Object deployThisResource(String packageName, String versionRange, boolean start)
    {
    	int options = 0;
    	//?if (start)
    	//?	options = Resolver.START;
    	if (repositoryAdmin == null)
    		return null;
        DataModelHelper helper = repositoryAdmin.getHelper();
        if (this.getResourceFromCache(packageName) != null)
        	return this.getResourceFromCache(packageName);
        String filter = "(package=" + packageName + ")";
        filter = ClassFinderActivator.addVersionFilter(filter, versionRange);
        Requirement requirement = helper.requirement("package", filter);
        Requirement[] requirements = { requirement };// repositoryAdmin
        Resource[] resources = repositoryAdmin.discoverResources(requirements);
        Resource bestResource = null; 
        if (resources != null)
        {
            Version bestVersion = null; 
            for (Resource resource : resources)
            {
                Version resourceVersion = resource.getVersion();
                if (!isValidVersion(resourceVersion, versionRange))
                    continue;
                if ((bestVersion == null) || (resourceVersion.compareTo(bestVersion) >= 0))
                {
                    bestVersion = resourceVersion;  // Use the highest version number
                    bestResource = resource;
                }
            }
        }
        if (bestResource != null)
        {
            this.deployResource(bestResource, options);
            Bundle bundle = this.findBundle(bestResource, bundleContext, packageName, versionRange);
            if (start)
            	this.startBundle(bundle);
        	this.addResourceToCache(packageName, bestResource);
        }
    	return bestResource;
    }
1063657
public static String makeClassPath(TopologyAPI.Topology topology, String originalPackageFile) {
    String originalPackage = new File(originalPackageFile).getName();
    StringBuilder classPathBuilder = new StringBuilder();
    // TODO(nbhagat): Take type of package as argument.
    if (originalPackage.endsWith(".jar")) {
      // Bundled jar
      classPathBuilder.append(originalPackage);
    } else {
      // Bundled tar
      String topologyJar = originalPackage.replace(".tar.gz", "").replace(".tar", "") + ".jar";
      classPathBuilder.append(String.format("libs/*:%s", topologyJar));
    }
    String additionalClasspath = TopologyUtils.getAdditionalClassPath(topology);
    if (!additionalClasspath.isEmpty()) {
      classPathBuilder.append(":");
      classPathBuilder.append(TopologyUtils.getAdditionalClassPath(topology));
    }
    return classPathBuilder.toString();
  }
1072837
public ServerSetup createCopy(String bindAddress) {
        ServerSetup setup = new ServerSetup(getPort(), bindAddress, getProtocol());
        setup.setServerStartupTimeout(getServerStartupTimeout());
        setup.setConnectionTimeout(getConnectionTimeout());
        setup.setReadTimeout(getReadTimeout());
        setup.setWriteTimeout(getWriteTimeout());
        setup.setVerbose(isVerbose());

        return setup;
    }
1242702
public static Map<String, String> processArchiveManifest(final JarFile jarFile) throws Throwable {
        Map<String, String> manifestAttrs = null;

        if (jarFile != null) {
            try {
                manifestAttrs = AccessController.doPrivileged(new PrivilegedExceptionAction<Map<String, String>>() {
                    @Override
                    public Map<String, String> run() throws ZipException, IOException {
                        InputStream is = null;
                        Map<String, String> attrs = null;
                        try {
                            // Read the manifest and access the manifest headers.
                            is = jarFile.getInputStream(jarFile.getEntry(JarFile.MANIFEST_NAME));
                            attrs = ManifestProcessor.readManifestIntoMap(ManifestProcessor.parseManifest(is));
                        } finally {
                            if (is != null) {
                                InstallUtils.close(is);
                            }
                        }

                        return attrs;
                    }
                });
            } catch (PrivilegedActionException e) {
                throw e.getCause();
            }
        }

        return manifestAttrs;
    }
365548
protected static File toPackageFolder(String packageName) {
		File file = null;
		for (final String element : packageName.split("[.]")) { //$NON-NLS-1$
			if (file == null) {
				file = new File(element);
			} else {
				file = new File(file, element);
			}
		}
		return file;
	}
583701
def create_packages_archive(packages, filename):
    
    import tarfile
    tar = tarfile.open(filename, "w")

    def add(src, dst):
        logger.debug('adding to tar: %s -> %s', src, dst)
        tar.add(src, dst)

    def add_files_for_package(sub_package_path, root_package_path, root_package_name):
        for root, dirs, files in os.walk(sub_package_path):
            if '.svn' in dirs:
                dirs.remove('.svn')
            for f in files:
                if not f.endswith(".pyc") and not f.startswith("."):
                    add(dereference(root + "/" + f), root.replace(root_package_path, root_package_name) + "/" + f)

    for package in packages:
        # Put a submodule's entire package in the archive. This is the
        # magic that usually packages everything you need without
        # having to attach packages/modules explicitly
        if not getattr(package, "__path__", None) and '.' in package.__name__:
            package = __import__(package.__name__.rpartition('.')[0], None, None, 'non_empty')

        n = package.__name__.replace(".", "/")

        if getattr(package, "__path__", None):
            # TODO: (BUG) picking only the first path does not
            # properly deal with namespaced packages in different
            # directories
            p = package.__path__[0]

            if p.endswith('.egg') and os.path.isfile(p):
                raise 'egg files not supported!!!'
                # Add the entire egg file
                # p = p[:p.find('.egg') + 4]
                # add(dereference(p), os.path.basename(p))

            else:
                # include __init__ files from parent projects
                root = []
                for parent in package.__name__.split('.')[0:-1]:
                    root.append(parent)
                    module_name = '.'.join(root)
                    directory = '/'.join(root)

                    add(dereference(__import__(module_name, None, None, 'non_empty').__path__[0] + "/__init__.py"),
                        directory + "/__init__.py")

                add_files_for_package(p, p, n)

                # include egg-info directories that are parallel:
                for egg_info_path in glob.glob(p + '*.egg-info'):
                    logger.debug(
                        'Adding package metadata to archive for "%s" found at "%s"',
                        package.__name__,
                        egg_info_path
                    )
                    add_files_for_package(egg_info_path, p, n)

        else:
            f = package.__file__
            if f.endswith("pyc"):
                f = f[:-3] + "py"
            if n.find(".") == -1:
                add(dereference(f), os.path.basename(f))
            else:
                add(dereference(f), n + ".py")
    tar.close()
398057
public File createArchive()
        throws MojoExecutionException
    {
        File jarFile = getJarFile( outputDirectory, finalName, getClassifier() );

        MavenArchiver archiver = new MavenArchiver();

        archiver.setArchiver( jarArchiver );

        archiver.setOutputFile( jarFile );

        archive.setForced( forceCreation );

        try
        {
            File contentDirectory = getClassesDirectory();
            if ( !contentDirectory.exists() )
            {
                getLog().warn( "JAR will be empty - no content was marked for inclusion!" );
            }
            else
            {
                archiver.getArchiver().addDirectory( contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
            }

            archiver.createArchive(mavenSession, project, archive);

            return jarFile;
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Error assembling JAR", e );
        }
    }