// Path: wava-client/src/main/java/org/brutusin/wava/cfg/Config.java
// public class Config {
// 
//     private final File tempFolder;
//     private static volatile Config instance;
//     private final ConfigImpl impl;
// 
//     private Config() {
//         try {
//             File cfgFile = new File(WavaHome.getInstance().getFile(), "cfg/wava.json");
//             if (!cfgFile.exists()) {
//                 throw new RuntimeException("Config file not found " + cfgFile.getAbsolutePath());
//             }
//             String str = Miscellaneous.toString(new FileInputStream(cfgFile), "UTF-8");
//             this.impl = JsonCodec.getInstance().parse(replaceEnvEntries(str), ConfigImpl.class);
//             if (impl.getTempFolder() != null) {
//                 this.tempFolder = new File(impl.getTempFolder() + "/" + WavaHome.getInstance().getId());
//             } else {
//                 this.tempFolder = null;
//             }
//         } catch (Throwable th) {
//             throw new Error(th);
//         }
//     }
// 
//     private static String replaceEnvEntries(String str) {
//         StringBuilder sb = new StringBuilder(str);
//         for (String envEntry : System.getenv().keySet()) {
//             String entryName = "$" + envEntry;
//             int i;
//             while ((i = sb.indexOf(entryName)) >= 0) {
//                 sb.replace(i, i + entryName.length(), System.getenv().get(envEntry));
//             }
//         }
//         return sb.toString();
//     }
// 
//     public static Config getInstance() {
//         if (instance == null) {
//             synchronized (Config.class) {
//                 if (instance == null) {
//                     instance = new Config();
//                 }
//             }
//         }
//         return instance;
//     }
// 
//     public SchedulerCfg getSchedulerCfg() {
//         return impl.getSchedulerCfg();
//     }
// 
//     public ProcessCfg getProcessCfg() {
//         return impl.getProcessCfg();
//     }
// 
//     public GroupCfg getGroupCfg() {
//         return impl.getGroupCfg();
//     }
// 
//     public UICfg getuICfg() {
//         return impl.getuICfg();
//     }
// 
//     public File getTempFolder() {
//         return this.tempFolder;
//     }
// }


import java.io.File;
import org.brutusin.wava.cfg.Config;

/*
 * Copyright 2016 Ignacio del Valle Alles idelvall@brutusin.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.brutusin.wava.env;


/**
 *
 * @author Ignacio del Valle Alles idelvall@brutusin.org
 */
public final class WavaTemp {

    private static final WavaTemp INSTANCE = new WavaTemp();

    private final File temp;

    public static WavaTemp getInstance() {
        return INSTANCE;
    }

    private WavaTemp() {
        this.temp = Config.getInstance().getTempFolder();
    }

    public File getTemp() {

// Path: wava-client/src/main/java/org/brutusin/wava/cfg/Config.java
// public class Config {
// 
//     private final File tempFolder;
//     private static volatile Config instance;
//     private final ConfigImpl impl;
// 
//     private Config() {
//         try {
//             File cfgFile = new File(WavaHome.getInstance().getFile(), "cfg/wava.json");
//             if (!cfgFile.exists()) {
//                 throw new RuntimeException("Config file not found " + cfgFile.getAbsolutePath());
//             }
//             String str = Miscellaneous.toString(new FileInputStream(cfgFile), "UTF-8");
//             this.impl = JsonCodec.getInstance().parse(replaceEnvEntries(str), ConfigImpl.class);
//             if (impl.getTempFolder() != null) {
//                 this.tempFolder = new File(impl.getTempFolder() + "/" + WavaHome.getInstance().getId());
//             } else {
//                 this.tempFolder = null;
//             }
//         } catch (Throwable th) {
//             throw new Error(th);
//         }
//     }
// 
//     private static String replaceEnvEntries(String str) {
//         StringBuilder sb = new StringBuilder(str);
//         for (String envEntry : System.getenv().keySet()) {
//             String entryName = "$" + envEntry;
//             int i;
//             while ((i = sb.indexOf(entryName)) >= 0) {
//                 sb.replace(i, i + entryName.length(), System.getenv().get(envEntry));
//             }
//         }
//         return sb.toString();
//     }
// 
//     public static Config getInstance() {
//         if (instance == null) {
//             synchronized (Config.class) {
//                 if (instance == null) {
//                     instance = new Config();
//                 }
//             }
//         }
//         return instance;
//     }
// 
//     public SchedulerCfg getSchedulerCfg() {
//         return impl.getSchedulerCfg();
//     }
// 
//     public ProcessCfg getProcessCfg() {
//         return impl.getProcessCfg();
//     }
// 
//     public GroupCfg getGroupCfg() {
//         return impl.getGroupCfg();
//     }
// 
//     public UICfg getuICfg() {
//         return impl.getuICfg();
//     }
// 
//     public File getTempFolder() {
//         return this.tempFolder;
//     }
// }


// Path: wava-client/src/main/java/org/brutusin/wava/env/WavaTemp.java
import java.io.File;
import org.brutusin.wava.cfg.Config;

/*
 * Copyright 2016 Ignacio del Valle Alles idelvall@brutusin.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.brutusin.wava.env;


/**
 *
 * @author Ignacio del Valle Alles idelvall@brutusin.org
 */
public final class WavaTemp {

    private static final WavaTemp INSTANCE = new WavaTemp();

    private final File temp;

    public static WavaTemp getInstance() {
        return INSTANCE;
    }

    private WavaTemp() {
        this.temp = Config.getInstance().getTempFolder();
    }

    public File getTemp() {

        return temp;
