ListSessionMailFactoriesAction.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: ListSessionMailFactoriesAction.java,v 1.6 2004/03/19 14:31:49 sauthieg Exp $
00023  * --------------------------------------------------------------------------
00024  */
00025 
00026 package org.objectweb.jonas.webapp.jonasadmin.service.mail;
00027 
00028 import java.io.IOException;
00029 import java.util.ArrayList;
00030 import java.util.Iterator;
00031 
00032 import javax.management.ObjectName;
00033 import javax.servlet.ServletException;
00034 import javax.servlet.http.HttpServletRequest;
00035 import javax.servlet.http.HttpServletResponse;
00036 
00037 import org.apache.struts.action.ActionForm;
00038 import org.apache.struts.action.ActionForward;
00039 import org.apache.struts.action.ActionMapping;
00040 import org.objectweb.jonas.jmx.J2eeObjectName;
00041 import org.objectweb.jonas.mail.MailServiceImpl;
00042 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx;
00043 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
00044 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
00045 
00050 public class ListSessionMailFactoriesAction extends JonasBaseAction {
00051 
00052     public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form
00053         , HttpServletRequest p_Request, HttpServletResponse p_Response)
00054         throws IOException, ServletException {
00055 
00056         // Force the node selected in tree
00057         m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR
00058             + "services" + WhereAreYou.NODE_SEPARATOR + "mail" + WhereAreYou.NODE_SEPARATOR
00059             + "session", true);
00060 
00061         // no Form used
00062         try {
00063             String sName;
00064             String sJndiName;
00065             ObjectName oObjectName;
00066             ArrayList al = new ArrayList(); // list of items
00067 
00068             ArrayList alDeployed = JonasAdminJmx.getSessionMailFactoriesDeployed(m_WhereAreYou);
00069             Iterator it = alDeployed.iterator();
00070             String domainName = m_WhereAreYou.getCurrentDomainName();
00071             String serverName = m_WhereAreYou.getCurrentJonasServerName();
00072             while (it.hasNext()) {
00073                 sName = it.next().toString();
00074                 //oObjectName = JonasObjectName.sessionMailFactory(sName);
00075                 oObjectName = J2eeObjectName.JavaMailResource(domainName, sName, serverName
00076                     , MailServiceImpl.SESSION_PROPERTY_TYPE);
00077                 sJndiName = getStringAttribute(oObjectName, "Name");
00078                 al.add(new MailFactoryItem(sName, sJndiName));
00079             }
00080 
00081             // Set list in the request
00082             p_Request.setAttribute("listMailFactories", al);
00083         }
00084         catch (Throwable t) {
00085             addGlobalError(t);
00086             saveErrors(p_Request, m_Errors);
00087             return (p_Mapping.findForward("Global Error"));
00088         }
00089 
00090         // Forward to the jsp.
00091         return (p_Mapping.findForward("Session Factories"));
00092     }
00093 }

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