Class DefaultStreamService
java.lang.Object
org.springframework.cloud.dataflow.server.service.impl.DefaultStreamService
- All Implemented Interfaces:
StreamService
Performs manipulation on application and deployment properties, expanding shorthand
application property values, resolving wildcard deployment properties, and creates a
StreamDeploymentRequest
.
The StreamService
deployer is agnostic. For deploying streams on Skipper use
the DefaultStreamService
.
- Author:
- Mark Pollack, Ilayaperumal Gopinathan, Christian Tzolov, Gunnar Hillert, Chris Schaefer, Chris Bono
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.springframework.cloud.dataflow.audit.service.AuditRecordService
protected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtils
static final String
protected final StreamDefinitionRepository
The repository this controller will use for stream CRUD operations.protected final StreamValidationService
-
Constructor Summary
ConstructorDescriptionDefaultStreamService
(StreamDefinitionRepository streamDefinitionRepository, SkipperStreamDeployer skipperStreamDeployer, AppDeploymentRequestCreator appDeploymentRequestCreator, StreamValidationService streamValidationService, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, StreamDefinitionService streamDefinitionService) -
Method Summary
Modifier and TypeMethodDescriptioncreateStream
(String streamName, String dsl, String description, boolean deploy, Map<String, String> deploymentProperties) Create a new stream.createStreamDefinition
(String streamName, String dsl, String description) void
Delete all streams, including undeploying.void
deleteStream
(String streamName) Delete the stream, including undeloying.void
deployStream
(String streamName, Map<String, String> deploymentProperties) Deploys the stream with the user provided deployment properties.org.springframework.cloud.deployer.spi.app.DeploymentState
doCalculateStreamState
(String name) org.springframework.data.domain.Page<StreamDefinition>
findDefinitionByNameContains
(org.springframework.data.domain.Pageable pageable, String search) Find stream definitions where the findByTaskNameContains parameterFind a stream definition by name.findRelatedStreams
(String streamName, boolean nested) Find streams related to the given stream name.Collection<org.springframework.cloud.skipper.domain.Release>
Get stream's deployment historyGet stream information including the deployment properties etc.Return a manifest info of a release version.Collection<org.springframework.cloud.skipper.domain.Deployer>
void
rollbackStream
(String streamName, int releaseVersion) Rollback the stream to the previous or a specific version of the stream.void
scaleApplicationInstances
(String streamName, String appName, int count, Map<String, String> properties) Scale application instances in a deployed stream.Map<StreamDefinition,
org.springframework.cloud.deployer.spi.app.DeploymentState> state
(List<StreamDefinition> streamDefinitions) Retrieve the deployment state for list of stream definitions.void
undeployStream
(String streamName) Un-deploys the stream identified by the given stream name.void
updateStream
(String streamName, String releaseName, org.springframework.cloud.skipper.domain.PackageIdentifier packageIdentifier, Map<String, String> updateProperties, boolean force, List<String> appNames) void
updateStream
(String streamName, UpdateStreamRequest updateStreamRequest) Update the stream using the UpdateStreamRequest.validateStream
(String name) Verifies that all apps in the stream are valid.
-
Field Details
-
DEFAULT_SKIPPER_PACKAGE_VERSION
- See Also:
-
streamDefinitionRepository
The repository this controller will use for stream CRUD operations. -
auditRecordService
protected final org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService -
auditServiceUtils
protected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtils auditServiceUtils -
streamValidationService
-
-
Constructor Details
-
DefaultStreamService
public DefaultStreamService(StreamDefinitionRepository streamDefinitionRepository, SkipperStreamDeployer skipperStreamDeployer, AppDeploymentRequestCreator appDeploymentRequestCreator, StreamValidationService streamValidationService, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, StreamDefinitionService streamDefinitionService)
-
-
Method Details
-
doCalculateStreamState
public org.springframework.cloud.deployer.spi.app.DeploymentState doCalculateStreamState(String name) -
undeployStream
Description copied from interface:StreamService
Un-deploys the stream identified by the given stream name.- Specified by:
undeployStream
in interfaceStreamService
- Parameters:
streamName
- the name of the stream to un-deploy
-
scaleApplicationInstances
public void scaleApplicationInstances(String streamName, String appName, int count, Map<String, String> properties) Description copied from interface:StreamService
Scale application instances in a deployed stream.- Specified by:
scaleApplicationInstances
in interfaceStreamService
- Parameters:
streamName
- the name of an existing stream definition (required)appName
- in stream application name to scale (required)count
- number of instances for the selected stream application (required)properties
- scale deployment specific properties (optional)
-
updateStream
Description copied from interface:StreamService
Update the stream using the UpdateStreamRequest.- Specified by:
updateStream
in interfaceStreamService
- Parameters:
streamName
- the name of the stream to updateupdateStreamRequest
- the UpdateStreamRequest to use during the update
-
updateStream
-
rollbackStream
Description copied from interface:StreamService
Rollback the stream to the previous or a specific version of the stream.- Specified by:
rollbackStream
in interfaceStreamService
- Parameters:
streamName
- the name of the stream to rollbackreleaseVersion
- the version to rollback to (if not specified, rollback to the previous deleted/deployed release version of the stream.
-
state
public Map<StreamDefinition,org.springframework.cloud.deployer.spi.app.DeploymentState> state(List<StreamDefinition> streamDefinitions) Description copied from interface:StreamService
Retrieve the deployment state for list of stream definitions.- Specified by:
state
in interfaceStreamService
- Parameters:
streamDefinitions
- the list of Stream definitions to calculate the deployment states.- Returns:
- the map containing the stream definitions and their deployment states.
-
manifest
Description copied from interface:StreamService
Return a manifest info of a release version. For packages with dependencies, the manifest includes the contents of those dependencies.- Specified by:
manifest
in interfaceStreamService
- Parameters:
name
- the release nameversion
- the release version- Returns:
- the manifest info of a release
-
history
Description copied from interface:StreamService
Get stream's deployment history- Specified by:
history
in interfaceStreamService
- Parameters:
releaseName
- Stream release name- Returns:
- List or Releases for this release name
-
platformList
- Specified by:
platformList
in interfaceStreamService
- Returns:
- list of supported deployment platforms
-
info
Description copied from interface:StreamService
Get stream information including the deployment properties etc.- Specified by:
info
in interfaceStreamService
- Parameters:
streamName
- the name of the stream- Returns:
- the stream deployment information
-
createStream
public StreamDefinition createStream(String streamName, String dsl, String description, boolean deploy, Map<String, String> deploymentProperties) Description copied from interface:StreamService
Create a new stream.- Specified by:
createStream
in interfaceStreamService
- Parameters:
streamName
- stream namedsl
- DSL definition for streamdescription
- description of the stream definitiondeploy
- iftrue
, the stream is deployed upon creation (default isfalse
)deploymentProperties
- the optional deployment properties to use when the stream is deployed upon creation- Returns:
- the created stream definition already exists
-
createStreamDefinition
-
deployStream
Deploys the stream with the user provided deployment properties. Implementations are responsible for expanding deployment wildcard expressions.- Specified by:
deployStream
in interfaceStreamService
- Parameters:
streamName
- the name of the streamdeploymentProperties
- deployment properties to use as passed in from the client.
-
deleteStream
Delete the stream, including undeloying.- Specified by:
deleteStream
in interfaceStreamService
- Parameters:
streamName
- the name of the stream to delete
-
deleteAll
public void deleteAll()Delete all streams, including undeploying.- Specified by:
deleteAll
in interfaceStreamService
-
findRelatedStreams
Find streams related to the given stream name.- Specified by:
findRelatedStreams
in interfaceStreamService
- Parameters:
streamName
- name of the streamnested
- if should recursively findByTaskNameContains for related stream definitions- Returns:
- a list of related stream definitions
-
findDefinitionByNameContains
public org.springframework.data.domain.Page<StreamDefinition> findDefinitionByNameContains(org.springframework.data.domain.Pageable pageable, String search) Find stream definitions where the findByTaskNameContains parameter- Specified by:
findDefinitionByNameContains
in interfaceStreamService
- Parameters:
pageable
- Pagination informationsearch
- the findByTaskNameContains parameter to use- Returns:
- Page of stream definitions
-
findOne
Find a stream definition by name.- Specified by:
findOne
in interfaceStreamService
- Parameters:
streamDefinitionName
- the name of the stream definition- Returns:
- the stream definition
- Throws:
NoSuchStreamDefinitionException
- if the definition can not be found.
-
validateStream
Verifies that all apps in the stream are valid.- Specified by:
validateStream
in interfaceStreamService
- Parameters:
name
- the name of the definition- Returns:
ValidationStatus
for a stream.
-