Subversion Repositories SmartDukaan

Rev

Rev 1034 | Rev 1454 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1034 Rev 1453
Line 4... Line 4...
4
import java.io.ByteArrayOutputStream;
4
import java.io.ByteArrayOutputStream;
5
import java.io.ObjectInputStream;
5
import java.io.ObjectInputStream;
6
import java.io.ObjectOutputStream;
6
import java.io.ObjectOutputStream;
7
import java.util.List;
7
import java.util.List;
8
 
8
 
-
 
9
import in.shop2020.config.ConfigException;
9
import in.shop2020.model.v1.catalog.Item;
10
import in.shop2020.model.v1.catalog.Item;
10
import in.shop2020.model.v1.catalog.InventoryService.Client;
11
import in.shop2020.model.v1.catalog.InventoryService.Client;
11
import in.shop2020.model.v1.order.LineItem;
12
import in.shop2020.model.v1.order.LineItem;
12
import in.shop2020.model.v1.order.Order;
13
import in.shop2020.model.v1.order.Order;
13
import in.shop2020.model.v1.order.Transaction;
14
import in.shop2020.model.v1.order.Transaction;
Line 20... Line 21...
20
import in.shop2020.model.v1.user.UserContextException;
21
import in.shop2020.model.v1.user.UserContextException;
21
import in.shop2020.model.v1.user.WidgetException;
22
import in.shop2020.model.v1.user.WidgetException;
22
import in.shop2020.thrift.clients.CatalogServiceClient;
23
import in.shop2020.thrift.clients.CatalogServiceClient;
23
import in.shop2020.thrift.clients.TransactionServiceClient;
24
import in.shop2020.thrift.clients.TransactionServiceClient;
24
import in.shop2020.thrift.clients.UserContextServiceClient;
25
import in.shop2020.thrift.clients.UserContextServiceClient;
-
 
26
import in.shop2020.thrift.clients.config.ConfigClient;
25
 
27
 
26
import org.apache.thrift.TException;
28
import org.apache.thrift.TException;
27
 
29
 
28
public class Utils {
30
public class Utils {
29
	//FIXME: Read this path from the config server
31
	//FIXME: Read this path from the config server
30
	public static final String EXPORT_ENTITIES_PATH =	"/var/lib/tomcat6/webapps/export/html/entities/";
32
	public static final String EXPORT_ENTITIES_PATH = getExportPath();
-
 
33
	
-
 
34
	private static String getExportPath(){
-
 
35
		String exportPath;
-
 
36
		ConfigClient client = ConfigClient.getClient();
-
 
37
		try{
-
 
38
			exportPath = client.get("export_entities_path");
-
 
39
		}catch(ConfigException ce){
-
 
40
			exportPath = "/var/lib/tomcat6/webapps/export/html/entities/";
31
		
41
		}
-
 
42
		return exportPath;
-
 
43
	}
32
	
44
	
33
	public static double getItemPrice(long itemId){
45
	public static double getItemPrice(long itemId){
34
		CatalogServiceClient catalogServiceClient = null;
46
		CatalogServiceClient catalogServiceClient = null;
35
		Client client = null;
47
		Client client = null;
36
		Double itemPrice = 0.0;
48
		Double itemPrice = 0.0;