/*
 * Copyright 2015, Hridesh Rajan, Robert Dyer, Hoan Nguyen
 *                 and Iowa State University of Science and Technology
 *
 * 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 boa.datagen;

import java.io.File;

/**
 * @author rdyer
 */
public class DefaultProperties {
	public static final String NUM_THREADS = "1";
//	public static final String MAX_COMMITS = "10000";

	public static boolean DEBUG = false, DEBUGPARSE = false;

	// HBase tables
	public static final String HBASE_PROJECTS_TABLE = "projects";
	public static final String HBASE_AST_TABLE = "ast";
	public static final String HBASE_COMMENTS_TABLE = "comments";
	public static final String HBASE_ISSUES_TABLE = "issues";
	public static final String HBASE_LOC_TABLE = "loc";

	public static final String HBASE_PROJECTS_COL = "p";
	public static final String HBASE_AST_COL = "a";
	public static final String HBASE_COMMENTS_COL = "c";
	public static final String HBASE_ISSUES_COL = "i";
	public static final String HBASE_LOC_COL = "l";

	public static final String HBASE_DELIMITER = "!!";

	// Sequence file paths
	public static final String SEQ_PROJECTS_PATH = "projects.seq";
	public static final String SEQ_AST_DIR = "ast";
	public static final String SEQ_AST_PATH = "data";
	public static final String SEQ_COMMENTS_DIR = "comments";
	public static final String SEQ_COMMENTS_PATH = "data";
	public static final String SEQ_ISSUES_DIR = "issues";
	public static final String SEQ_ISSUES_PATH = "data";

	// SF.net paths
	public static final String SF_JSON_PATH = "json";
	public static final String SF_JSON_CACHE_PATH = "json_cache";
	public static final String SF_SVN_PATH = "svn";
	public static final String SF_TICKETS_PATH = "tickets";
	
	// GitHub paths
	public static  String GH_JSON_PATH = "repos-metadata-Boa-upto1213";
	public static  String GH_JSON_CACHE_PATH = "json_cache";
//	public static final String GH_GIT_PATH = "github/repositories";
	public static String GH_GIT_PATH = "";
	public static String GH_ISSUE_PATH = "";
	public static final String GH_TICKETS_PATH = "tickets";
	
	public static String CLASSPATH_ROOT = getClasspathRoot();
	
	public static boolean STORE_ASCII_PRINTABLE_CONTENTS = true;

	public static String localDataPath = null;
	public static String localIssuePath = null;
	public static String localCommentPath = null;
	
	private static String getRoot() {
		File dir = new File(System.getProperty("user.dir"));
		while (dir.getParentFile() != null)
			dir = dir.getParentFile();
		return dir.getAbsolutePath();
	}

	private static String getClasspathRoot() {
		String path = getRoot() + "/libs";
		File dir = new File(path);
		if (!dir.exists())
			dir.mkdirs();
		return path;
	}
}

@@ -2914,16 +2914,46 @@
 ll;%0D%0A%09%0D%0A
+%09@SuppressWarnings(%22unused%22)%0D%0A
 %09private
@@ -2980,16 +2980,16 @@
 ot() %7B%0D%0A
-
 %09%09File d
@@ -3192,16 +3192,19 @@
 () %7B%0D%0A%09%09
+// 
 String p
@@ -3237,32 +3237,129 @@
 %0D%0A%09%09
-File dir = new File(path
+String path = System.getProperty(%22user.dir%22);%0D%0A%09%09File dir = new File(path).getParentFile();%0D%0A%09%09dir = new File(dir, %22libs%22
 );%0D%0A
@@ -3407,20 +3407,37 @@
 %09return 
-p
+dir.getAbsoluteP
 ath
+()
 ;%0D%0A%09%7D%0D%0A%7D

set the location for libs in the working directory