Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 naveen 1
/**
2
 * 
3
 */
4
package in.shop2020.util;
5
 
326 rajveer 6
import in.shop2020.config.ConfigException;
7
import in.shop2020.thrift.clients.config.ConfigClient;
8
 
18 naveen 9
import java.util.logging.Logger;
10
 
11
/**
49 naveen 12
 * Utility functions and wrappers 
13
 * 
18 naveen 14
 * @author naveen
15
 *
16
 */
17
public class Utils {
70 naveen 18
 
326 rajveer 19
 
20
 
21
	public static String CONTENT_DB_PATH, DEFINITIONS_DB_PATH, MEDIA_DB_PATH, ENTITIES_DB_PATH, COMPARISONS_DB_PATH;
22
	public static String currentDir = System.getProperty("user.dir");
23
 
24
	static{
25
 
26
		ConfigClient configClient = ConfigClient.getClient();
27
 
28
		try {  
29
			/**
30
			 * Path to DB... will have lot of references
31
			 */
32
			CONTENT_DB_PATH = configClient.get("CONTENT_DB_PATH");
33
			MEDIA_DB_PATH = configClient.get("MEDIA_DB_PATH");
34
			DEFINITIONS_DB_PATH = configClient.get("DEFINITIONS_DB_PATH");
35
			ENTITIES_DB_PATH = configClient.get("ENTITIES_DB_PATH");
36
			COMPARISONS_DB_PATH = configClient.get("COMPARISIONS_DB_PATH");
37
 
38
		}catch(ConfigException ex){
39
			ex.printStackTrace();
40
			CONTENT_DB_PATH = "/var/lib/tomcat6/webapps/db/entities/";
41
			MEDIA_DB_PATH =	"/var/lib/tomcat6/webapps/db/media/";
42
			DEFINITIONS_DB_PATH =	"/var/lib/tomcat6/webapps/db/definitions/";
43
			ENTITIES_DB_PATH =  "/var/lib/tomcat6/webapps/db/entities/";
44
			COMPARISONS_DB_PATH = "/var/lib/tomcat6/webapps/db/comparisons/";
45
			}
46
		}
47
 
48
 
49
	//Next some paths are somewhat hardcoded need to check when gets time. But they will be used only first time and in utility classes.
49 naveen 50
	/**
70 naveen 51
	 * Path to XML definitions
52
	 */
326 rajveer 53
	public static final String DEFINITIONS_SRC_PATH = currentDir +  "/src/xml/model/";
70 naveen 54
	/**
55
	 * Path to where PPT files will be picked
56
	 */
326 rajveer 57
	public static final String CONTENT_SRC_PPT_PATH = currentDir + "/content/ppt/";
70 naveen 58
	/**
59
	 * Path where exported HTML files are kept
60
	 */
326 rajveer 61
	public static final String CONTENT_SRC_HTML_PATH =	currentDir + "/content/html/";
70 naveen 62
	/**
63
	 * IR XML export path
64
	 */
326 rajveer 65
	public static final String EXPORT_IR_PATH = currentDir + "/export/ir/";
66
	public static final String EXPORT_ENTITIES_PATH =	currentDir + "/export/html/entities/";
67
	public static final String EXPORT_DEFINITIONS_PATH =	currentDir + "/export/html/definitions/";
68
	public static final String EXPORT_CATEGORY_HOMES_PATH = currentDir + "/export/html/category_homes/";
69
	public static final String EXPORT_DIFF_PATH =	currentDir + "/export/html/diff/";
70 naveen 70
 
209 naveen 71
 
108 naveen 72
	public static String VTL_SRC_PATH = "src/velocity/";
70 naveen 73
 
74
	/**
75
	 * Jython source path
76
	 */
77
	public static String JYTHON_SRC_PATH = "src/jython/";
78
 
326 rajveer 79
	public static long SNIPPETS_FEATURE_DEFINITIONID = 120081;
80
 
81
 
70 naveen 82
	/**
81 naveen 83
	 * Brand's feature definition, is not referred directly by content models
84
	 */
85
	public static final long BRAND_FEATURE_DEFINITION_ID = 120080;
86
 
87
	/**
88
	 * Brand's facet definition
89
	 */
90
	public static final long BRAND_FACET_DEFINITION_ID = 50001;
91
 
92
	/**
49 naveen 93
	 * Singleton Logger instance
94
	 */
18 naveen 95
	public static Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
41 naveen 96
 
49 naveen 97
	/**
98
	 * INFO type message
99
	 * 
100
	 * @param obj
101
	 */
41 naveen 102
	public static void info(Object obj) {
75 naveen 103
		System.out.println("INFO: " + obj.toString());
41 naveen 104
	}
105
 
49 naveen 106
	/**
107
	 * SEVERE type message
108
	 * 
109
	 * @param obj
110
	 */
41 naveen 111
	public static void severe(Object obj) {
112
		System.out.println("SEVERE: " + obj.toString());
113
	}
49 naveen 114
 
115
	/**
116
	 * MANDATORY type message
117
	 * 
118
	 * @param obj
119
	 */
41 naveen 120
	public static void warning(Object obj) {
121
		System.out.println("WARNING: " + obj.toString());
122
	}
18 naveen 123
}