1 package edu.internet2.middleware.shibboleth.wayf;
3 import java.util.HashSet;
5 import org.apache.log4j.Logger;
8 * Class used by the WAYF service to determine runtime options
9 * Most of the fields of this class should have reasonable defaults set
10 * @author Walter Hoehn
13 public class WayfConfig {
15 private static Logger log = Logger.getLogger(WayfConfig.class.getName());
17 private static WayfOrigins wd;
18 private static String location;
19 private static String logoLocation = "images/internet2.gif";
20 private static String supportContact = "mailto:shib-support@internet2.org";
21 private static String helpText =
22 "In order to fulfill the request for the web resource you "
23 + "have just chosen, information must first be obtained from "
24 + "your home institution. Please select the institution with "
25 + "which you are affiliated.";
26 private static String searchResultEmptyText =
27 "No institution found that matches your search "
28 + "criteria, please try again.";
29 private static HashSet ignoredForMatch = new HashSet();
31 private static String cache = "SESSION";
34 * Constructor for WayfConfig.
42 * @return Returns a WayfOrigins
44 public static WayfOrigins getWAYFData() {
50 * @param wd The wd to set
52 public void setWAYFData(WayfOrigins wd) {
57 * Gets the searchResultEmptyText.
58 * @return Returns a String
60 public static String getSearchResultEmptyText() {
61 return searchResultEmptyText;
65 * Sets the searchResultEmptyText.
66 * @param searchResultEmptyText The searchResultEmptyText to set
68 public void setSearchResultEmptyText(String searchResultEmptyText) {
69 WayfConfig.searchResultEmptyText = searchResultEmptyText;
74 * @return Returns a String
76 public static String getHelpText() {
82 * @param helpText The helpText to set
84 public void setHelpText(String helpText) {
85 WayfConfig.helpText = helpText;
89 * Gets the supportContact.
90 * @return Returns a String
92 public static String getSupportContact() {
93 return supportContact;
97 * Sets the supportContact.
98 * @param supportContact The supportContact to set
100 public void setSupportContact(String supportContact) {
101 WayfConfig.supportContact = supportContact;
105 * Gets the logoLocation.
106 * @return Returns a String
108 public static String getLogoLocation() {
113 * Sets the logoLocation.
114 * @param logoLocation The logoLocation to set
116 public void setLogoLocation(String logoLocation) {
117 WayfConfig.logoLocation = logoLocation;
122 * @return Returns a String
124 public static String getLocation() {
130 * @param location The location to set
132 public void setLocation(String location) {
133 WayfConfig.location = location;
137 * Determines if a particular string token should be used for matching when a user searches for origins.
138 * @param str The string to lookup
140 public static boolean isIgnoredForMatch(String str) {
142 if (ignoredForMatch.contains(str.toLowerCase())) {
150 * Sets the tokens that should be ignored when a user searches for an origin site.
151 * @param s The ignored tokens are passed as a single string, each separated by whitespace
153 public void addIgnoredForMatch(String s) {
155 ignoredForMatch.add(s.toLowerCase());
160 * @return Returns a String
162 public static String getCache() {
168 * @param cache The cache to set
170 public void setCache(String cache) {
171 if (cache.toUpperCase().equals("NONE")
172 || cache.toUpperCase().equals("SESSION")
173 || cache.toUpperCase().equals("COOKIES")) {
174 WayfConfig.cache = cache.toUpperCase();
177 "Cache type :" + cache + ": not recognized, using default.");