public abstract class ContainerInstall
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ContainerInstall.ConnectionType
Represents the type of connection used in this installation
Supports either PEER_TO_PEER or CLIENT_SERVER.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_INSTALL_DIR |
static java.lang.String |
DEFAULT_MODULE_EXTRACTION_DIR |
protected static java.lang.String |
DEFAULT_MODULE_LOCATION |
static java.lang.String |
GEODE_BUILD_HOME |
static org.apache.logging.log4j.Logger |
logger |
static java.lang.String |
TMP_DIR |
Constructor and Description |
---|
ContainerInstall(java.lang.String installDir,
java.lang.String downloadURL,
ContainerInstall.ConnectionType connType,
java.lang.String moduleName) |
ContainerInstall(java.lang.String installDir,
java.lang.String downloadURL,
ContainerInstall.ConnectionType connType,
java.lang.String moduleName,
java.lang.String geodeModuleLocation)
Base class for handling downloading and configuring J2EE installations
This class contains common logic for downloading and configuring J2EE installations with cargo,
and some common methods for applying geode session replication configuration to those
installations.
|
Modifier and Type | Method and Description |
---|---|
void |
clearPreviousInstall(java.lang.String installDir)
Cleans up the installation by deleting the extracted module and downloaded installation folders
|
protected static void |
editPropertyFile(java.lang.String filePath,
java.lang.String propertyName,
java.lang.String propertyValue,
boolean append)
Edits the specified property within the given property file
|
protected static void |
editXMLFile(java.lang.String XMLPath,
java.lang.String tagName,
java.lang.String parentTagName,
java.util.HashMap<java.lang.String,java.lang.String> attributes) |
protected static void |
editXMLFile(java.lang.String XMLPath,
java.lang.String tagName,
java.lang.String parentTagName,
java.util.HashMap<java.lang.String,java.lang.String> attributes,
boolean writeOnSimilarAttributeNames) |
protected static void |
editXMLFile(java.lang.String XMLPath,
java.lang.String tagId,
java.lang.String tagName,
java.lang.String parentTagName,
java.util.HashMap<java.lang.String,java.lang.String> attributes) |
protected static void |
editXMLFile(java.lang.String XMLPath,
java.lang.String tagName,
java.lang.String replacementTagName,
java.lang.String parentTagName,
java.util.HashMap<java.lang.String,java.lang.String> attributes,
boolean writeOnSimilarAttributeNames) |
protected static void |
editXMLFile(java.lang.String XMLPath,
java.lang.String tagId,
java.lang.String tagName,
java.lang.String replacementTagName,
java.lang.String parentTagName,
java.util.HashMap<java.lang.String,java.lang.String> attributes,
boolean writeOnSimilarAttributeNames)
Edit the given xml file
Uses
findNodeWithAttribute(Document, String, String, String) ,
rewriteNodeAttributes(Node, HashMap) ,
nodeHasExactAttributes(Node, HashMap, boolean) to edit the required parts of the XML
file. |
protected static java.lang.String |
findAndExtractModule(java.lang.String geodeModuleLocation,
java.lang.String moduleName)
Finds and extracts the geode module associated with the specified module.
|
protected static java.lang.String |
findSessionTestingWar()
Get the path to the session testing war by walking up directories to the correct folder.
|
ServerContainer |
generateContainer(java.io.File containerConfigHome) |
abstract ServerContainer |
generateContainer(java.io.File containerConfigHome,
java.lang.String containerDescriptors)
Generates a
ServerContainer from the given ContainerInstall |
ServerContainer |
generateContainer(java.lang.String containerDescriptors) |
java.io.File |
getCacheXMLFile()
Gets the cache XML file to use by default for this installation
|
ContainerInstall.ConnectionType |
getConnectionType() |
abstract java.lang.String |
getContextSessionManagerClass()
Get the session manager class to use
|
java.lang.String |
getDefaultLocatorAddress()
Gets the
defaultLocatorAddress
This is the address that a container uses by default. |
int |
getDefaultLocatorPort()
Gets the
defaultLocatorPort
This is the port that a container uses by default. |
java.lang.String |
getHome()
Where the installation is located
|
abstract java.lang.String |
getInstallDescription()
A human readable description of the installation
|
abstract java.lang.String |
getInstallId()
Cargo specific string to identify the container with
|
java.lang.String |
getModulePath()
Where the module is located
The module contains jars needed for geode session setup as well as default templates for some
needed XML files.
|
java.lang.String |
getWarFilePath()
The path to the session testing WAR file
|
boolean |
isClientServer()
Whether the installation is client server
Since an installation can only be client server or peer to peer there is no need for a function
which checks for a peer to peer installation (just check if not client server).
|
void |
setDefaultLocator(java.lang.String address,
int port)
Sets the default locator address and port
|
public static final org.apache.logging.log4j.Logger logger
public static final java.lang.String TMP_DIR
public static final java.lang.String GEODE_BUILD_HOME
public static final java.lang.String DEFAULT_INSTALL_DIR
protected static final java.lang.String DEFAULT_MODULE_LOCATION
public static final java.lang.String DEFAULT_MODULE_EXTRACTION_DIR
public ContainerInstall(java.lang.String installDir, java.lang.String downloadURL, ContainerInstall.ConnectionType connType, java.lang.String moduleName) throws java.io.IOException
java.io.IOException
public ContainerInstall(java.lang.String installDir, java.lang.String downloadURL, ContainerInstall.ConnectionType connType, java.lang.String moduleName, java.lang.String geodeModuleLocation) throws java.io.IOException
connType
- Enum representing the connection type of this installation (either client
server or peer to peer)moduleName
- The module name of the installation being setup (i.e. tomcat, appserver,
etc.)java.io.IOException
public ServerContainer generateContainer(java.io.File containerConfigHome) throws java.io.IOException
java.io.IOException
public ServerContainer generateContainer(java.lang.String containerDescriptors) throws java.io.IOException
java.io.IOException
public void clearPreviousInstall(java.lang.String installDir) throws java.io.IOException
java.io.IOException
public void setDefaultLocator(java.lang.String address, int port)
public boolean isClientServer()
public java.lang.String getHome()
public java.lang.String getModulePath()
public java.lang.String getWarFilePath()
public ContainerInstall.ConnectionType getConnectionType()
connType
which represents the type of connection for this
installationpublic java.lang.String getDefaultLocatorAddress()
defaultLocatorAddress
This is the address that a container uses by default. Containers themselves can have their own
personal locator address, but will default to this address unless specifically set.public int getDefaultLocatorPort()
defaultLocatorPort
This is the port that a container uses by default. Containers themselves can have their own
personal locator port, but will default to this port unless specifically set.public java.io.File getCacheXMLFile()
public abstract java.lang.String getInstallId()
public abstract java.lang.String getInstallDescription()
public abstract java.lang.String getContextSessionManagerClass()
public abstract ServerContainer generateContainer(java.io.File containerConfigHome, java.lang.String containerDescriptors) throws java.io.IOException
ServerContainer
from the given ContainerInstall
containerDescriptors
- Additional descriptors used to identify a containerjava.io.IOException
protected static java.lang.String findSessionTestingWar()
protected static java.lang.String findAndExtractModule(java.lang.String geodeModuleLocation, java.lang.String moduleName) throws java.io.IOException
moduleName
- The module name (i.e. tomcat, appserver, etc.) of the module that should be
extract. Used as a search parameter to find the module archive.java.io.IOException
protected static void editPropertyFile(java.lang.String filePath, java.lang.String propertyName, java.lang.String propertyValue, boolean append) throws java.lang.Exception
filePath
- path to the property filepropertyName
- property name to editpropertyValue
- new property valueappend
- whether or not to append the given property value. If true appends the given
property value the current value. If false, replaces the current property value with the
given property valuejava.lang.Exception
protected static void editXMLFile(java.lang.String XMLPath, java.lang.String tagId, java.lang.String tagName, java.lang.String parentTagName, java.util.HashMap<java.lang.String,java.lang.String> attributes)
protected static void editXMLFile(java.lang.String XMLPath, java.lang.String tagName, java.lang.String parentTagName, java.util.HashMap<java.lang.String,java.lang.String> attributes)
protected static void editXMLFile(java.lang.String XMLPath, java.lang.String tagName, java.lang.String parentTagName, java.util.HashMap<java.lang.String,java.lang.String> attributes, boolean writeOnSimilarAttributeNames)
protected static void editXMLFile(java.lang.String XMLPath, java.lang.String tagName, java.lang.String replacementTagName, java.lang.String parentTagName, java.util.HashMap<java.lang.String,java.lang.String> attributes, boolean writeOnSimilarAttributeNames)
protected static void editXMLFile(java.lang.String XMLPath, java.lang.String tagId, java.lang.String tagName, java.lang.String replacementTagName, java.lang.String parentTagName, java.util.HashMap<java.lang.String,java.lang.String> attributes, boolean writeOnSimilarAttributeNames)
findNodeWithAttribute(Document, String, String, String)
,
rewriteNodeAttributes(Node, HashMap)
,
nodeHasExactAttributes(Node, HashMap, boolean)
to edit the required parts of the XML
file.XMLPath
- The path to the xml file to edittagId
- The id of tag to edit. If null, then this method will add a new xml element,
unless writeOnSimilarAttributeNames is set to true.tagName
- The name of the xml element to editreplacementTagName
- The new name of the XML attribute that is being editedparentTagName
- The parent element of the element we should editattributes
- the xml attributes for the element to editwriteOnSimilarAttributeNames
- If true, find an existing element with the same set of
attributes as the attributes parameter, and modifies the attributes of that element,
rather than adding a new element. If false, create a new XML element (unless tagId is
not null).