Subversion Repositories SmartDukaan

Rev

Rev 3123 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
100 ashish 1
package in.shop2020.thrift.clients;
2
 
5945 mandeep.dh 3
import in.shop2020.model.v1.catalog.CatalogService.Client;
3123 rajveer 4
import in.shop2020.utils.ConfigClientKeys;
100 ashish 5
 
767 rajveer 6
import org.apache.thrift.TException;
100 ashish 7
import org.apache.thrift.transport.TTransportException;
8
 
3123 rajveer 9
public class CatalogClient extends GenericClient{
100 ashish 10
 
3123 rajveer 11
	private Client client = null;
100 ashish 12
 
3123 rajveer 13
	/**
14
	 * 
15
	 * @throws TTransportException
16
	 */
17
	public CatalogClient() throws TTransportException{
18
		this(ConfigClientKeys.catalog_service_server_host.toString(), ConfigClientKeys.catalog_service_server_port.toString());
19
	}
20
 
21
	/**
22
	 * get the client for given hostkey and portkey
23
	 * @param hostConfigKey
24
	 * @param portConfigKey
25
	 * @throws TTransportException
26
	 */
27
	public CatalogClient(String hostConfigKey, String portConfigKey) throws TTransportException{
28
		super(hostConfigKey, portConfigKey);
100 ashish 29
		client = new Client(protocol);
30
	}
31
 
3123 rajveer 32
 
33
	/**
34
	 * Get the client
35
	 * @return
36
	 */
350 ashish 37
	public Client getClient(){
38
		return client;
39
	}
3123 rajveer 40
 
767 rajveer 41
	@Override
42
	public void closeSession() {
43
		try {
44
			client.closeSession();
45
		} catch (TException e) {
46
			e.printStackTrace();
47
		}
48
	}
49
 
100 ashish 50
}