Package ch.inftec.ju.util

Examples of ch.inftec.ju.util.PropertyChainBuilder$PropertyChainImpl$ChainValueSource


  private Map<FilterConfig, List<RegexUtil>> excludedPatterns = new HashMap<>();
 
  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    if (this.chain != null) {
      PropertyChainBuilder chainBuilder = new PropertyChainBuilder();
     
      if (this.chain.resourceFolders.size() == 0) {
        chainBuilder.addResourceFolder(this.project.getBasedir().toPath());
      } else {
        for (File resourceFolder : this.chain.resourceFolders) {
          if (this.chain.silentlyIgnoreMissingResourceFolder && !resourceFolder.exists()) {
            // Ignore resource
          } else {
            chainBuilder.addResourceFolder(resourceFolder.toPath());
          }
        }
      }
       
      for (ChainElementConfig chainElement : this.chain.chainElements) {
        if (chainElement.lookupConfigFile != null && chainElement.lookupConfigFile.fileName != null) {
          chainBuilder.addEvaluatorsByChainFiles()
            .name(chainElement.lookupConfigFile.fileName)
            .resolve();
        }
        if (chainElement.systemProperties != null) {
          chainBuilder.addSystemPropertyEvaluator();
        }
      }
     
      Set<String> exportedProperty = new HashSet<>();
     
      // Add explicit properties (if any)
      if (this.chain.properties.size() > 0) {
        Properties props = new Properties();
        for (Property property : this.chain.properties) {
          String key = chainBuilder.peekChain().interpolate(property.key);
          String value = property.value;
         
          if (value == null) continue;
         
          props.put(key, value);
         
          if (property.exportToSystemProperty) {
            exportedProperty.add(key);
          }
        }
       
        chainBuilder.addPropertiesPropertyEvaluator(props);
      }
     
      // Set decryptor (if any)
      if (this.chain.decryptor != null) {
        if (!StringUtils.isEmpty(this.chain.decryptor.decryptionPasswordPropertyName)) {
          String decryptionPassword = chainBuilder.peekChain().get(this.chain.decryptor.decryptionPasswordPropertyName);
          chainBuilder.setDecryptor(JuSecurityUtils.buildEncryptor()
              .password(decryptionPassword)
              .strong(this.chain.decryptor.strongEncryption)
              .createTextEncryptor());
        } else if (!StringUtils.isEmpty(this.chain.decryptor.keyFilePathPropertyName)) {
          String keyFileName = chainBuilder.peekChain().get(this.chain.decryptor.keyFilePathPropertyName);
          try {
            chainBuilder.setDecryptorByResource(keyFileName, this.chain.decryptor.strongEncryption);
          } catch (Exception ex) {
            if (this.chain.decryptor.ignoreMissingDecryption) {
              this.getLog().warn("Couldn't set decryptor. Continuing as ignoreMissingDecryption is true: " + ex);
            } else {
              throw ex;
            }
          }
        }
      }
     
      PropertyChain chain = chainBuilder.getPropertyChain();
      Set<String> keys = chain.listKeys();
     
      for (String key : keys) {
        if (this.isIncluded(key, this.chain.filter, true)) {
          PropertyInfo pi = chain.getInfo(key);
View Full Code Here


  private Map<FilterConfig, List<RegexUtil>> excludedPatterns = new HashMap<>();
 
  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    if (this.chain != null && this.chain.chainElements.size() > 0) {
      PropertyChainBuilder chainBuilder = new PropertyChainBuilder();
     
      if (this.chain.resourceFolders.size() == 0) {
        chainBuilder.addResourceFolder(this.project.getBasedir().toPath());
      } else {
        for (File resourceFolder : this.chain.resourceFolders) {
          if (this.chain.silentlyIgnoreMissingResourceFolder && !resourceFolder.exists()) {
            // Ignore resource
          } else {
            chainBuilder.addResourceFolder(resourceFolder.toPath());
          }
        }
      }
       
      for (ChainElementConfig chainElement : this.chain.chainElements) {
        if (chainElement.lookupConfigFile != null && chainElement.lookupConfigFile.fileName != null) {
          chainBuilder.addEvaluatorsByChainFiles()
            .name(chainElement.lookupConfigFile.fileName)
            .resolve();
        }
      }
     
      Set<String> exportedProperty = new HashSet<>();
     
      // Add explicit properties (if any)
      if (this.chain.properties.size() > 0) {
        Properties props = new Properties();
        for (Property property : this.chain.properties) {
          String key = chainBuilder.peekChain().interpolate(property.key);
          String value = property.value;
         
          if (value == null) continue;
         
          props.put(key, value);
         
          if (property.exportToSystemProperty) {
            exportedProperty.add(key);
          }
        }
       
        chainBuilder.addPropertiesPropertyEvaluator(props);
      }
     
      // Set decryptor (if any)
      if (this.chain.decryptor != null) {
        if (!StringUtils.isEmpty(this.chain.decryptor.decryptionPasswordPropertyName)) {
          String decryptionPassword = chainBuilder.peekChain().get(this.chain.decryptor.decryptionPasswordPropertyName);
          chainBuilder.setDecryptor(JuSecurityUtils.buildEncryptor()
              .password(decryptionPassword)
              .strong(this.chain.decryptor.strongEncryption)
              .createTextEncryptor());
        } else if (!StringUtils.isEmpty(this.chain.decryptor.keyFilePathPropertyName)) {
          String keyFileName = chainBuilder.peekChain().get(this.chain.decryptor.keyFilePathPropertyName);
          chainBuilder.setDecryptorByResource(keyFileName, this.chain.decryptor.strongEncryption);
        }
      }
     
      PropertyChain chain = chainBuilder.getPropertyChain();
      Set<String> keys = chain.listKeys();
     
      for (String key : keys) {
        if (this.isIncluded(key, this.chain.filter, true)) {
          PropertyInfo pi = chain.getInfo(key);
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.PropertyChainBuilder$PropertyChainImpl$ChainValueSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.