// Path: src/main/java/com/openthinks/easyweb/context/parser/ConfigureParser.java
// public interface ConfigureParser {
// 
// 	/**
// 	 * get the scanned packages configure item
// 	 * @return String[]
// 	 */
// 	String[] scanPackages();
// 
// 	/**
// 	 * get the request suffix configure item
// 	 * @return one request suffix
// 	 * @see RequestSuffix
// 	 */
// 	String requestSuffix();
// 
// 	/**
// 	 * get {@link Bootstrap} instance
// 	 * @return Bootstrap instance
// 	 * @throws ClassNotFoundException occurs when class not found
// 	 * @throws InstantiationException occurs when new instance by Class
// 	 * @throws IllegalAccessException occurs when illegal access happen
// 	 */
// 	Bootstrap bootstarp() throws ClassNotFoundException, InstantiationException, IllegalAccessException;
// 
// 	/**
// 	 * get the EasyWeb controller package scan way
// 	 * @return {@link ScanWayEnum}
// 	 */
// 	ScanWayEnum getScanWay();
// }
// 
// Path: src/main/java/com/openthinks/easyweb/context/parser/WebConfigureAnnoationParser.java
// public class WebConfigureAnnoationParser implements ConfigureParser {
// 	private final Class<?> configureClass;
// 
// 	public WebConfigureAnnoationParser(String configureClassName) throws ClassNotFoundException {
// 		configureClass = Class.forName(configureClassName);
// 		checkNecessaryAnnoation();
// 	}
// 
// 	private void checkNecessaryAnnoation() throws CheckerNoPassException {
// 		if (configureClass.getAnnotation(EasyConfigure.class) == null)
// 			throw new CheckerNoPassException(getClass(), "checkNecessaryAnnoation");
// 		if (configureClass.getAnnotation(ScanPackages.class) == null)
// 			throw new CheckerNoPassException(getClass(), "checkNecessaryAnnoation");
// 		if (configureClass.getAnnotation(RequestSuffixs.class) == null)
// 			throw new CheckerNoPassException(getClass(), "checkNecessaryAnnoation");
// 	}
// 
// 	@Override
// 	public String[] scanPackages() {
// 		ScanPackages packages = configureClass.getAnnotation(ScanPackages.class);
// 		return packages == null ? new String[] {} : packages.value();
// 	}
// 
// 	@Override
// 	public String requestSuffix() {
// 		RequestSuffixs suffixs = configureClass.getAnnotation(RequestSuffixs.class);
// 		return suffixs == null ? "" : suffixs.value();
// 	}
// 
// 	@Override
// 	public Bootstrap bootstarp() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
// 		Class<?> bootstarp = this.configureClass;
// 		BootstrapClass bootAnnotation = configureClass.getAnnotation(BootstrapClass.class);
// 		if (bootAnnotation != null) {
// 			bootstarp = Class.forName(bootAnnotation.value());
// 		}
// 		if (bootstarp != null && Bootstrap.class.isAssignableFrom(bootstarp)) {
// 			@SuppressWarnings("unchecked")
// 			Class<? extends Bootstrap> bootstarpClass = (Class<? extends Bootstrap>) bootstarp;
// 			Bootstrap bootObj = InstanceUtilities.create(bootstarpClass, null);
// 			return bootObj;
// 		}
// 		return new NullBootstrap();
// 	}
// 
// 	@Override
// 	public ScanWayEnum getScanWay() {
// 		ScanWay scanWay = configureClass.getAnnotation(ScanWay.class);
// 		if (scanWay == null) {
// 			return ScanWayEnum.FILE_PATH;
// 		}
// 		return scanWay.value();
// 	}
// 
// }
// 
// Path: src/main/java/com/openthinks/easyweb/context/parser/WebConfigureFileParser.java
// public class WebConfigureFileParser implements ConfigureParser {
// 	private final String configureLocation;
// 
// 	public WebConfigureFileParser(String configureLocation) {
// 		this.configureLocation = configureLocation;
// 		System.out.println(this.configureLocation);
// 	}
// 
// 	/**
// 	 * TODO
// 	 */
// 	@Override
// 	public String[] scanPackages() {
// 
// 		return new String[] { "com.openthinks.easyweb.test" };
// 	}
// 
// 	/**
// 	 * TODO
// 	 */
// 	@Override
// 	public String requestSuffix() {
// 
// 		return ".do,.htm";
// 	}
// 
// 	/**
// 	 * TODO
// 	 */
// 	@Override
// 	public Bootstrap bootstarp() {
// 
// 		return null;
// 	}
// 
// 	@Override
// 	public ScanWayEnum getScanWay() {
// 		return ScanWayEnum.FILE_PATH;
// 	}
// 
// }


import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import com.openthinks.easyweb.annotation.configure.ScanWay.ScanWayEnum;
import com.openthinks.easyweb.context.parser.ConfigureParser;
import com.openthinks.easyweb.context.parser.WebConfigureAnnoationParser;
import com.openthinks.easyweb.context.parser.WebConfigureFileParser;
import com.openthinks.libs.utilities.CommonUtilities;
import com.openthinks.libs.utilities.logger.ProcessLogger;

/**
 * 
 */
package com.openthinks.easyweb.context;



/**
 * The implementation of {@link WebConfigure}
 * @author minjdai
 * 
 */
public class WebContextConfige implements WebConfigure {
	private final ConfigureParser parser;

