Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
10 shop2020 1
/**
2
 * 
3
 */
4
package in.shop2020.metamodel.definitions;
5
 
6
/**
49 naveen 7
 * Singleton Catalog instance. Provides single point access to all entities and 
8
 * definitions in shop2020 content model
10 shop2020 9
 * 
10
 * @author naveen
11
 *
12
 */
13
public class Catalog {
14
	private static final Catalog catalog = new Catalog();
15
	/**
49 naveen 16
	 * Reference to root of shop2020 category tree
10 shop2020 17
	 */
18
	private Category rootCategory;
19
 
20
	/**
49 naveen 21
	 * Reference to aggregator of all definition objects
10 shop2020 22
	 */
23
	private DefinitionsContainer defsContainer;
24
 
25
	/**
49 naveen 26
	 * Reference to aggregator of all core objects
10 shop2020 27
	 */
28
	private EntityContainer entContainer;
29
 
30
	/**
31
	 * A private Constructor prevents any other class from instantiating
32
	 */
33
	private Catalog() {
1050 rajveer 34
		this.defsContainer = new DefinitionsContainer();
35
		this.entContainer = new EntityContainer();
36
		this.rootCategory = defsContainer.getCategory(10000);
10 shop2020 37
	}
38
 
39
	/**
40
	 * 
41
	 * @return 	Catalog 	single instance of Catalog
42
	 */
43
	public static final Catalog getInstance() {
44
		return catalog;
45
	}
46
 
47
	/**
48
	 *  
49 naveen 49
	 * @return rootCategory Root Category
50
	 * @throws Exception 
10 shop2020 51
	 */
49 naveen 52
	public Category getRootCategory() throws Exception {
10 shop2020 53
		return this.rootCategory;
54
	}
55
 
56
	/**
57
	 * 
49 naveen 58
	 * @return defsContainer Definitions Container
1050 rajveer 59
	 * @throws Exception 
10 shop2020 60
	 */
18 naveen 61
	public DefinitionsContainer getDefinitionsContainer() {		
10 shop2020 62
		return this.defsContainer;
63
	}
64
 
65
	/**
66
	 * 
49 naveen 67
	 * @return EntityContainer Core object's container
10 shop2020 68
	 */
18 naveen 69
	public EntityContainer getEntityContainer() {		
10 shop2020 70
		return this.entContainer;
71
	}
72
}