test_class.declarator: metadata
test_class.modifier: private
test_class.original_string: private CharStream metadata;
test_class.type: CharStream
test_class.var_name: metadata
test_class.file: org.eclipse.winery.crawler/src/test/java/org/eclipse/winery/crawler/chefcookbooks/ChefCookbookAnalyzerTest.java
test_class.identifier: ChefCookbookAnalyzerTest
test_case.body: @Test
      public void compileMyAppCookbook() {
          String cookbookName = "myapp";
          String cookbookPath;
          ClassLoader classLoader = getClass().getClassLoader();
          File file = new File(classLoader.getResource(cookbookName).getFile());
          CookbookParseResult cookbookParseResult = new CookbookParseResult(cookbookName);
          cookbookPath = file.getAbsolutePath().replace("\\", "/");
          cookbookParseResult.setCookbookPath(cookbookPath);
          cookbookParseResult = new ChefCookbookAnalyzer().compileCookbook(cookbookParseResult, false);
          cookbookParseResult.clear();
  
          /**
           * Dependencies are stored in dependencies folder of the myapp cookbook
           * Delete downloaded dependencies
           */
          file = new File(classLoader.getResource("myapp/dependencies").getFile());
          CrawledCookbooks.deleteFile(file.getPath());
      }
test_case.class_method_signature: ChefCookbookAnalyzerTest.compileMyAppCookbook()
test_case.full_signature: @Test public void compileMyAppCookbook()
test_case.identifier: compileMyAppCookbook
test_case.invocations: getClassLoader getClass getFile getResource replace getAbsolutePath setCookbookPath compileCookbook clear getFile getResource deleteFile getPath
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void compileMyAppCookbook()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(ChefCookbookAnalyzer.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(ChefCookbookAnalyzer.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: org.eclipse.winery.crawler/src/main/java/org/eclipse/winery/crawler/chefcookbooks/ChefCookbookAnalyzer.java
focal_class.identifier: ChefCookbookAnalyzer
focal_class.class_method_signature: ChefCookbookAnalyzer.main()
focal_class.full_signature: public void main()
focal_class.identifier: main
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void main()
focal_class.class_method_signature: ChefCookbookAnalyzer.compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_class.full_signature: public CookbookParseResult compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_class.identifier: compileCookbook
focal_class.modifiers: public
focal_class.parameters: (CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_class.class_method_signature: ChefCookbookAnalyzer.compile(CharStream input, CookbookParseResult cookbookConfigs)
focal_class.full_signature: public static CookbookParseResult compile(CharStream input, CookbookParseResult cookbookConfigs)
focal_class.identifier: compile
focal_class.modifiers: public static
focal_class.parameters: (CharStream input, CookbookParseResult cookbookConfigs)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult compile(CharStream input, CookbookParseResult cookbookConfigs)
focal_class.class_method_signature: ChefCookbookAnalyzer.returnComponentTypesFromMetadata(CookbookParseResult cookbookConfigs)
focal_class.full_signature: private CookbookParseResult returnComponentTypesFromMetadata(CookbookParseResult cookbookConfigs)
focal_class.identifier: returnComponentTypesFromMetadata
focal_class.modifiers: private
focal_class.parameters: (CookbookParseResult cookbookConfigs)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult returnComponentTypesFromMetadata(CookbookParseResult cookbookConfigs)
focal_class.class_method_signature: ChefCookbookAnalyzer.returnComponentTypesFromAttributes(CookbookParseResult cookbookConfigs)
focal_class.full_signature: private CookbookParseResult returnComponentTypesFromAttributes(CookbookParseResult cookbookConfigs)
focal_class.identifier: returnComponentTypesFromAttributes
focal_class.modifiers: private
focal_class.parameters: (CookbookParseResult cookbookConfigs)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult returnComponentTypesFromAttributes(CookbookParseResult cookbookConfigs)
focal_class.class_method_signature: ChefCookbookAnalyzer.returnComponentTypesFromRecipes(CookbookParseResult cookbookConfigs)
focal_class.full_signature: private CookbookParseResult returnComponentTypesFromRecipes(CookbookParseResult cookbookConfigs)
focal_class.identifier: returnComponentTypesFromRecipes
focal_class.modifiers: private
focal_class.parameters: (CookbookParseResult cookbookConfigs)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult returnComponentTypesFromRecipes(CookbookParseResult cookbookConfigs)
focal_class.class_method_signature: ChefCookbookAnalyzer.getParseResultFromFile(CookbookParseResult cookbookConfigs, String rbFilePath)
focal_class.full_signature: public static CookbookParseResult getParseResultFromFile(CookbookParseResult cookbookConfigs, String rbFilePath)
focal_class.identifier: getParseResultFromFile
focal_class.modifiers: public static
focal_class.parameters: (CookbookParseResult cookbookConfigs, String rbFilePath)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult getParseResultFromFile(CookbookParseResult cookbookConfigs, String rbFilePath)
focal_class.class_method_signature: ChefCookbookAnalyzer.addPlatformVersionInformationFromKitchen(CookbookParseResult cookbookConfigs)
focal_class.full_signature: private CookbookParseResult addPlatformVersionInformationFromKitchen(CookbookParseResult cookbookConfigs)
focal_class.identifier: addPlatformVersionInformationFromKitchen
focal_class.modifiers: private
focal_class.parameters: (CookbookParseResult cookbookConfigs)
focal_class.return: CookbookParseResult
focal_class.signature: CookbookParseResult addPlatformVersionInformationFromKitchen(CookbookParseResult cookbookConfigs)
focal_method.body: public CookbookParseResult compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo) {
          
          CookbookParseResult oldParseResult = new CookbookParseResult(cookbookParseResult);
          List<CrawlCookbookRunnable> crawlCookbookRunnableList = new ArrayList<>();
          
          //Compile metadata.
          cookbookParseResult = returnComponentTypesFromMetadata(cookbookParseResult);
  
          // cookbookParseResult is null when cookbook has no metadata.rb or metadata.json file.
          if ( cookbookParseResult == null) {
              return oldParseResult;
          }
  
          //Crawl dependent cookbooks in threads.
          if (cookbookParseResult.getAllConfigsAsList().size() > 0) {
              LinkedHashMap<String,String> dependencies = cookbookParseResult.getAllConfigsAsList().get(0).getDepends();
              String pathDependencies = cookbookParseResult.getCookbookPath() + Defaults.DEPENDENCIE_FOLDER;
              for (String key : dependencies.keySet()) {
                  String versionRestriciton = dependencies.get(key);
                  CrawlCookbookRunnable crawlDependency = new CrawlCookbookRunnable(key, versionRestriciton, pathDependencies, Defaults.TEMP_FOLDER_PATH);
                  crawlDependency.start();
                  crawlCookbookRunnableList.add(crawlDependency);
              }
          }
  
          // Compile kitchen.yml
          if (cookbookParseResult.isInRecursiveTransformation() == false ) {
              cookbookParseResult = addPlatformVersionInformationFromKitchen(cookbookParseResult);
          }
  
          // Wait for the dependencies to download.
          for (int i = 0; i < crawlCookbookRunnableList.size(); i++) {
              try {
                  crawlCookbookRunnableList.get(i).join();
              } catch (InterruptedException e) {
                  LOGGER.info("Crawling process of dependent cookbook " + crawlCookbookRunnableList.get(i).getThreadName() + " interrupted");
              }
          }
  
          // Compile attribute files.
          cookbookParseResult = returnComponentTypesFromAttributes(cookbookParseResult);
  
          // Compile recipes, starting from default.rb recipe.
          cookbookParseResult = returnComponentTypesFromRecipes(cookbookParseResult);
  
          // Resolve dependencies
          for (Map.Entry<String,String> entry : cookbookParseResult.getAllConfigsAsList().get(0).getDepends().entrySet()) {
              String key = entry.getKey();
              LOGGER.info("Cookbook: " + key + " is resolved now");
              CookbookParseResult dependentParseResult = new CookbookParseResult(cookbookParseResult);
              dependentParseResult.prepareForDependencie(key);
              if (dependentParseResult.getAllConfigsAsList().size() > 0) {
                  compileCookbook(dependentParseResult, saveToToscaRepo);
              }
          }
  
          // Print information about cookbooks for debugging
          List<ChefCookbookConfiguration> cookbookConfigsList = cookbookParseResult.getAllConfigsAsList();
          for (int count = 0; count < cookbookConfigsList.size(); count++) {
              cookbookConfigsList.get(count).printConfiguration();
          }
  
          /**
           * Convert extacted configuations to TOSCA node types.
           * Extracted platforms are also converted to TOSCA node types.
           * Saves the extracted Node types to repository.
           */
          if (saveToToscaRepo) {
              new ParseResultToscaConverter().saveToscaNodeTypes(new ParseResultToscaConverter().convertCookbookConfigurationToToscaNode(cookbookParseResult));
          }
          
          LOGGER.info("Finished parsing");
          return cookbookParseResult;
      }
focal_method.class_method_signature: ChefCookbookAnalyzer.compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_method.full_signature: public CookbookParseResult compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_method.identifier: compileCookbook
focal_method.invocations: returnComponentTypesFromMetadata size getAllConfigsAsList getDepends get getAllConfigsAsList getCookbookPath keySet get start add isInRecursiveTransformation addPlatformVersionInformationFromKitchen size join get info getThreadName get returnComponentTypesFromAttributes returnComponentTypesFromRecipes entrySet getDepends get getAllConfigsAsList getKey info prepareForDependencie size getAllConfigsAsList compileCookbook getAllConfigsAsList size printConfiguration get saveToscaNodeTypes convertCookbookConfigurationToToscaNode info
focal_method.modifiers: public
focal_method.parameters: (CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)
focal_method.return: CookbookParseResult
focal_method.signature: CookbookParseResult compileCookbook(CookbookParseResult cookbookParseResult, boolean saveToToscaRepo)