Java Properties Load from File loadDefaultProps(Properties deployProps)

Here you can find the source of loadDefaultProps(Properties deployProps)

Description

load Default Props

License

Open Source License

Declaration

private static void loadDefaultProps(Properties deployProps) 

Method Source Code


//package com.java2s;
/*/*from  w  ww  .ja va 2s.c  o m*/
    
Copyright (C) SYSTAP, LLC 2006-2008.  All rights reserved.
    
Contact:
 SYSTAP, LLC
 4501 Tower Road
 Greensboro, NC 27410
 licenses@bigdata.com
    
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    
*/

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import java.util.Properties;

public class Main {
    private static void loadDefaultProps(Properties deployProps) {
        FileInputStream fis = null;
        try {
            String flnm = getPropertiesPath() + File.separator + "default-deploy.properties";
            fis = new FileInputStream(flnm);
            deployProps.load(fis);
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException ioex) {
                    /* swallow */ }
            }
        }
    }

    private static String getPropertiesPath() {
        String rootPath = "/opt/bigdata";//real installation
        String appHome = System.getProperty("appHome");//pstart
        String appDotHome = System.getProperty("app.home");//build.xml

        if (appHome != null) {
            rootPath = appHome;
        } else if (appDotHome != null) {
            rootPath = appDotHome + File.separator + "dist" + File.separator + "bigdata";
        }
        String relPath = "var" + File.separator + "config" + File.separator + "deploy";
        String retPath = rootPath + File.separator + relPath;
        //eclipse
        if (!(new File(retPath)).exists()) {
            String tmpPath = "bigdata-jini" + File.separator + "src" + File.separator + "java" + File.separator
                    + "com" + File.separator + "bigdata" + File.separator + "util" + File.separator + "config";
            retPath = (new File(tmpPath)).getAbsolutePath();
        }
        return retPath;
    }
}

Related

  1. loadCredentials(File credentials, String credentialsAppend)
  2. loadCryptoProperties()
  3. loadDBProperties(String dbConn)
  4. loadDefault(String _file_path)
  5. loadDefaultConfiguration()
  6. LoadDeployedObjects(String outputDirectory)
  7. loadEnv(final String configFilePath)
  8. loadErrorMap(InputStream resourceStream)
  9. loadEscaping(Properties prop, InputStream stream)