Subversion Repositories SmartDukaan

Rev

Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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