ListMailFactoriesAction.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * --------------------------------------------------------------------------
00022  * $Id: ListMailFactoriesAction.java,v 1.3 2004/03/19 14:31:47 sauthieg Exp $
00023  * --------------------------------------------------------------------------
00024  */
00025 
00026 package org.objectweb.jonas.webapp.jonasadmin.resource;
00027 
00028 import java.io.IOException;
00029 import java.util.ArrayList;
00030 import java.util.Iterator;
00031 
00032 import javax.servlet.ServletException;
00033 import javax.servlet.http.HttpServletRequest;
00034 import javax.servlet.http.HttpServletResponse;
00035 
00036 import org.apache.struts.action.ActionForm;
00037 import org.apache.struts.action.ActionForward;
00038 import org.apache.struts.action.ActionMapping;
00039 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx;
00040 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
00041 
00046 public class ListMailFactoriesAction extends JonasBaseAction {
00047 
00048 // --------------------------------------------------------- Public Methods
00049 
00052     public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form
00053         , HttpServletRequest p_Request, HttpServletResponse p_Response)
00054         throws IOException, ServletException {
00055 
00056         // no Form used
00057         try {
00058             ArrayList alSessionDeployable = JonasAdminJmx.getSessionMailFilesDeployable();
00059             ArrayList alMimePartDeployable = JonasAdminJmx.getMimePartMailFilesDeployable();
00060             ArrayList alDeployed = JonasAdminJmx.getMailFilesDeployed(m_WhereAreYou);
00061 
00062             ArrayList al = new ArrayList();
00063             String sName;
00064             boolean bDeployed;
00065             Iterator it = alSessionDeployable.iterator();
00066             while (it.hasNext()) {
00067                 sName = it.next().toString();
00068                 bDeployed = alDeployed.contains(sName);
00069                 al.add(new MailFactoryItem(sName, bDeployed, "session"));
00070             }
00071             it = alMimePartDeployable.iterator();
00072             while (it.hasNext()) {
00073                 sName = it.next().toString();
00074                 bDeployed = alDeployed.contains(sName);
00075                 al.add(new MailFactoryItem(sName, bDeployed, "mimepart"));
00076             }
00077             //Collections.sort(al, new DatasourceItemByNameComparator());
00078             // Set list in the request
00079             p_Request.setAttribute("listMailFactories", al);
00080         }
00081         catch (Throwable t) {
00082             addGlobalError(t);
00083             saveErrors(p_Request, m_Errors);
00084             return (p_Mapping.findForward("Global Error"));
00085         }
00086         // Forward to the jsp.
00087         return (p_Mapping.findForward("MailFactories"));
00088     }
00089 }

Generated on Tue Feb 15 15:05:30 2005 for JOnAS by  doxygen 1.3.9.1