Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * =============================================================================
   * 
   *   Copyright (c) 2007, The JASYPT team (http://www.jasypt.org)
   * 
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   * 
  *       http://www.apache.org/licenses/LICENSE-2.0
  * 
  *   Unless required by applicable law or agreed to in writing, software
  *   distributed under the License is distributed on an "AS IS" BASIS,
  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *   See the License for the specific language governing permissions and
  *   limitations under the License.
  * 
  * =============================================================================
  */
 package org.jasypt.encryption.pbe.config;
 

Implementation for StringPBEConfig which can retrieve configuration values from environment variables or system properties.

The name of the environment variable or system property (JVM property) to query for each parameter can be set with its corresponding setXEnvName or setXSysProperty method.

As this class extends SimplePBEConfig, parameter values can be also set with the usual setX methods.

For any of the configuration parameters, if its value is not configured in any way, a null value will be returned by the corresponding getX method.

Author(s):
Daniel Fernández Garrido
Since:
1.3
 
 public class EnvironmentStringPBEConfig 
         extends EnvironmentPBEConfig 
         implements StringPBEConfig {
     
     private String stringOutputType = null;
     
     private String stringOutputTypeEnvName = null;
 
     private String stringOutputTypeSysPropertyName = null;
    

    

Creates a new EnvironmentStringPBEConfig instance.

 
     public EnvironmentStringPBEConfig() {
         super();
     }



    
Retrieve the name of the environment variable which value has been loaded as the String output type.

Returns:
the name of the variable
 
     public String getStringOutputTypeEnvName() {
         return ;
     }


    
Set the config object to use the specified environment variable to load the value for the String output type.

Parameters:
stringOutputTypeEnvName the name of the environment variable
 
     public void setStringOutputTypeEnvName(String stringOutputTypeEnvName) {
         this. = stringOutputTypeEnvName;
         if (stringOutputTypeEnvName == null) {
             this. = null;
         } else {
             this. = null;
             this. =
                 CommonUtils.getStandardStringOutputType(
                         System.getenv(stringOutputTypeEnvName));
         }
     }


    
Retrieve the name of the JVM system property which value has been loaded as the String output type.

Returns:
the name of the property
        return ;
    }


    
Set the config object to use the specified JVM system property to load the value for the String output type.

Parameters:
stringOutputTypeSysPropertyName the name of the property
    public void setStringOutputTypeSysPropertyName(String stringOutputTypeSysPropertyName) {
        this. = stringOutputTypeSysPropertyName;
        if (stringOutputTypeSysPropertyName == null) {
            this. = null;
        } else {
            this. = null;
            this. =
                CommonUtils.getStandardStringOutputType(
                        System.getProperty(stringOutputTypeSysPropertyName));
        }
    }

    
    

Sets the the form in which String output will be encoded. Available encoding types are:

  • base64 (default)
  • hexadecimal

If not set, null will be returned.

Parameters:
stringOutputType the string output type.
    public void setStringOutputType(String stringOutputType) {
        this. = null;
        this. = null;
        this. =
            CommonUtils.
                getStandardStringOutputType(stringOutputType);
    }
    
    public String getStringOutputType() {
        return this.;
    }
    
New to GrepCode? Check out our FAQ X