コード例 #1
0
 private void processFeaturePackConfig(
     ServerProvisioningFeaturePack provisioningFeaturePack,
     ServerProvisioning.Config provisioningConfig)
     throws IOException, XMLStreamException {
   FeaturePack featurePack = provisioningFeaturePack.getFeaturePack();
   getLog()
       .debug(
           "Processing provisioning feature pack "
               + featurePack.getFeaturePackFile()
               + " configs");
   try (ZipFile zipFile = new ZipFile(featurePack.getFeaturePackFile())) {
     for (ServerProvisioningFeaturePack.ConfigFile serverProvisioningFeaturePackConfigFile :
         provisioningFeaturePack.getDomainConfigFiles()) {
       processFeaturePackConfigFile(
           serverProvisioningFeaturePackConfigFile,
           zipFile,
           provisioningFeaturePack,
           provisioningConfig.getDomainConfigFiles());
     }
     for (ServerProvisioningFeaturePack.ConfigFile serverProvisioningFeaturePackConfigFile :
         provisioningFeaturePack.getStandaloneConfigFiles()) {
       processFeaturePackConfigFile(
           serverProvisioningFeaturePackConfigFile,
           zipFile,
           provisioningFeaturePack,
           provisioningConfig.getStandaloneConfigFiles());
     }
     for (ServerProvisioningFeaturePack.ConfigFile serverProvisioningFeaturePackConfigFile :
         provisioningFeaturePack.getHostConfigFiles()) {
       processFeaturePackConfigFile(
           serverProvisioningFeaturePackConfigFile,
           zipFile,
           provisioningFeaturePack,
           provisioningConfig.getHostConfigFiles());
     }
   }
 }
コード例 #2
0
 private void processConfig(
     ServerProvisioning serverProvisioning, File outputDirectory, Set<String> filesProcessed)
     throws IOException, XMLStreamException {
   ServerProvisioning.Config provisioningConfig = serverProvisioning.getConfig();
   // 1. collect and merge each feature pack configs
   for (ServerProvisioningFeaturePack provisioningFeaturePack :
       serverProvisioning.getFeaturePacks()) {
     processFeaturePackConfig(provisioningFeaturePack, provisioningConfig);
   }
   // 2. assemble the merged configs
   for (ServerProvisioning.ConfigFile provisioningConfigFile :
       provisioningConfig.getDomainConfigFiles().values()) {
     if (provisioningConfigFile.getTemplateInputStreamSource() == null) {
       getLog()
           .debugf(
               "Skipping assembly of config file %s, template not set.",
               provisioningConfigFile.getOutputFile());
       continue;
     }
     getLog().debugf("Assembling config file %s", provisioningConfigFile.getOutputFile());
     filesProcessed.add(provisioningConfigFile.getOutputFile());
     new ConfigurationAssembler(
             provisioningConfig.getInputStreamSources(),
             provisioningConfigFile.getTemplateInputStreamSource(),
             "domain",
             provisioningConfigFile.getSubsystems(),
             new File(outputDirectory, provisioningConfigFile.getOutputFile()))
         .assemble();
   }
   for (ServerProvisioning.ConfigFile provisioningConfigFile :
       provisioningConfig.getStandaloneConfigFiles().values()) {
     if (provisioningConfigFile.getTemplateInputStreamSource() == null) {
       getLog()
           .debugf(
               "Skipping assembly of config file %s, template not set.",
               provisioningConfigFile.getOutputFile());
       continue;
     }
     getLog().debugf("Assembling config file %s", provisioningConfigFile.getOutputFile());
     filesProcessed.add(provisioningConfigFile.getOutputFile());
     new ConfigurationAssembler(
             provisioningConfig.getInputStreamSources(),
             provisioningConfigFile.getTemplateInputStreamSource(),
             "server",
             provisioningConfigFile.getSubsystems(),
             new File(outputDirectory, provisioningConfigFile.getOutputFile()))
         .assemble();
   }
   for (ServerProvisioning.ConfigFile provisioningConfigFile :
       provisioningConfig.getHostConfigFiles().values()) {
     if (provisioningConfigFile.getTemplateInputStreamSource() == null) {
       getLog()
           .debugf(
               "Skipping assembly of config file %s, template not set.",
               provisioningConfigFile.getOutputFile());
       continue;
     }
     getLog().debugf("Assembling config file %s", provisioningConfigFile.getOutputFile());
     filesProcessed.add(provisioningConfigFile.getOutputFile());
     new ConfigurationAssembler(
             provisioningConfig.getInputStreamSources(),
             provisioningConfigFile.getTemplateInputStreamSource(),
             "host",
             provisioningConfigFile.getSubsystems(),
             new File(outputDirectory, provisioningConfigFile.getOutputFile()))
         .assemble();
   }
 }