refactored to provide one abstract method to override

This commit is contained in:
Scott Battaglia 2006-09-28 13:41:41 +00:00
parent 1771f0a51f
commit 7a608c2e4f
3 changed files with 15 additions and 15 deletions

View File

@ -9,6 +9,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jasig.cas.client.util.CommonUtils;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@ -85,8 +86,9 @@ public abstract class AbstractProxyReceptorServlet extends HttpServlet {
"<casClient:proxySuccess xmlns:casClient=\"http://www.yale.edu/tp/casClient\" />");
}
protected final void setProxyGrantingTicketStorage(
final ProxyGrantingTicketStorage proxyGrantingTicketStorage) {
this.proxyGrantingTicketStorage = proxyGrantingTicketStorage;
public final void init(final ServletConfig servletConfig) throws ServletException {
this.proxyGrantingTicketStorage = retrieveProxyGrantingTicketStorageFromConfiguration(servletConfig);
}
protected abstract ProxyGrantingTicketStorage retrieveProxyGrantingTicketStorageFromConfiguration(final ServletConfig servletConfig) throws ServletException;
}

View File

@ -35,16 +35,14 @@ public final class SpringConfiguredProxyReceptorServlet extends
*/
private static final long serialVersionUID = -5642050740265266568L;
public void init(final ServletConfig servletConfig) throws ServletException {
protected ProxyGrantingTicketStorage retrieveProxyGrantingTicketStorageFromConfiguration(final ServletConfig servletConfig) throws ServletException {
final WebApplicationContext context = WebApplicationContextUtils
.getRequiredWebApplicationContext(servletConfig.getServletContext());
if (context.containsBean(CONST_PROXY_GRANTING_TICKET_STORAGE_BEAN_NAME)) {
this
.setProxyGrantingTicketStorage((ProxyGrantingTicketStorage) context
.getBean(CONST_PROXY_GRANTING_TICKET_STORAGE_BEAN_NAME,
ProxyGrantingTicketStorage.class));
return;
return (ProxyGrantingTicketStorage) context
.getBean(CONST_PROXY_GRANTING_TICKET_STORAGE_BEAN_NAME,
ProxyGrantingTicketStorage.class);
}
final Map map = context
@ -59,8 +57,7 @@ public final class SpringConfiguredProxyReceptorServlet extends
"Expecting one ProxyGrantingTicketStorage and found multiple instances.");
}
setProxyGrantingTicketStorage((ProxyGrantingTicketStorage) map.get(map
.keySet().iterator().next()));
return (ProxyGrantingTicketStorage) map.get(map
.keySet().iterator().next());
}
}

View File

@ -29,11 +29,12 @@ public final class UPortalConfiguredProxyReceptorServlet extends
*/
private static final long serialVersionUID = 6596608588362834646L;
public void init(final ServletConfig servletConfig) throws ServletException {
protected ProxyGrantingTicketStorage retrieveProxyGrantingTicketStorageFromConfiguration(final ServletConfig servletConfig) throws ServletException {
logger.info("Retrieving ProxyGrantingTicketStorage from PortalApplicationContextFacade.");
setProxyGrantingTicketStorage((ProxyGrantingTicketStorage) PortalApplicationContextFacade
return (ProxyGrantingTicketStorage) PortalApplicationContextFacade
.getPortalApplicationContext()
.getBean(
AbstractCasSecurityContextFactory.CONST_CAS_PROXY_GRANTING_TICKET_STORAGE));
AbstractCasSecurityContextFactory.CONST_CAS_PROXY_GRANTING_TICKET_STORAGE);
}
}