Rev 1592 | Rev 2227 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.util;import in.shop2020.thrift.clients.config.ConfigClient;import java.net.URL;import java.util.logging.Logger;/*** Utility functions and wrappers** @author naveen**/public class Utils {/*** Path to DB*/public static String CONTENT_DB_PATH;public static String EXPORT_IR_PATH, EXPORT_MEDIA_PATH, EXPORT_DEFINITIONS_PATH,EXPORT_DIFF_PATH, EXPORT_SOLR_PATH, EXPORT_ENTITIES_PATH_SAHOLIC, EXPORT_ENTITIES_PATH_SHOP2020, EXPORT_ENTITIES_PATH_LOCALHOST,EXPORT_PARTNERS_CONTENT_PATH;public static String BERKELEY_DB_PATH = "/var/lib/tomcat6/webapps/db/bdb/";public static String currentDir = System.getProperty("user.dir");static {try {ConfigClient configClient = ConfigClient.getClient();CONTENT_DB_PATH = configClient.get("CONTENT_DB_PATH");BERKELEY_DB_PATH = configClient.get("BERKELEY_DB_PATH");EXPORT_IR_PATH = configClient.get("EXPORT_IR_PATH");EXPORT_MEDIA_PATH = configClient.get("EXPORT_MEDIA_PATH");EXPORT_ENTITIES_PATH_SAHOLIC = configClient.get("EXPORT_ENTITIES_PATH_SAHOLIC");EXPORT_ENTITIES_PATH_SHOP2020 = configClient.get("EXPORT_ENTITIES_PATH_SHOP2020");EXPORT_ENTITIES_PATH_LOCALHOST = configClient.get("EXPORT_ENTITIES_PATH_LOCALHOST");EXPORT_DEFINITIONS_PATH = configClient.get("EXPORT_DEFINITIONS_PATH");EXPORT_DIFF_PATH = configClient.get("EXPORT_DIFF_PATH");EXPORT_SOLR_PATH = configClient.get("EXPORT_SOLR_PATH");EXPORT_PARTNERS_CONTENT_PATH = configClient.get("EXPORT_PARTNERS_CONTENT_PATH");} catch (Exception ex) {ex.printStackTrace();CONTENT_DB_PATH = "/var/lib/tomcat6/webapps/db/";BERKELEY_DB_PATH = "/var/lib/tomcat6/webapps/db/bdb/";EXPORT_IR_PATH = "/var/lib/tomcat6/webapps/export/ir/";EXPORT_MEDIA_PATH = "/var/lib/tomcat6/webapps/export/media/";EXPORT_ENTITIES_PATH_SAHOLIC = "/var/lib/tomcat6/webapps/export/html/entities-saholic/";EXPORT_ENTITIES_PATH_SHOP2020 = "/var/lib/tomcat6/webapps/export/html/entities-shop2020/";EXPORT_ENTITIES_PATH_LOCALHOST = "/var/lib/tomcat6/webapps/export/html/entities-localhost/";EXPORT_DEFINITIONS_PATH = "/var/lib/tomcat6/webapps/export/html/definitions/";EXPORT_DIFF_PATH = "/var/lib/tomcat6/webapps/export/html/diff/";EXPORT_SOLR_PATH = "/var/lib/tomcat6/webapps/export/solr/";EXPORT_PARTNERS_CONTENT_PATH = "/var/lib/tomcat6/webapps/export/partners/";}}//Next some paths are somewhat hardcoded need to check when gets time. But they will be used only first time and in utility classes./*** Path to XML definitions*/public static final String DEFINITIONS_SRC_PATH = currentDir + "/src/xml/model/";/*** Path to where PPT files will be picked*/public static final String CONTENT_SRC_PPT_PATH = currentDir + "/content/ppt/";/*** Path where exported HTML files are kept*/public static final String CONTENT_SRC_HTML_PATH = currentDir + "/content/html/";public static String VTL_SRC_PATH = "src/velocity/";public static String JYTHON_SRC_PATH = "src/jython/";//to be used in case of web//public static String JYTHON_SRC_PATH = Utils.class.getClassLoader().getResource("jython").getPath();/*** Jython source path*/// public static String JYTHON_SRC_PATH = "src/jython/";public static long SNIPPETS_FEATURE_DEFINITIONID = 120081;/*** Brand's feature definition, is not referred directly by content models*/public static final long BRAND_FEATURE_DEFINITION_ID = 120080;/*** Brand's facet definition*/public static final long BRAND_FACET_DEFINITION_ID = 50001;/*** Singleton Logger instance*/public static Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);/*** INFO type message** @param obj*/public static void info(Object obj) {System.out.println("INFO: " + obj.toString());}/*** SEVERE type message** @param obj*/public static void severe(Object obj) {System.out.println("SEVERE: " + obj.toString());}/*** MANDATORY type message** @param obj*/public static void warning(Object obj) {System.out.println("WARNING: " + obj.toString());}}