List of usage examples for org.apache.commons.chain CatalogFactory getCatalog
public abstract Catalog getCatalog(String name);
Retrieves a Catalog instance by name (if any); otherwise return null
.
From source file:com.liulangf.pattern.gof.behavioral.chain.jakarta.simple.ExampleServlet.java
/** * <p>Configure a {@link ServletWebContext} for the current request, and * pass it to the <code>execute()</code> method of the specified * {@link Command}, loaded from our configured {@link Catalog}.</p> * * @param request The request we are processing * @param response The response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception occurs *//*from ww w . ja v a 2s.c o m*/ public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { CatalogFactory factory = CatalogFactory.getInstance(); Catalog catalog = factory.getCatalog(servletName); if (catalog == null) { catalog = factory.getCatalog(); } ServletWebContext context = new ServletWebContext(getServletContext(), request, response); Command command = catalog.getCommand("COMMAND_MAPPER"); try { command.execute(context); } catch (Exception e) { throw new ServletException(e); } }
From source file:net.jradius.handler.EventHandlerChain.java
public Catalog getCatalog() { if (this.catalog == null) { CatalogFactory factory = CatalogFactory.getInstance(); this.catalog = factory.getCatalog(getCatalogName()); if (this.catalog == null) { RadiusLog.error("Unknown catalog named: " + getCatalogName()); }//w w w . jav a2 s. co m } return this.catalog; }