Class JsonStreamService

  • All Implemented Interfaces:
    StreamService

    public class JsonStreamService
    extends Object
    implements StreamService
    A stream service which reads stream data from the specified JSON file. This implementation assumes that streams are written in order in the json file, i.e. the most recent (upstream) issue is specified as the first JSON object in the "streams" JSON array. An example JSON file can be found at https://github.com/jboss-set/jboss-streams
    Author:
    Ryan Emerson, baranowb
    • Constructor Detail

      • JsonStreamService

        public JsonStreamService()
    • Method Detail

      • updateStreams

        public boolean updateStreams()
                              throws NotFoundException
        Description copied from interface: StreamService
        Trigger for updating streams information. Generally implementation if free to decide if updtes only on change on method being triggered or via other means(timed). Note, that internally, service is free to keep information up2date by any means is sees fit.
        Specified by:
        updateStreams in interface StreamService
        Returns:
        • true - if streams information has been updated
        • false - if streams information remain unchanged
        Throws:
        NotFoundException
      • getStreams

        public List<org.jboss.set.aphrodite.domain.Stream> getStreams()
        Description copied from interface: StreamService
        Returns all streams discovered by this service.
        Specified by:
        getStreams in interface StreamService
        Returns:
        a list of all streams discovered by this StreamService, or an empty list if no streams exist.
      • getStream

        public org.jboss.set.aphrodite.domain.Stream getStream​(String streamName)
        Description copied from interface: StreamService
        Get a specific Stream object based upon its String name.
        Specified by:
        getStream in interface StreamService
        Parameters:
        streamName - the name of the Stream to be returned.
        Returns:
        Stream the Stream object which corresponds to the specified streamName if it exists, otherwise null.
      • getDistinctURLRepositories

        public List<URI> getDistinctURLRepositories()
        Description copied from interface: StreamService
        Retrieve all Repositories across all Streams. Note, that only Repository objects with distinct URLs are returned. This method should never return the same repository twice.
        Specified by:
        getDistinctURLRepositories in interface StreamService
        Returns:
        a list of unique Repositories.
      • getDistinctURLRepositoriesByStream

        public List<URI> getDistinctURLRepositoriesByStream​(String streamName)
        Description copied from interface: StreamService
        Retrieve the URLs of all Repositories associated with a given Stream. Note, that only Repository objects with distinct URLs are returned. This method should never return the same repository twice.
        Specified by:
        getDistinctURLRepositoriesByStream in interface StreamService
        Parameters:
        streamName - the name of the Stream containing the returned repositories.
        Returns:
        a list of unique Repositories.
      • getStreamsBy

        public List<org.jboss.set.aphrodite.domain.Stream> getStreamsBy​(URI repositoryURL,
                                                                        org.jboss.set.aphrodite.domain.Codebase codebase)
        Description copied from interface: StreamService
        Find all the streams associated to the given repository and codebase
        Specified by:
        getStreamsBy in interface StreamService
        Parameters:
        repositoryURL - the Repository to search against.
        codebase - the Codebase to search against.
        Returns:
        a list of named Stream objects.
      • getComponentBy

        public org.jboss.set.aphrodite.domain.StreamComponent getComponentBy​(URI repositoryURL,
                                                                             org.jboss.set.aphrodite.domain.Codebase codebase)
        Description copied from interface: StreamService
        Get the StreamComponent which specifies the given repository and codebase. Note, this returns the first matching component in the Stream data.
        Specified by:
        getComponentBy in interface StreamService
        Parameters:
        repositoryURL - the Repository to be searched against.
        codebase - the codebase to be searched against.
        Returns:
        the StreamComponent associated with the given repository and codebase, or null if a StreamComponent does not exist
      • updateStreamComponent

        public org.jboss.set.aphrodite.domain.StreamComponent updateStreamComponent​(org.jboss.set.aphrodite.domain.StreamComponent streamComponent)
                                                                             throws org.jboss.set.aphrodite.domain.StreamComponentUpdateException
        Description copied from interface: StreamService
        Updates stream component version in memory and in back end storage if possible.
        Specified by:
        updateStreamComponent in interface StreamService
        Parameters:
        streamComponent - - component which should be updated
        Returns:
        mutated object with new component version, after update.
        Throws:
        org.jboss.set.aphrodite.domain.StreamComponentUpdateException - - in case there is some error on update.