Subversion Repositories SmartDukaan

Rev

Rev 17 | Rev 49 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

/**
 * Singleton Catalog instance
 * 
 * @author naveen
 *
 */
public class Catalog {
        private static final Catalog catalog = new Catalog();
        /**
         * 
         */
        private Category rootCategory;
        
        /**
         * 
         */
        private DefinitionsContainer defsContainer;
        
        /**
         * 
         */
        private EntityContainer entContainer;
        
        /**
         * A private Constructor prevents any other class from instantiating
         */
        private Catalog() {
        }
        
        /**
         * 
         * @return      Catalog         single instance of Catalog
         */
        public static final Catalog getInstance() {
                return catalog;
        }
        
        /**
         *  
         * @return rootCategory
         */
        public Category getRootCategory() {
                // lazily de-serialize from disk
                // TODO
                return this.rootCategory;
        }
        
        /**
         * 
         * @return defsContainer
         */
        public DefinitionsContainer getDefinitionsContainer() {         
                if(this.defsContainer == null) {
                        this.defsContainer = new DefinitionsContainer();
                }
                return this.defsContainer;
        }
        
        /**
         * 
         * @return EntityContainer
         */
        public EntityContainer getEntityContainer() {           
                if(this.entContainer == null) {
                        this.entContainer = new EntityContainer();
                }
                return this.entContainer;
        }
}