egovframework.rte.fdl.crypto.ConfigInfo.java Source code

Java tutorial

Introduction

Here is the source code for egovframework.rte.fdl.crypto.ConfigInfo.java

Source

/*
 * Copyright 2008-2009 MOPAS(Ministry of Public Administration and Security).
 *
 * 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 egovframework.rte.fdl.crypto;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * Password  Algorithm  Class
 * @author ??   
 * @since 2009. 03.10
 * @version 1.0
 * @see <pre>
 *  == ?(Modification Information) ==
 *   
 *   ?      ?              
 *  ---------   ---------   -------------------------------
 *  2009.03.10            ?
 * 
 * </pre>
 */

public class ConfigInfo {
    private static Logger logger = CryptoLog.getLogger(ConfigInfo.class);
    /** ? */
    String fileName = null;
    /** ApplicationContext */
    ApplicationContext context;
    /** crytoConfig  Class */
    CryptoConfig cryptoConfig;
    /** crypto config xml  */
    String default_path = "classpath*:spring/context-config.xml";

    /**
     * ConfigInfo ??
     * @param fileName    ? 
     */
    public ConfigInfo(String fileName) {
        setUp(fileName);
    }

    /**
     * Context Component  
     * @param fileName -   ? 
     */
    public void setUp(String fileName) {
        if (fileName == null)
            context = new FileSystemXmlApplicationContext(default_path);
        else
            context = new FileSystemXmlApplicationContext(fileName);

        cryptoConfig = (CryptoConfig) context.getBean("config");
    }

    /**
     * Password 
     * @return Password
     */
    public String getPassword() {
        return cryptoConfig.getPassword();
    }

    /**
     * Algorithm 
     * @return Algorithm
     */
    public String getAlgorithm() {
        return cryptoConfig.getAlgorithm();
    }

    public static void main(String[] args) {
        ConfigInfo cinfo = new ConfigInfo(null);
    }
}