001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: Servlet.java,v 1.2 2006/09/29 12:32:13 drmlipp Exp $
021: *
022: * $Log: Servlet.java,v $
023: * Revision 1.2 2006/09/29 12:32:13 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/12/19 13:01:50 drmlipp
027: * Updated to 1.1rc1
028: *
029: * Revision 1.1 2003/11/11 10:51:25 lipp
030: * New "test".
031: *
032: */
033: package testservlet;
034:
035: import java.io.IOException;
036:
037: import java.util.Iterator;
038:
039: import javax.servlet.ServletConfig;
040: import javax.servlet.ServletException;
041: import javax.servlet.ServletOutputStream;
042: import javax.servlet.http.HttpServlet;
043: import javax.servlet.http.HttpServletRequest;
044: import javax.servlet.http.HttpServletResponse;
045:
046: import de.danet.an.workflow.api.ProcessDefinition;
047: import de.danet.an.workflow.api.ProcessDefinitionDirectory;
048: import de.danet.an.workflow.api.WorkflowService;
049: import de.danet.an.workflow.api.WorkflowServiceFactory;
050:
051: /**
052: * This class provides ...
053: *
054: * @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
055: * @version $Revision: 1.2 $
056: */
057:
058: public class Servlet extends HttpServlet {
059:
060: private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
061: .getLog(Servlet.class);
062:
063: /**
064: * Describe <code>init</code> method here.
065: *
066: * @param servletConfig a <code>ServletConfig</code> value
067: * @exception ServletException if an error occurs
068: */
069: public void init(ServletConfig servletConfig)
070: throws ServletException {
071: }
072:
073: /**
074: * Describe <code>doPost</code> method here.
075: *
076: * @param request a <code>HttpServletRequest</code> value
077: * @param response a <code>HttpServletResponse</code> value
078: * @exception ServletException if an error occurs
079: * @exception IOException if an error occurs
080: */
081: public void doPost(HttpServletRequest request,
082: HttpServletResponse response) throws ServletException,
083: IOException {
084: doPost(request, response);
085: }
086:
087: /**
088: * Describe <code>doGet</code> method here.
089: *
090: * @param request a <code>HttpServletRequest</code> value
091: * @param response a <code>HttpServletResponse</code> value
092: * @exception ServletException if an error occurs
093: * @exception IOException if an error occurs
094: */
095: public void doGet(HttpServletRequest request,
096: HttpServletResponse response) throws ServletException,
097: IOException {
098: response.setContentType("text/html");
099: ServletOutputStream out = response.getOutputStream();
100: out.println("<html>");
101: out.println("<head><title>Test Servlet</title></head>");
102: out.println("<body>");
103: out.println("<h1>Process definitions</h1>");
104:
105: WorkflowService wfs = null;
106: ProcessDefinitionDirectory pdd = null;
107: try {
108: WorkflowServiceFactory wfsf = WorkflowServiceFactory
109: .newInstance();
110: wfs = wfsf.newWorkflowService();
111: pdd = wfs.processDefinitionDirectory();
112: for (Iterator i = pdd.processDefinitions().iterator(); i
113: .hasNext();) {
114: ProcessDefinition pd = (ProcessDefinition) i.next();
115: out.println(pd.packageName() + "/" + pd.processName()
116: + "<br>");
117: }
118: } finally {
119: if (wfs != null) {
120: wfs.release(pdd);
121: wfs.release(wfs);
122: }
123: }
124: out.println("</body></html>");
125: }
126: }
|