Subversion Repositories SmartDukaan

Rev

Rev 1061 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * 
 */
package in.shop2020.metamodel.definitions;

/**
 * Singleton Catalog instance. Provides single point access to all entities and 
 * definitions in shop2020 content model
 * 
 * @author naveen
 *
 */
public class Catalog {
        private static final Catalog catalog = new Catalog();
        /**
         * Reference to root of shop2020 category tree
         */
        private Category rootCategory;
        
        /**
         * Reference to aggregator of all definition objects
         */
        private DefinitionsContainer defsContainer;
        
        /**
         * A private Constructor prevents any other class from instantiating
         */
        private Catalog() {
                this.defsContainer = new DefinitionsContainer();
                this.rootCategory = defsContainer.getCategory(10000);
        }
        
        /**
         * 
         * @return      Catalog         single instance of Catalog
         */
        public static final Catalog getInstance() {
                return catalog;
        }
        
        /**
         *  
         * @return rootCategory Root Category
         * @throws Exception 
         */
        public Category getRootCategory() throws Exception {
                return this.rootCategory;
        }
        
        /**
         * 
         * @return defsContainer Definitions Container
         * @throws Exception 
         */
        public DefinitionsContainer getDefinitionsContainer() {         
                return this.defsContainer;
        }
        
}