Class CobiGenUtils


  • public class CobiGenUtils
    extends java.lang.Object
    Utilities class for CobiGen related operations. For instance, it creates a new CobiGen instance and registers all the plug-ins
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CLI_HOME
      CLI home folder for pom.xml configuration
    • Constructor Summary

      Constructors 
      Constructor Description
      CobiGenUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.File extractArtificialPom()
      Extracts an artificial POM which defines all the CobiGen plug-ins that are needed
      static java.nio.file.Path getCliHomePath()  
      static com.devonfw.cobigen.api.CobiGen initializeCobiGen​(java.nio.file.Path templatesProject)
      Registers CobiGen plug-ins and instantiates CobiGen
      static java.lang.Object process​(com.devonfw.cobigen.api.InputInterpreter inputInterpreter, java.nio.file.Path file, java.lang.ClassLoader cl)
      Processes the given file to be converted into any CobiGen valid input format
      static java.lang.ClassLoader registerPlugins()
      Registers the given different CobiGen plug-ins by building an artificial POM extracted next to the CLI location and then adding the needed URLs to the class loader.
      static java.util.List<com.devonfw.cobigen.api.to.IncrementTo> retainAllIncrements​(java.util.List<com.devonfw.cobigen.api.to.IncrementTo> currentList, java.util.List<com.devonfw.cobigen.api.to.IncrementTo> listToIntersect)
      For Increments Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation).
      static java.util.List<com.devonfw.cobigen.api.to.TemplateTo> retainAllTemplates​(java.util.List<com.devonfw.cobigen.api.to.TemplateTo> currentList, java.util.List<com.devonfw.cobigen.api.to.TemplateTo> listToIntersect)
      For Templates Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CLI_HOME

        public static final java.lang.String CLI_HOME
        CLI home folder for pom.xml configuration
        See Also:
        Constant Field Values
    • Constructor Detail

      • CobiGenUtils

        public CobiGenUtils()
    • Method Detail

      • initializeCobiGen

        public static com.devonfw.cobigen.api.CobiGen initializeCobiGen​(java.nio.file.Path templatesProject)
        Registers CobiGen plug-ins and instantiates CobiGen
        Parameters:
        templatesProject - the templates project or jar
        Returns:
        object of CobiGen
      • getCliHomePath

        public static java.nio.file.Path getCliHomePath()
        Returns:
        the home path of the CLI
      • registerPlugins

        public static java.lang.ClassLoader registerPlugins()
        Registers the given different CobiGen plug-ins by building an artificial POM extracted next to the CLI location and then adding the needed URLs to the class loader.
        Returns:
        the classloader created for registering plugins
      • extractArtificialPom

        public static java.io.File extractArtificialPom()
        Extracts an artificial POM which defines all the CobiGen plug-ins that are needed
        Returns:
        the extracted POM file
      • retainAllIncrements

        public static java.util.List<com.devonfw.cobigen.api.to.IncrementTo> retainAllIncrements​(java.util.List<com.devonfw.cobigen.api.to.IncrementTo> currentList,
                                                                                                 java.util.List<com.devonfw.cobigen.api.to.IncrementTo> listToIntersect)
        For Increments Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation). In other words, the resultant list removes from this list all of its elements that are not contained in the specified collection.
        Parameters:
        currentList - list containing elements to be retained in this list
        listToIntersect - second list to be used for the intersection
        Returns:
        resultant list containing increments that are in both lists
      • retainAllTemplates

        public static java.util.List<com.devonfw.cobigen.api.to.TemplateTo> retainAllTemplates​(java.util.List<com.devonfw.cobigen.api.to.TemplateTo> currentList,
                                                                                               java.util.List<com.devonfw.cobigen.api.to.TemplateTo> listToIntersect)
        For Templates Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation). In other words, the resultant list removes from this list all of its elements that are not contained in the specified collection.
        Parameters:
        currentList - list containing elements to be retained in this list
        listToIntersect - second list to be used for the intersection
        Returns:
        resultant list containing increments that are in both lists
      • process

        public static java.lang.Object process​(com.devonfw.cobigen.api.InputInterpreter inputInterpreter,
                                               java.nio.file.Path file,
                                               java.lang.ClassLoader cl)
                                        throws com.devonfw.cobigen.api.exception.InputReaderException
        Processes the given file to be converted into any CobiGen valid input format
        Parameters:
        file - File converted into any CobiGen valid input format
        cl - ClassLoader to be used, when considering Java-related inputs
        inputInterpreter - parse cobiGen compliant input from the file
        Returns:
        a CobiGen valid input
        Throws:
        com.devonfw.cobigen.api.exception.InputReaderException - if the input retrieval did not result in a valid CobiGen input