public TowerWarehouse (Parser parser) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
        jsonArray = parser.getJSONArray(GameEngineConstant.TOWER_TYPE);
        towers = new HashMap<String, TowerFactory>();

        // loop through all kinds
        for (int i = 0; i < jsonArray.length(); i++) {
            JSONObject currTower = jsonArray.getJSONObject(i);
            String name = currTower.getString(GameEngineConstant.PURCHASE_INFO_NAME);
            String type = currTower.getString(GameEngineConstant.PURCHASE_INFO_TYPE);
            TowerFactory towerFactory = null;
            
            /**
             * Now it create DefaultTowerFactory no matter what
             * Later should create different TowerFactory according to the Json File
             * 
             * reflection - http://stackoverflow.com/questions/6310730/using-reflection-java-reflection-constructor-newinstance
             */
            Class<?> fooClass = null;
            try {
                fooClass = Class.forName("gameEngine.factory.towerfactory."+type+"Factory");
            }
            catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            Constructor<?>[] fooCtrs = fooClass.getConstructors();
            Class<?>[] types = fooCtrs[0].getParameterTypes();
            Object[] params = new Object[types.length];
            params[0] = types[0].cast(currTower);
            towerFactory = (TowerFactory)fooCtrs[0].newInstance(params);
         
            
            towers.put(name, towerFactory);
        }
    }