1 25 26 package org.objectweb.jonas.webapp.jonasadmin.jonasserver; 27 28 import java.io.IOException ; 29 import java.util.Iterator ; 30 import java.util.List ; 31 32 import javax.management.ObjectName ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.http.HttpServletResponse ; 36 37 import org.apache.struts.action.ActionForm; 38 import org.apache.struts.action.ActionForward; 39 import org.apache.struts.action.ActionMapping; 40 import org.objectweb.jonas.jmx.J2eeObjectName; 41 import org.objectweb.jonas.jmx.JonasManagementRepr; 42 import org.objectweb.jonas.jmx.JonasObjectName; 43 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 44 45 49 public class ListRegistryAction extends JonasBaseAction { 50 62 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 63 , HttpServletRequest pRequest, HttpServletResponse pResponse) 64 throws IOException , ServletException { 65 66 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER), true); 68 JndiResourcesForm oForm = new JndiResourcesForm(); 70 71 try { 72 String pDomainName = m_WhereAreYou.getCurrentDomainName(); 73 String pServerName = m_WhereAreYou.getCurrentJonasServerName(); 74 ObjectName ons = J2eeObjectName.JNDIResources(pDomainName, pServerName); 75 Iterator itNames = JonasManagementRepr.queryNames(ons).iterator(); 76 List lNames = null; 77 int nbJNDIResources = 0; 78 while (itNames.hasNext()) { 79 JndiResourceItem item = new JndiResourceItem(); 80 ObjectName itOn = (ObjectName ) itNames.next(); 81 item.setProviderUrl(getStringAttribute(itOn, "ProviderURL")); 82 item.setProtocol(getStringAttribute(itOn, "Name")); 83 item.setResourceON(itOn.toString()); 84 lNames = getListAttribute(itOn, "Names"); 85 oForm.addProvider(item); 86 nbJNDIResources++; 87 } 88 if (nbJNDIResources == 1) { 89 oForm.setListNames(lNames); 90 } 91 if (JonasManagementRepr.isRegistered(JonasObjectName.webContainerService())) { 92 oForm.setPresentServletContainer(true); 93 } else { 94 oForm.setPresentServletContainer(false); 95 } 96 pRequest.setAttribute("jndiResourcesForm", oForm); 97 } catch (Throwable t) { 98 addGlobalError(t); 99 saveErrors(pRequest, m_Errors); 100 return (pMapping.findForward("Global Error")); 101 } 102 return (pMapping.findForward("Registry")); 104 } 105 } 106 | Popular Tags |