| 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");
|
| 341 |
rajveer |
23 |
|
| 326 |
rajveer |
24 |
static{
|
|
|
25 |
|
| 341 |
rajveer |
26 |
try {
|
|
|
27 |
|
|
|
28 |
ConfigClient configClient = ConfigClient.getClient();
|
| 326 |
rajveer |
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");
|
| 341 |
rajveer |
36 |
COMPARISONS_DB_PATH = configClient.get("COMPARISONS_DB_PATH");
|
| 326 |
rajveer |
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 |
}
|
| 341 |
rajveer |
46 |
|
| 326 |
rajveer |
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 |
|
| 341 |
rajveer |
71 |
public static final String EXPORT_SOLR_PATH = currentDir + "/export/solr/";
|
|
|
72 |
|
| 108 |
naveen |
73 |
public static String VTL_SRC_PATH = "src/velocity/";
|
| 70 |
naveen |
74 |
|
|
|
75 |
/**
|
|
|
76 |
* Jython source path
|
|
|
77 |
*/
|
|
|
78 |
public static String JYTHON_SRC_PATH = "src/jython/";
|
|
|
79 |
|
| 326 |
rajveer |
80 |
public static long SNIPPETS_FEATURE_DEFINITIONID = 120081;
|
|
|
81 |
|
|
|
82 |
|
| 70 |
naveen |
83 |
/**
|
| 81 |
naveen |
84 |
* Brand's feature definition, is not referred directly by content models
|
|
|
85 |
*/
|
|
|
86 |
public static final long BRAND_FEATURE_DEFINITION_ID = 120080;
|
|
|
87 |
|
|
|
88 |
/**
|
|
|
89 |
* Brand's facet definition
|
|
|
90 |
*/
|
|
|
91 |
public static final long BRAND_FACET_DEFINITION_ID = 50001;
|
|
|
92 |
|
|
|
93 |
/**
|
| 49 |
naveen |
94 |
* Singleton Logger instance
|
|
|
95 |
*/
|
| 18 |
naveen |
96 |
public static Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
|
| 41 |
naveen |
97 |
|
| 49 |
naveen |
98 |
/**
|
|
|
99 |
* INFO type message
|
|
|
100 |
*
|
|
|
101 |
* @param obj
|
|
|
102 |
*/
|
| 41 |
naveen |
103 |
public static void info(Object obj) {
|
| 75 |
naveen |
104 |
System.out.println("INFO: " + obj.toString());
|
| 41 |
naveen |
105 |
}
|
|
|
106 |
|
| 49 |
naveen |
107 |
/**
|
|
|
108 |
* SEVERE type message
|
|
|
109 |
*
|
|
|
110 |
* @param obj
|
|
|
111 |
*/
|
| 41 |
naveen |
112 |
public static void severe(Object obj) {
|
|
|
113 |
System.out.println("SEVERE: " + obj.toString());
|
|
|
114 |
}
|
| 49 |
naveen |
115 |
|
|
|
116 |
/**
|
|
|
117 |
* MANDATORY type message
|
|
|
118 |
*
|
|
|
119 |
* @param obj
|
|
|
120 |
*/
|
| 41 |
naveen |
121 |
public static void warning(Object obj) {
|
|
|
122 |
System.out.println("WARNING: " + obj.toString());
|
|
|
123 |
}
|
| 18 |
naveen |
124 |
}
|