/**
  * Utility method to directly parse the nodes from a file
  *
  * @param file file
  * @param framework fwk
  * @param project project name
  * @return nodes
  * @throws ResourceModelSourceException if an error occurs
  * @throws ConfigurationException if a configuration error occurs
  */
 public static INodeSet parseFile(final File file, final Framework framework, final String project)
     throws ResourceModelSourceException, ConfigurationException {
   final FileResourceModelSource prov = new FileResourceModelSource(framework);
   prov.configure(
       FileResourceModelSource.Configuration.build()
           .file(file)
           .includeServerNode(false)
           .generateFileAutomatically(false)
           .project(project)
           .requireFileExists(true));
   return prov.getNodes();
 }
示例#2
0
  private Properties generateFileSourceConfigurationProperties(
      String filepath, String format, boolean generate, boolean includeServerNode) {
    final FileResourceModelSource.Configuration build =
        FileResourceModelSource.Configuration.build();
    build.file(filepath);
    if (null != format) {
      build.format(format);
    }
    build.project(projectConfig.getName());
    build.generateFileAutomatically(generate);
    build.includeServerNode(includeServerNode);

    return build.getProperties();
  }