/**
   * @param templateInfo may not be null
   * @throws TemplateInitializationException
   */
  protected TemplateCore(TemplateInfo templateInfo) throws TemplateInitializationException {
    this.templateInfo = templateInfo;
    URL descriptorURL;
    try {
      descriptorURL =
          TemplateEngineHelper.getTemplateResourceURL(
              templateInfo.getPluginId(), templateInfo.getTemplatePath());
    } catch (IOException ioe) {
      String msg =
          MessageFormat.format(
              TemplateEngineMessages.getString("TemplateCore.InitFailed"),
              new Object[] {templateInfo.getTemplatePath()}); // $NON-NLS-1$
      throw new TemplateInitializationException(msg);
    }
    if (descriptorURL == null)
      throw new TemplateInitializationException(
          "Unable to load project template. Location URL is null for "
              + templateInfo.getTemplateId()); // $NON-NLS-1$
    templateDescriptor = new TemplateDescriptor(descriptorURL, templateInfo.getPluginId());
    valueStore = new ValueStore<String>(this);
    valueStore.putAll(templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()));
    valueStore.putAll(TemplateEngine.getSharedDefaults());
    valueStore.put("projectType", templateInfo.getProjectType()); // $NON-NLS-1$

    processHandler = new TemplateProcessHandler(this);
    allMacrosInProcesses = processHandler.getAllMacros();

    fireDirtyEvents = true;
  }