public class ModuleDeploymentWriter
extends java.lang.Object
/xd/deployments/modules
.
There are several writeDeployment
methods that allow for targeting
a deployment to a specific container or to a collection of containers indicated
by the ContainerMatcher
passed into
the constructor.
General usage is to invoke writeDeployment
and examine the ModuleDeploymentWriter.Result
object that is returned. This invocation will block until:
DEFAULT_TIMEOUT
.validateResult(org.springframework.xd.dirt.server.ModuleDeploymentWriter.Result)
and validateResults(java.util.Collection<org.springframework.xd.dirt.server.ModuleDeploymentWriter.Result>)
can
be used to examine the returned result and throw an IllegalStateException
if a module deployment timed out. Otherwise the results may be examined to
obtain detailed information about each deployment attempt and its result.Modifier and Type | Class and Description |
---|---|
static interface |
ModuleDeploymentWriter.ContainerAwareModuleDeploymentPropertiesProvider
Callback interface to obtain
ModuleDeploymentProperties
for a ModuleDescriptor within the context of deployment
to the provided Container . |
static interface |
ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider
Callback interface to obtain
ModuleDeploymentProperties
for a ModuleDescriptor . |
static class |
ModuleDeploymentWriter.Result
Result of a module deployment request.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ERROR_DESCRIPTION_KEY
Key used in status map to provide an error description.
|
static java.lang.String |
STATUS_KEY
Key used in status map to indicate the module deployment status.
|
Constructor and Description |
---|
ModuleDeploymentWriter(ZooKeeperConnection zkConnection,
ContainerRepository containerRepository,
ContainerMatcher containerMatcher)
Construct a
ModuleDeploymentWriter with the default timeout
value indicated by DEFAULT_TIMEOUT . |
ModuleDeploymentWriter(ZooKeeperConnection zkConnection,
ContainerRepository containerRepository,
ContainerMatcher containerMatcher,
long timeout)
Construct a
ModuleDeploymentWriter . |
Modifier and Type | Method and Description |
---|---|
void |
validateResult(ModuleDeploymentWriter.Result result)
Validate the result.
|
void |
validateResults(java.util.Collection<ModuleDeploymentWriter.Result> results)
Validate the results.
|
java.util.Collection<ModuleDeploymentWriter.Result> |
writeDeployment(java.util.Iterator<ModuleDescriptor> descriptors,
ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider provider)
Write module deployment requests for the modules returned by the
descriptors
iterator. |
java.util.Collection<ModuleDeploymentWriter.Result> |
writeDeployment(java.util.Iterator<ModuleDescriptor> descriptors,
ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider provider,
ContainerMatcher containerMatcher)
Write module deployment requests for the modules returned by the
descriptors
iterator. |
ModuleDeploymentWriter.Result |
writeDeployment(ModuleDescriptor descriptor,
Container container)
Write a deployment request for the module to the container.
|
ModuleDeploymentWriter.Result |
writeDeployment(ModuleDescriptor moduleDescriptor,
ModuleDeploymentProperties deploymentProperties,
ContainerMatcher containerMatcher)
Write a module deployment request for the provided module descriptor
using the provided properties.
|
public static final java.lang.String STATUS_KEY
ContainerRegistrar
,
Constant Field Valuespublic static final java.lang.String ERROR_DESCRIPTION_KEY
ContainerRegistrar
,
Constant Field Valuespublic ModuleDeploymentWriter(ZooKeeperConnection zkConnection, ContainerRepository containerRepository, ContainerMatcher containerMatcher)
ModuleDeploymentWriter
with the default timeout
value indicated by DEFAULT_TIMEOUT
.zkConnection
- ZooKeeper connectioncontainerRepository
- repository for containers in the clustercontainerMatcher
- matcher for modules to containerspublic ModuleDeploymentWriter(ZooKeeperConnection zkConnection, ContainerRepository containerRepository, ContainerMatcher containerMatcher, long timeout)
ModuleDeploymentWriter
.zkConnection
- ZooKeeper connectioncontainerRepository
- repository for containers in the clustercontainerMatcher
- matcher for modules to containerstimeout
- amount of time to wait for module deploymentspublic ModuleDeploymentWriter.Result writeDeployment(ModuleDescriptor descriptor, Container container) throws java.lang.InterruptedException, NoContainerException
descriptor
- module descriptor for module to be deployedcontainer
- target container for deploymentjava.lang.InterruptedException
- if the executing thread is interruptedNoContainerException
- if there are no containers that match the criteria
for module deploymentpublic java.util.Collection<ModuleDeploymentWriter.Result> writeDeployment(java.util.Iterator<ModuleDescriptor> descriptors, ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider provider) throws java.lang.InterruptedException, NoContainerException
descriptors
iterator. The target containers are indicated by containerMatcher
and
the ModuleDeploymentProperties
provided
by the ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider
.descriptors
- descriptors for modules to deployprovider
- callback to obtain the deployment properties for a modulejava.lang.InterruptedException
- if the executing thread is interruptedNoContainerException
- if there are no containers that match the criteria
for module deploymentpublic ModuleDeploymentWriter.Result writeDeployment(ModuleDescriptor moduleDescriptor, ModuleDeploymentProperties deploymentProperties, ContainerMatcher containerMatcher) throws java.lang.InterruptedException, NoContainerException
ModuleDeploymentProperties
are provided, it is
assumed that the provided ContainerMatcher
will only return
one container. This method should be used for module redeployment
when a container exits the cluster.moduleDescriptor
- descriptor for module to deploydeploymentProperties
- deployment properties for modulecontainerMatcher
- matcher for modules to containersjava.lang.InterruptedException
- if the executing thread is interruptedNoContainerException
- if there are no containers that match the criteria
for module deploymentpublic java.util.Collection<ModuleDeploymentWriter.Result> writeDeployment(java.util.Iterator<ModuleDescriptor> descriptors, ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider provider, ContainerMatcher containerMatcher) throws java.lang.InterruptedException, NoContainerException
descriptors
iterator. The target containers are indicated by the provided containerMatcher
and the ModuleDeploymentProperties
provided
by the ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider
.descriptors
- descriptors for modules to deployprovider
- callback to obtain the deployment properties for a modulecontainerMatcher
- matcher for modules to containersjava.lang.InterruptedException
- if the executing thread is interruptedNoContainerException
- if there are no containers that match the criteria
for module deploymentpublic void validateResult(ModuleDeploymentWriter.Result result)
result
- result to validatejava.lang.IllegalStateException
- if the result does not indicate
a successful deploymentpublic void validateResults(java.util.Collection<ModuleDeploymentWriter.Result> results) throws java.lang.IllegalStateException
results
- results to validatejava.lang.IllegalStateException
- if the result does not indicate
a successful deployment