// Path: core/src/main/java/com/ccoe/build/core/filter/model/Category.java
// @XmlAccessorType(XmlAccessType.FIELD)
// public class Category {
// 	@XmlAttribute
// 	private String name;
// 	
// 	@XmlElement(name="filter")
// 	private List<Filter> filters = new ArrayList<Filter>();
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 	
// 	public List<Filter> getFilter() {
// 		return this.filters;
// 	}
// }
// 
// Path: core/src/main/java/com/ccoe/build/core/filter/model/Filter.java
// @XmlAccessorType(XmlAccessType.FIELD)
// public class Filter {
// 	@XmlAttribute
// 	private String name;
// 	
// 	@XmlAttribute
// 	private String description;
// 	
// 	private String category;
// 
// 	@XmlElement(name="cause")
// 	private List<Cause> cause = new ArrayList<Cause>();
// 	
// 	public List<Cause> getCause() {
// 		return this.cause;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 	
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description= description;
// 	}
// 
// 	public String getCategory() {
// 		return category;
// 	}
// 
// 	public void setCategory(String category) {
// 		this.category = category;
// 	}
// 	
// 	public void setCauses(List<Cause> lsCause){
// 		this.cause = lsCause;
// 	}
// }
// 
// Path: core/src/main/java/com/ccoe/build/core/filter/model/Filters.java
// @XmlRootElement(name = "filters")
// public class Filters {
// 	@XmlElement(name="category")
// 	List<Category> categories = new ArrayList<Category>();
// 	
// 	public List<Category> getCategory() {
// 		return this.categories;
// 	}
// }


import com.ccoe.build.core.filter.model.Category;
import com.ccoe.build.core.filter.model.Filter;
import com.ccoe.build.core.filter.model.Filters;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
	protected Filters unmarshal(InputStream is) throws JAXBException {
		JAXBContext jc;
		jc = JAXBContext.newInstance(Filters.class);
		Unmarshaller u = jc.createUnmarshaller();
		return (Filters) u.unmarshal(is);
	}
	
	protected Filters unmarshal(URL aURL) throws JAXBException {
		JAXBContext jc;
		jc = JAXBContext.newInstance(Filters.class);
		Unmarshaller u = jc.createUnmarshaller();
		return (Filters) u.unmarshal(aURL);
	}
	
	protected List<Filter> build(URL url, URL defaultFilterList) {
		Filters filters = new Filters();

		try {
			filters = unmarshal(url);
		} catch (Exception e) {
			System.err.println("Can not unmarshall the remote file " + url + " Caused by " + e.getMessage());
			try {
				filters = unmarshal(defaultFilterList);
			} catch (JAXBException e1) {
				System.err.println("Can not unmarshall the local file " + defaultFilterList + " Caused by " + e.getMessage());
			}
		}
		
		List<Filter> results = new ArrayList<Filter>();
		
// Path: core/src/main/java/com/ccoe/build/core/filter/model/Category.java
// @XmlAccessorType(XmlAccessType.FIELD)
// public class Category {
// 	@XmlAttribute
// 	private String name;
// 	
// 	@XmlElement(name="filter")
// 	private List<Filter> filters = new ArrayList<Filter>();
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 	
// 	public List<Filter> getFilter() {
// 		return this.filters;
// 	}
// }
// 
// Path: core/src/main/java/com/ccoe/build/core/filter/model/Filter.java
// @XmlAccessorType(XmlAccessType.FIELD)
// public class Filter {
// 	@XmlAttribute
// 	private String name;
// 	
// 	@XmlAttribute
// 	private String description;
// 	
// 	private String category;
// 
// 	@XmlElement(name="cause")
// 	private List<Cause> cause = new ArrayList<Cause>();
// 	
// 	public List<Cause> getCause() {
// 		return this.cause;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 	
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description= description;
// 	}
// 
// 	public String getCategory() {
// 		return category;
// 	}
// 
// 	public void setCategory(String category) {
// 		this.category = category;
// 	}
// 	
// 	public void setCauses(List<Cause> lsCause){
// 		this.cause = lsCause;
// 	}
// }
// 
// Path: core/src/main/java/com/ccoe/build/core/filter/model/Filters.java
// @XmlRootElement(name = "filters")
// public class Filters {
// 	@XmlElement(name="category")
// 	List<Category> categories = new ArrayList<Category>();
// 	
// 	public List<Category> getCategory() {
// 		return this.categories;
// 	}
// }


// Path: core/src/main/java/com/ccoe/build/core/filter/FilterFactory.java
import com.ccoe.build.core.filter.model.Category;
import com.ccoe.build.core.filter.model.Filter;
import com.ccoe.build.core.filter.model.Filters;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;

	protected Filters unmarshal(InputStream is) throws JAXBException {
		JAXBContext jc;
		jc = JAXBContext.newInstance(Filters.class);
		Unmarshaller u = jc.createUnmarshaller();
		return (Filters) u.unmarshal(is);
	}
	
	protected Filters unmarshal(URL aURL) throws JAXBException {
		JAXBContext jc;
		jc = JAXBContext.newInstance(Filters.class);
		Unmarshaller u = jc.createUnmarshaller();
		return (Filters) u.unmarshal(aURL);
	}
	
	protected List<Filter> build(URL url, URL defaultFilterList) {
		Filters filters = new Filters();

		try {
			filters = unmarshal(url);
		} catch (Exception e) {
			System.err.println("Can not unmarshall the remote file " + url + " Caused by " + e.getMessage());
			try {
				filters = unmarshal(defaultFilterList);
			} catch (JAXBException e1) {
				System.err.println("Can not unmarshall the local file " + defaultFilterList + " Caused by " + e.getMessage());
			}
		}
		
		List<Filter> results = new ArrayList<Filter>();
		
		for (Category category : filters.getCategory()) {