Class BluePipelineFactory

  • All Implemented Interfaces:
    ExtensionPoint

    public abstract class BluePipelineFactory
    extends Object
    implements ExtensionPoint
    Factory that gives instance of BluePipeline It's useful for example in cases where a plugin that has custom project and they want to serve extra meta-data thru BluePipeline, would provide implementation of their BluePipeline and and implementation of BluePipelineFactory.
    Author:
    Vivek Pandey
    • Constructor Detail

      • BluePipelineFactory

        public BluePipelineFactory()
    • Method Detail

      • getPipeline

        public abstract BluePipeline getPipeline​(Item item,
                                                 Reachable parent,
                                                 BlueOrganization organization)
        Parameters:
        item - to convert into a pipeline
        parent - of the item
        organization - the item is a child of
        Returns:
        resolved pipeline or null
      • resolve

        public abstract Resource resolve​(Item context,
                                         Reachable parent,
                                         Item target,
                                         BlueOrganization organization)
        Finds a blue ocean API model object that pairs up with the given target, by looking at the intermediate core model object context that is an ancestor of target. If this BluePipelineFactory understands how to map context to BluePipeline (as in getPipeline(item,parent)!=null), then the resolve method should also apply the same logic to map context and then recursively resolve target.
        Parameters:
        context - This is always an ancestor of target (including target==context)
        parent - The parent object of the blue ocean API model object that pairs up with the 'context' parameter
        target - The core model object that we are trying to map to Resource
        organization - The organization that the context and target are a child of
        Returns:
        null if this implementation doesn't know how to map context to a blue ocean API model object. Otherwise return the BO API model object that pairs up with target
      • resolve

        public static Resource resolve​(Item item)
        Given a Job in Jenkins, map that to corresponding blue ocean API object, for example so that you can get its URL.
      • findNextStep

        protected static Item findNextStep​(ItemGroup context,
                                           Item target)
        Returns the immediate child of 'context' that is also the ancestor of 'target'
      • getPipelineInstance

        public static BluePipeline getPipelineInstance​(Item item,
                                                       Reachable parent)
        Gives BluePipeline instance from the first pipeline found.
        Parameters:
        item - Item for which corresponding BlueOcean API object needs to be found. Must implement TopLevelItem for return to be not null
        parent - Parent Reachable object
        Returns:
        BluePipeline if a map of item to BlueOcean API found, null otherwise.