Class DefaultStreamService

java.lang.Object
org.springframework.cloud.dataflow.server.service.impl.DefaultStreamService
All Implemented Interfaces:
StreamService

@Transactional public class DefaultStreamService extends Object implements 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 Details

    • DEFAULT_SKIPPER_PACKAGE_VERSION

      public static final String DEFAULT_SKIPPER_PACKAGE_VERSION
      See Also:
    • streamDefinitionRepository

      protected final StreamDefinitionRepository 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

      protected final StreamValidationService streamValidationService
  • Constructor Details

  • Method Details

    • doCalculateStreamState

      public org.springframework.cloud.deployer.spi.app.DeploymentState doCalculateStreamState(String name)
    • undeployStream

      public void undeployStream(String streamName)
      Description copied from interface: StreamService
      Un-deploys the stream identified by the given stream name.
      Specified by:
      undeployStream in interface StreamService
      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 interface StreamService
      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

      public void updateStream(String streamName, UpdateStreamRequest updateStreamRequest)
      Description copied from interface: StreamService
      Update the stream using the UpdateStreamRequest.
      Specified by:
      updateStream in interface StreamService
      Parameters:
      streamName - the name of the stream to update
      updateStreamRequest - the UpdateStreamRequest to use during the update
    • updateStream

      public void updateStream(String streamName, String releaseName, org.springframework.cloud.skipper.domain.PackageIdentifier packageIdentifier, Map<String,String> updateProperties, boolean force, List<String> appNames)
    • rollbackStream

      public void rollbackStream(String streamName, int releaseVersion)
      Description copied from interface: StreamService
      Rollback the stream to the previous or a specific version of the stream.
      Specified by:
      rollbackStream in interface StreamService
      Parameters:
      streamName - the name of the stream to rollback
      releaseVersion - 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 interface StreamService
      Parameters:
      streamDefinitions - the list of Stream definitions to calculate the deployment states.
      Returns:
      the map containing the stream definitions and their deployment states.
    • manifest

      public String manifest(String name, int version)
      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 interface StreamService
      Parameters:
      name - the release name
      version - the release version
      Returns:
      the manifest info of a release
    • history

      public Collection<org.springframework.cloud.skipper.domain.Release> history(String releaseName)
      Description copied from interface: StreamService
      Get stream's deployment history
      Specified by:
      history in interface StreamService
      Parameters:
      releaseName - Stream release name
      Returns:
      List or Releases for this release name
    • platformList

      public Collection<org.springframework.cloud.skipper.domain.Deployer> platformList()
      Specified by:
      platformList in interface StreamService
      Returns:
      list of supported deployment platforms
    • info

      public StreamDeployment info(String streamName)
      Description copied from interface: StreamService
      Get stream information including the deployment properties etc.
      Specified by:
      info in interface StreamService
      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 interface StreamService
      Parameters:
      streamName - stream name
      dsl - DSL definition for stream
      description - description of the stream definition
      deploy - if true, the stream is deployed upon creation (default is false)
      deploymentProperties - the optional deployment properties to use when the stream is deployed upon creation
      Returns:
      the created stream definition already exists
    • createStreamDefinition

      public StreamDefinition createStreamDefinition(String streamName, String dsl, String description)
    • deployStream

      public void deployStream(String streamName, Map<String,String> deploymentProperties)
      Deploys the stream with the user provided deployment properties. Implementations are responsible for expanding deployment wildcard expressions.
      Specified by:
      deployStream in interface StreamService
      Parameters:
      streamName - the name of the stream
      deploymentProperties - deployment properties to use as passed in from the client.
    • deleteStream

      public void deleteStream(String streamName)
      Delete the stream, including undeloying.
      Specified by:
      deleteStream in interface StreamService
      Parameters:
      streamName - the name of the stream to delete
    • deleteAll

      public void deleteAll()
      Delete all streams, including undeploying.
      Specified by:
      deleteAll in interface StreamService
    • findRelatedStreams

      public List<StreamDefinition> findRelatedStreams(String streamName, boolean nested)
      Find streams related to the given stream name.
      Specified by:
      findRelatedStreams in interface StreamService
      Parameters:
      streamName - name of the stream
      nested - 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 interface StreamService
      Parameters:
      pageable - Pagination information
      search - the findByTaskNameContains parameter to use
      Returns:
      Page of stream definitions
    • findOne

      public StreamDefinition findOne(String streamDefinitionName)
      Find a stream definition by name.
      Specified by:
      findOne in interface StreamService
      Parameters:
      streamDefinitionName - the name of the stream definition
      Returns:
      the stream definition
      Throws:
      NoSuchStreamDefinitionException - if the definition can not be found.
    • validateStream

      public ValidationStatus validateStream(String name)
      Verifies that all apps in the stream are valid.
      Specified by:
      validateStream in interface StreamService
      Parameters:
      name - the name of the definition
      Returns:
      ValidationStatus for a stream.