Package org.glassfish.deployment.common
Class DeploymentUtils
- java.lang.Object
-
- org.glassfish.deployment.common.DeploymentUtils
-
public class DeploymentUtils extends Object
Utility methods for deployment.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DAS_TARGET_NAME
static Logger
deplLogger
static String
DEPLOYMENT_PROPERTY_JAVA_WEB_START_ENABLED
static String
DOMAIN_TARGET_NAME
-
Constructor Summary
Constructors Constructor Description DeploymentUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
checksum(File directory)
Computes the checksum of the URIs of files contained in a directory.static void
copyStream(InputStream in, OutputStream out)
static Artifacts
downloadableArtifacts(Application app)
Returns the downloadable artifacts object derived from the properties saved with the specified Applicationstatic Artifacts
downloadableArtifacts(DeploymentContext dc)
Returns the downloadable artifacts object from the specified deployment context, creating it there if it does not already exist.static void
expand(ReadableArchive source, WritableArchive target)
Expand an archive to a directorystatic Artifacts
generatedArtifacts(Application app)
Returns the generated artifacts object derived from the properties saved with the specified Applicationstatic Artifacts
generatedArtifacts(DeploymentContext dc)
Returns the generated artifacts object from the specified deployment context, creating it there if it does not already exist.static String
getDefaultEEName(String pathName)
static String
getEmbeddedModulePath(String appRootPath, String moduleUri)
This method returns the file path of an embedded module.static List<URI>
getExternalLibraries(ReadableArchive archive)
static String
getInternalNameForTenant(String appname, String tenantname)
static List<URL>
getManifestLibraries(ReadableArchive archive)
Returns the URLs of libraries referenced in the manifeststatic List<URL>
getManifestLibraries(DeploymentContext context)
static List<URL>
getManifestLibraries(DeploymentContext context, Manifest manifest)
static String
getRelativeEmbeddedModulePath(String appRootPath, String moduleUri)
This method returns the relative file path of an embedded module to the application root.static String
getVirtualServers(String target, ServerEnvironment env, Domain domain)
static boolean
isArchiveOfType(ReadableArchive archive, ArchiveType archiveType, DeploymentContext context, org.glassfish.hk2.api.ServiceLocator locator)
static boolean
isArchiveOfType(ReadableArchive archive, ArchiveType archiveType, org.glassfish.hk2.api.ServiceLocator locator)
static boolean
isDASTarget(String targetName)
static boolean
isDomainTarget(String targetName)
static FileArchive
openAsFileArchive(File dir, ArchiveFactory archiveFactory)
Opens the specified file as an archive, using the provided archive factory.static String
propertiesValue(Properties props, char sep)
static String
relativizeWithinDomainIfPossible(URI absURI)
static boolean
useV2Compatibility(DeploymentContext context)
static void
validateApplicationName(String name)
-
-
-
Field Detail
-
deplLogger
public static final Logger deplLogger
-
DEPLOYMENT_PROPERTY_JAVA_WEB_START_ENABLED
public static final String DEPLOYMENT_PROPERTY_JAVA_WEB_START_ENABLED
- See Also:
- Constant Field Values
-
DAS_TARGET_NAME
public static final String DAS_TARGET_NAME
- See Also:
- Constant Field Values
-
DOMAIN_TARGET_NAME
public static final String DOMAIN_TARGET_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDASTarget
public static boolean isDASTarget(String targetName)
-
isDomainTarget
public static boolean isDomainTarget(String targetName)
-
checksum
public static long checksum(File directory)
Computes the checksum of the URIs of files contained in a directory.- Parameters:
directory
- the directory for which to compute a checksum- Returns:
- checksum calculated from URIs of files in the directory
-
downloadableArtifacts
public static Artifacts downloadableArtifacts(DeploymentContext dc)
Returns the downloadable artifacts object from the specified deployment context, creating it there if it does not already exist.- Parameters:
dc
- the deployment context from which to fetch the downloadable Artifacts object- Returns:
-
downloadableArtifacts
public static Artifacts downloadableArtifacts(Application app)
Returns the downloadable artifacts object derived from the properties saved with the specified Application- Parameters:
app
- the Application config object with (possibly) properties describing downloadable artifacts- Returns:
-
generatedArtifacts
public static Artifacts generatedArtifacts(DeploymentContext dc)
Returns the generated artifacts object from the specified deployment context, creating it there if it does not already exist.- Parameters:
dc
-- Returns:
-
generatedArtifacts
public static Artifacts generatedArtifacts(Application app)
Returns the generated artifacts object derived from the properties saved with the specified Application- Parameters:
app
- the Application config object with (possibly) properties describing generated artifacts- Returns:
-
isArchiveOfType
public static boolean isArchiveOfType(ReadableArchive archive, ArchiveType archiveType, DeploymentContext context, org.glassfish.hk2.api.ServiceLocator locator)
-
isArchiveOfType
public static boolean isArchiveOfType(ReadableArchive archive, ArchiveType archiveType, org.glassfish.hk2.api.ServiceLocator locator)
-
getDefaultEEName
public static String getDefaultEEName(String pathName)
- Parameters:
pathName
-- Returns:
- the default value of the EE name. The default name is the pathname with any filename extension (.jar, .war, .rar) removed, but with any directory names included.
-
getRelativeEmbeddedModulePath
public static String getRelativeEmbeddedModulePath(String appRootPath, String moduleUri)
This method returns the relative file path of an embedded module to the application root. For example, if the module is expanded/located at $domain_dir/applications/j2ee-apps/foo/fooEJB_jar, this method will return fooEJB_jar- Parameters:
appRootPath
- The path of the application root which contains the module e.g. $domain_dir/applications/j2ee-apps/foomoduleUri
- The module uri e.g. fooEJB.jar- Returns:
- The relative file path of the module to the application root
-
getEmbeddedModulePath
public static String getEmbeddedModulePath(String appRootPath, String moduleUri)
This method returns the file path of an embedded module. For example, if the module is expanded/located at $domain_dir/applications/j2ee-apps/foo/fooEJB_jar, this method will return $domain_dir/applications/j2ee-apps/foo/fooEJB_jar- Parameters:
appRootPath
- The path of the application root which contains the module e.g. $domain_dir/applications/j2ee-apps/foomoduleUri
- The module uri e.g. fooEJB.jar- Returns:
- The file path of the module
-
useV2Compatibility
public static boolean useV2Compatibility(DeploymentContext context)
-
relativizeWithinDomainIfPossible
public static String relativizeWithinDomainIfPossible(URI absURI) throws URISyntaxException
- Throws:
URISyntaxException
-
validateApplicationName
public static void validateApplicationName(String name)
-
expand
public static void expand(ReadableArchive source, WritableArchive target) throws IOException
Expand an archive to a directory- Parameters:
source
- of the expandingtarget
- of the expanding- Throws:
IOException
- when the archive is corrupted
-
getInternalNameForTenant
public static String getInternalNameForTenant(String appname, String tenantname)
-
propertiesValue
public static String propertiesValue(Properties props, char sep)
-
getManifestLibraries
public static List<URL> getManifestLibraries(DeploymentContext context) throws IOException
- Throws:
IOException
-
getManifestLibraries
public static List<URL> getManifestLibraries(DeploymentContext context, Manifest manifest) throws IOException
- Throws:
IOException
-
getManifestLibraries
public static List<URL> getManifestLibraries(ReadableArchive archive) throws IOException
Returns the URLs of libraries referenced in the manifest- Parameters:
archive
-- Returns:
- Throws:
IOException
-
getExternalLibraries
public static List<URI> getExternalLibraries(ReadableArchive archive)
-
openAsFileArchive
public static FileArchive openAsFileArchive(File dir, ArchiveFactory archiveFactory) throws IOException
Opens the specified file as an archive, using the provided archive factory.- Parameters:
dir
- directory to be opened as an archivearchiveFactory
- ArchiveFactory to use to create the archive object- Returns:
- FileArchive opened for the directory
- Throws:
IOException
-
getVirtualServers
public static String getVirtualServers(String target, ServerEnvironment env, Domain domain)
-
copyStream
public static void copyStream(InputStream in, OutputStream out) throws IOException
- Throws:
IOException
-
-