	public WebContextConfige() throws ClassNotFoundException {
		String configureLocation = WebContexts.getServletContext().getInitParameter(CONFIGURE_FILE_LOCATION);
		if (configureLocation != null) {
			parser = new WebConfigureFileParser(configureLocation);

// Path: src/main/java/com/openthinks/easyweb/context/parser/ConfigureParser.java
// public interface ConfigureParser {
// 
// 	/**
// 	 * get the scanned packages configure item
// 	 * @return String[]
// 	 */
// 	String[] scanPackages();
// 
// 	/**
// 	 * get the request suffix configure item
// 	 * @return one request suffix
// 	 * @see RequestSuffix
// 	 */
// 	String requestSuffix();
// 
// 	/**
// 	 * get {@link Bootstrap} instance
// 	 * @return Bootstrap instance
// 	 * @throws ClassNotFoundException occurs when class not found
// 	 * @throws InstantiationException occurs when new instance by Class
// 	 * @throws IllegalAccessException occurs when illegal access happen
// 	 */
// 	Bootstrap bootstarp() throws ClassNotFoundException, InstantiationException, IllegalAccessException;
// 
// 	/**
// 	 * get the EasyWeb controller package scan way
// 	 * @return {@link ScanWayEnum}
// 	 */
// 	ScanWayEnum getScanWay();
// }
// 
// Path: src/main/java/com/openthinks/easyweb/context/parser/WebConfigureAnnoationParser.java
// public class WebConfigureAnnoationParser implements ConfigureParser {
// 	private final Class<?> configureClass;
// 
// 	public WebConfigureAnnoationParser(String configureClassName) throws ClassNotFoundException {
// 		configureClass = Class.forName(configureClassName);
// 		checkNecessaryAnnoation();
// 	}
// 
// 	private void checkNecessaryAnnoation() throws CheckerNoPassException {
// 		if (configureClass.getAnnotation(EasyConfigure.class) == null)
// 			throw new CheckerNoPassException(getClass(), "checkNecessaryAnnoation");
// 		if (configureClass.getAnnotation(ScanPackages.class) == null)
// 			throw new CheckerNoPassException(getClass(), "checkNecessaryAnnoation");
// 		if (configureClass.getAnnotation(RequestSuffixs.class) == null)
// 			throw new CheckerNoPassException(getClass(), "checkNecessaryAnnoation");
// 	}
// 
// 	@Override
// 	public String[] scanPackages() {
// 		ScanPackages packages = configureClass.getAnnotation(ScanPackages.class);
// 		return packages == null ? new String[] {} : packages.value();
// 	}
// 
// 	@Override
// 	public String requestSuffix() {
// 		RequestSuffixs suffixs = configureClass.getAnnotation(RequestSuffixs.class);
// 		return suffixs == null ? "" : suffixs.value();
// 	}
// 
// 	@Override
// 	public Bootstrap bootstarp() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
// 		Class<?> bootstarp = this.configureClass;
// 		BootstrapClass bootAnnotation = configureClass.getAnnotation(BootstrapClass.class);
// 		if (bootAnnotation != null) {
// 			bootstarp = Class.forName(bootAnnotation.value());
// 		}
// 		if (bootstarp != null && Bootstrap.class.isAssignableFrom(bootstarp)) {
// 			@SuppressWarnings("unchecked")
// 			Class<? extends Bootstrap> bootstarpClass = (Class<? extends Bootstrap>) bootstarp;
// 			Bootstrap bootObj = InstanceUtilities.create(bootstarpClass, null);
// 			return bootObj;
// 		}
// 		return new NullBootstrap();
// 	}
// 
// 	@Override
// 	public ScanWayEnum getScanWay() {
// 		ScanWay scanWay = configureClass.getAnnotation(ScanWay.class);
// 		if (scanWay == null) {
// 			return ScanWayEnum.FILE_PATH;
// 		}
// 		return scanWay.value();
// 	}
// 
// }
// 
// Path: src/main/java/com/openthinks/easyweb/context/parser/WebConfigureFileParser.java
// public class WebConfigureFileParser implements ConfigureParser {
// 	private final String configureLocation;
// 
// 	public WebConfigureFileParser(String configureLocation) {
// 		this.configureLocation = configureLocation;
// 		System.out.println(this.configureLocation);
// 	}
// 
// 	/**
// 	 * TODO
// 	 */
// 	@Override
// 	public String[] scanPackages() {
// 
// 		return new String[] { "com.openthinks.easyweb.test" };
// 	}
// 
// 	/**
// 	 * TODO
// 	 */
// 	@Override
// 	public String requestSuffix() {
// 
// 		return ".do,.htm";
// 	}
// 
// 	/**
// 	 * TODO
// 	 */
// 	@Override
// 	public Bootstrap bootstarp() {
// 
// 		return null;
// 	}
// 
// 	@Override
// 	public ScanWayEnum getScanWay() {
// 		return ScanWayEnum.FILE_PATH;
// 	}
// 
// }


// Path: src/main/java/com/openthinks/easyweb/context/WebContextConfige.java
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import com.openthinks.easyweb.annotation.configure.ScanWay.ScanWayEnum;
import com.openthinks.easyweb.context.parser.ConfigureParser;
import com.openthinks.easyweb.context.parser.WebConfigureAnnoationParser;
import com.openthinks.easyweb.context.parser.WebConfigureFileParser;
import com.openthinks.libs.utilities.CommonUtilities;
import com.openthinks.libs.utilities.logger.ProcessLogger;

/**
 * 
 */
package com.openthinks.easyweb.context;



/**
 * The implementation of {@link WebConfigure}
 * @author minjdai
 * 
 */
public class WebContextConfige implements WebConfigure {
	private final ConfigureParser parser;

	public WebContextConfige() throws ClassNotFoundException {
		String configureLocation = WebContexts.getServletContext().getInitParameter(CONFIGURE_FILE_LOCATION);
		if (configureLocation != null) {
			parser = new WebConfigureFileParser(configureLocation);

		} else {
