public abstract class AbstractLocalDeployerSupport extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
AbstractLocalDeployerSupport.Instance |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SERVER_PORT |
protected org.slf4j.Logger |
logger |
static String |
SPRING_APPLICATION_JSON |
protected static Set<Integer> |
usedPorts |
Constructor and Description |
---|
AbstractLocalDeployerSupport(LocalDeployerProperties localDeployerProperties)
Instantiates a new abstract deployer support.
|
Modifier and Type | Method and Description |
---|---|
protected LocalDeployerProperties |
bindDeploymentProperties(Map<String,String> runtimeDeploymentProperties)
This will merge the deployment properties that were passed in at runtime with the
deployment properties of the Deployer instance.
|
protected ProcessBuilder |
buildProcessBuilder(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request,
Map<String,String> appInstanceEnv,
Optional<Integer> appInstanceNumber,
String deploymentId)
Builds the process builder.
|
protected org.springframework.web.client.RestTemplate |
buildRestTemplate(LocalDeployerProperties properties)
Builds a
RestTemplate used for calling app's shutdown endpoint. |
protected int |
calcServerPort(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request,
boolean useDynamicPort,
Map<String,String> appInstanceEnvVars) |
protected org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo |
createRuntimeEnvironmentInfo(Class<?> spiClass,
Class<?> implementationClass)
Create the RuntimeEnvironmentInfo.
|
protected Map<String,String> |
formatApplicationProperties(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request,
Map<String,String> appInstanceEnvToUse) |
protected CommandBuilder |
getCommandBuilder(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
Detects the Command builder by the type of the resource in the requests.
|
protected LocalDeployerProperties |
getLocalDeployerProperties()
Gets the local deployer properties.
|
int |
getRandomPort(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request) |
protected boolean |
isAlive(Process process) |
protected Integer |
isServerPortKeyPresentOnArgs(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request) |
protected boolean |
shouldInheritLogging(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
Will check if
LocalDeployerProperties.INHERIT_LOGGING is set by checking
deployment properties. |
protected void |
shutdownAndWait(AbstractLocalDeployerSupport.Instance instance)
Shut down the
Process backing the application AbstractLocalDeployerSupport.Instance . |
protected boolean |
useSpringApplicationJson(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request) |
static String[] |
windowsSupport(String[] commands)
tweak escaping double quotes needed for windows
|
protected final org.slf4j.Logger logger
public static final String SPRING_APPLICATION_JSON
public static final int DEFAULT_SERVER_PORT
public AbstractLocalDeployerSupport(LocalDeployerProperties localDeployerProperties)
localDeployerProperties
- the local deployer propertiesprotected org.springframework.web.client.RestTemplate buildRestTemplate(LocalDeployerProperties properties)
RestTemplate
used for calling app's shutdown endpoint. If needed can
be overridden from an implementing class. This default implementation sets connection
and read timeouts for SimpleClientHttpRequestFactory
and configures
RestTemplate
to use that factory. If shutdown timeout in properties negative,
returns default RestTemplate
which doesn't use timeouts.properties
- the local deployer propertiesprotected org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo createRuntimeEnvironmentInfo(Class<?> spiClass, Class<?> implementationClass)
protected final LocalDeployerProperties getLocalDeployerProperties()
protected ProcessBuilder buildProcessBuilder(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request, Map<String,String> appInstanceEnv, Optional<Integer> appInstanceNumber, String deploymentId)
ProcessBuilder
.request
- the requestappInstanceEnv
- the instance environment variablesprotected CommandBuilder getCommandBuilder(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
request
- deployment request containing information about the resource to be deployed.public static String[] windowsSupport(String[] commands)
commands
- protected LocalDeployerProperties bindDeploymentProperties(Map<String,String> runtimeDeploymentProperties)
runtimeDeploymentProperties
- deployment properties passed in at runtimeprotected Map<String,String> formatApplicationProperties(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request, Map<String,String> appInstanceEnvToUse)
protected void shutdownAndWait(AbstractLocalDeployerSupport.Instance instance)
Process
backing the application AbstractLocalDeployerSupport.Instance
. If the
application exposes a /shutdown
endpoint, that will be invoked followed by a
wait that will not exceed the number of seconds indicated by
LocalDeployerProperties.getShutdownTimeout()
. If the timeout period is exceeded (or
if the /shutdown
endpoint is not exposed), the process will be shut down via
Process.destroy()
.instance
- the application instance to shut downprotected boolean isAlive(Process process)
protected boolean useSpringApplicationJson(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
protected int calcServerPort(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request, boolean useDynamicPort, Map<String,String> appInstanceEnvVars)
protected boolean shouldInheritLogging(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
LocalDeployerProperties.INHERIT_LOGGING
is set by checking
deployment properties.public int getRandomPort(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
protected Integer isServerPortKeyPresentOnArgs(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.