package compbio.ws.server; import java.util.HashSet; import java.util.Set; import java.util.TreeSet; import compbio.ws.client.Services; /** * Class that splits {@link Services} to categories. Services themselves have no * knowledge which category they belongs to. * * This class is responsible for initialization of all the categories (done * statically) and holds the category names as constrains. * * * @author pvtroshin * @version 1.0 September 2011 */ public class Category { /* * TODO refactor initialization and constrains into separate classes if * further complexity is expected. */ /** * All of the Category names */ public static final String CATEGORY_ALIGNMENT = "Alignment"; public static final String CATEGORY_DISORDER = "Protein Disorder"; public static final String CATEGORY_CONSERVATION = "Conservation"; String name; Set services; private Category(String name, Set services) { this.name = name; this.services = services; } Set getServices() { return new TreeSet(services); } public static Set getCategories() { return init(); } private static Set init() { Set align_services = new HashSet(); align_services.add(Services.ClustalOWS); align_services.add(Services.ClustalWS); align_services.add(Services.MafftWS); align_services.add(Services.MuscleWS); align_services.add(Services.ProbconsWS); align_services.add(Services.TcoffeeWS); Category alignment = new Category(CATEGORY_ALIGNMENT, align_services); Set disorder_services = new HashSet(); align_services.add(Services.DisemblWS); align_services.add(Services.GlobPlotWS); align_services.add(Services.IUPredWS); align_services.add(Services.JronnWS); Category disorder = new Category(CATEGORY_DISORDER, disorder_services); Set conservation_services = new HashSet(); align_services.add(Services.AAConWS); Category conservation = new Category(CATEGORY_CONSERVATION, conservation_services); Set categories = new HashSet(); categories.add(alignment); categories.add(disorder); categories.add(conservation); return categories; } }