Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 1998-2018 Caucho Technology -- all rights reserved
*
* This file is part of Resin(R) Open Source
*
* Each copy or derived work must preserve the copyright notice and this
* notice unmodified.
*
* Resin Open Source is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Resin Open Source is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
* of NON-INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with Resin Open Source; if not, write to the
*
* Free Software Foundation, Inc.
* 59 Temple Place, Suite 330
* Boston, MA 02111-1307 USA
*
* @author Scott Ferguson
*/
package com.caucho.env.deploy;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.TreeMap;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.caucho.config.ConfigException;
import com.caucho.config.Configurable;
import com.caucho.config.types.FileSetType;
import com.caucho.config.types.PathPatternType;
import com.caucho.env.repository.CommitBuilder;
import com.caucho.env.repository.Repository;
import com.caucho.env.repository.RepositorySystem;
import com.caucho.env.repository.RepositorySpi;
import com.caucho.env.repository.RepositoryTagEntry;
import com.caucho.env.repository.RepositoryTagListener;
import com.caucho.env.service.ResinSystem;
import com.caucho.loader.DynamicClassLoader;
import com.caucho.loader.Environment;
import com.caucho.make.DependencyContainer;
import com.caucho.util.IoUtil;
import com.caucho.util.L10N;
import com.caucho.vfs.Depend;
import com.caucho.vfs.Dependency;
import com.caucho.vfs.Path;
import com.caucho.vfs.ReadStream;
import com.caucho.vfs.Vfs;
import com.caucho.vfs.WriteStream;
/**
* A deployment entry that expands from an archive (Jar/Zip) file.
*/
abstract public class ExpandDeployController
extends DeployController
implements RepositoryTagListener {
private static final L10N L = new L10N(ExpandDeployController.class);
private static final Logger log
= Logger.getLogger(ExpandDeployController.class.getName());
public static final String APPLICATION_HASH_PATH
= "META-INF/resin.application-hash";
private final String _autoDeployStage;
private Path _rootDirectory;
private Path _archivePath;
private DeployContainerApi> _container;
private String _rootHash;
private boolean _isAllowRepository = true;
private Repository _repository;
private RepositorySpi _repositorySpi;
private FileSetType _expandCleanupFileSet;
private DeployTagItem _deployItem;
private DeployListener _deployListener;
private DependencyContainer _depend = new DependencyContainer();
private long _dependencyCheckInterval = _depend.getCheckInterval();
private Dependency _versionDependency;
private Object _applicationExtractLock = new Object();
// classloader for the manifest entries
private DynamicClassLoader _manifestLoader;
private Manifest _manifest;
protected ExpandDeployController(String id)
{
this(id, null, null, null);
}
protected ExpandDeployController(String id,
ClassLoader loader,
Path rootDirectory,
DeployContainerApi> container)
{
super(id, loader);
if (rootDirectory == null)
rootDirectory = Vfs.getPwd(getParentClassLoader());
_rootDirectory = rootDirectory;
_container = container;
_autoDeployStage = "server-" + ResinSystem.getCurrentId();
}
/**
* Gets the root directory
*/
public Path getRootDirectory()
{
return _rootDirectory;
}
/**
* Sets the root directory
*/
protected void setRootDirectory(Path rootDirectory)
{
_rootDirectory = rootDirectory;
}
/**
* Gets the archive path.
*/
public Path getArchivePath()
{
return _archivePath;
}
/**
* Sets the archive path.
*/
public void setArchivePath(Path path)
{
_archivePath = path;
}
public void setAllowRepository(boolean isAllowRepository)
{
_isAllowRepository = isAllowRepository;
}
public boolean isAllowRepository()
{
return _isAllowRepository;
}
/**
* Returns the repository
*/
public Repository getRepository()
{
return _repository;
}
/**
* Returns the manifest.
*/
public Manifest getManifest()
{
return _manifest;
}
public String getRootHash()
{
return _rootHash;
}
/**
* Returns the manifest as an attribute map
*/
public Map getManifestAttributes()
{
if (_manifest == null)
return null;
Map map = new TreeMap();
Attributes attr = _manifest.getMainAttributes();
if (attr != null) {
for (Map.Entry