Thread: [Ejtools-cvs] applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/action RefreshAction.j
Brought to you by:
letiemble
|
From: <let...@us...> - 2003-11-27 01:30:33
|
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/action
In directory sc8-pr-cvs1:/tmp/cvs-serv17169/jndi.browser/src/main/org/ejtools/jndi/browser/web/action
Modified Files:
RefreshAction.java ViewAction.java
Log Message:
Address Todo #755528
Address Todo #800902
Index: RefreshAction.java
===================================================================
RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/action/RefreshAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RefreshAction.java 5 Aug 2003 22:47:21 -0000 1.4
--- RefreshAction.java 27 Nov 2003 01:30:30 -0000 1.5
***************
*** 68,72 ****
*/
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
! throws IOException, ServletException
{
// Extract attributes we will need
--- 68,72 ----
*/
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
! throws IOException, ServletException
{
// Extract attributes we will need
***************
*** 146,210 ****
while (iterator.hasNext())
{
! ObjectName module = (ObjectName) iterator.next();
! logger.debug("module=" + module);
!
! String moduleName = "";
!
! String moduleURL = (String) module.getKeyProperty("url");
! if (moduleURL != null)
! {
! moduleName = moduleURL;
! }
! else
{
! String moduleId = (String) module.getKeyProperty("module");
String moduleUid = (String) module.getKeyProperty("uid");
-
- moduleName = moduleId;
if ((moduleUid != null) && (!"".equals(moduleUid)))
{
moduleName = moduleName + " (" + moduleUid + ")";
}
! }
!
! moduleNames.add(ResponseUtils.filter(moduleName));
! logger.debug("moduleName=" + moduleName);
! // Get the containes from the module
! Vector containers = (Vector) moduleTrees.get(moduleName);
! if (containers == null)
! {
! containers = new Vector();
! }
! Vector newContainers = new Vector();
! // Create a search table
! Hashtable ejbTable = new Hashtable();
! for (Iterator it = containers.iterator(); it.hasNext(); )
! {
! JNDIContainer container = (JNDIContainer) it.next();
! ejbTable.put(container.getName(), container);
! }
! Collection moduleContainers = (Collection) server.getAttribute(module, "Containers");
! for (Iterator iter = moduleContainers.iterator(); iter.hasNext(); )
! {
! Container ejbContainer = (Container) iter.next();
! String ejbName = ejbContainer.getBeanMetaData().getEjbName();
! JNDIContainer container = (JNDIContainer) ejbTable.get(ejbName);
! logger.debug("container=" + container);
! if (container == null)
{
! container = new JNDIContainer();
! container.setName(ejbName);
! container.setClassLoader(ejbContainer.getClassLoader());
! container.setContext("java:/comp");
}
! logger.debug("refresh container");
! newContainers.add(container);
! container.refresh();
}
- newModuleTrees.put(ResponseUtils.filter(moduleName), newContainers);
- containers.clear();
}
context.setAttribute(Constants.EJBMODULE_NAMES, moduleNames);
--- 146,203 ----
while (iterator.hasNext())
{
! try
{
! ObjectName module = (ObjectName) iterator.next();
! logger.debug("module=" + module);
! String moduleName = (String) module.getKeyProperty("module");
String moduleUid = (String) module.getKeyProperty("uid");
if ((moduleUid != null) && (!"".equals(moduleUid)))
{
moduleName = moduleName + " (" + moduleUid + ")";
}
! moduleNames.add(ResponseUtils.filter(moduleName));
! logger.debug("moduleName=" + moduleName);
! // Get the containes from the module
! Vector containers = (Vector) moduleTrees.get(moduleName);
! if (containers == null)
! {
! containers = new Vector();
! }
! Vector newContainers = new Vector();
! // Create a search table
! Hashtable ejbTable = new Hashtable();
! for (Iterator it = containers.iterator(); it.hasNext(); )
! {
! JNDIContainer container = (JNDIContainer) it.next();
! ejbTable.put(container.getName(), container);
! }
! Collection moduleContainers = (Collection) server.getAttribute(module, "Containers");
! for (Iterator iter = moduleContainers.iterator(); iter.hasNext(); )
{
! Container ejbContainer = (Container) iter.next();
! String ejbName = ejbContainer.getBeanMetaData().getEjbName();
! JNDIContainer container = (JNDIContainer) ejbTable.get(ejbName);
! logger.debug("container=" + container);
! if (container == null)
! {
! container = new JNDIContainer();
! container.setName(ejbName);
! container.setClassLoader(ejbContainer.getClassLoader());
! container.setContext("java:/comp");
! }
! logger.debug("refresh container");
! newContainers.add(container);
! container.refresh();
}
! newModuleTrees.put(ResponseUtils.filter(moduleName), newContainers);
! containers.clear();
! }
! catch (Exception e)
! {
! logger.error("Error while refreshing getting module", e);
}
}
context.setAttribute(Constants.EJBMODULE_NAMES, moduleNames);
Index: ViewAction.java
===================================================================
RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/action/ViewAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ViewAction.java 24 Feb 2003 22:32:21 -0000 1.3
--- ViewAction.java 27 Nov 2003 01:30:30 -0000 1.4
***************
*** 1,137 ****
! /*
! * EJTools, the Enterprise Java Tools
! *
! * Distributable under LGPL license.
! * See terms of license at www.gnu.org.
! */
! package org.ejtools.jndi.browser.web.action;
!
! import java.io.IOException;
! import java.util.Collection;
! import java.util.Hashtable;
! import java.util.Iterator;
! import java.util.Locale;
! import java.util.Vector;
!
! import javax.servlet.ServletContext;
! import javax.servlet.ServletException;
! import javax.servlet.http.HttpServletRequest;
! import javax.servlet.http.HttpServletResponse;
!
! import org.apache.log4j.Logger;
! import org.apache.struts.action.Action;
! import org.apache.struts.action.ActionError;
! import org.apache.struts.action.ActionErrors;
! import org.apache.struts.action.ActionForm;
! import org.apache.struts.action.ActionForward;
! import org.apache.struts.action.ActionMapping;
! import org.apache.struts.util.MessageResources;
! import org.ejtools.jndi.browser.web.Constants;
! import org.ejtools.jndi.browser.web.JNDIContainer;
! import org.ejtools.jndi.browser.web.form.ViewForm;
!
!
! /**
! * Description of the Class
! *
! * @author letiemble
! * @created 12 novembre 2001
! * @version $Revision$
! * @todo Javadoc to complete
! */
! public class ViewAction extends Action
! {
! /** Description of the Field */
! private static Logger logger = Logger.getLogger(ViewAction.class);
!
!
! /** Constructor for the ViewAction object */
! public ViewAction() { }
!
!
! /**
! * Description of the Method
! *
! * @param mapping Description of Parameter
! * @param form Description of Parameter
! * @param request Description of Parameter
! * @param response Description of Parameter
! * @return Description of the Returned Value
! * @exception IOException Description of Exception
! * @exception ServletException Description of Exception
! */
! public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
! throws IOException, ServletException
! {
! String name = null;
! String type = null;
!
! // Extract attributes we will need
! Locale locale = getLocale(request);
! MessageResources messages = getResources();
!
! // Validate the request parameters specified by the user
! ActionErrors errors = new ActionErrors();
!
! if (form instanceof ViewForm)
! {
! name = ((ViewForm) form).getName();
! type = ((ViewForm) form).getType();
! }
! else
! {
! errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("web.index.title"));
! }
!
! // Report any errors we have discovered back to the original form
! if (!errors.empty())
! {
! this.saveErrors(request, errors);
! return (new ActionForward(mapping.getInput()));
! }
!
! ServletContext context = this.getServlet().getServletContext();
!
! if ("ejbmodule".equals(type))
! {
! Hashtable moduleTrees = (Hashtable) context.getAttribute(Constants.EJBMODULE_TREES);
! logger.debug("Viewing JNDI for " + moduleTrees);
! if (moduleTrees == null)
! {
! moduleTrees = new Hashtable();
! }
!
! Collection containers = (Collection) moduleTrees.get(name);
! logger.debug("Viewing JNDI for " + containers);
! if (containers != null)
! {
! context.setAttribute(Constants.EJBMODULE_TREE, containers);
! }
! }
! if ("webapp".equals(type))
! {
! Vector applications = (Vector) context.getAttribute(Constants.WEBAPP_TREES);
! if (applications == null)
! {
! applications = new Vector();
! }
!
! // Create a search table
! Hashtable table = new Hashtable();
! for (Iterator it = applications.iterator(); it.hasNext(); )
! {
! JNDIContainer container = (JNDIContainer) it.next();
! table.put(container.getName(), container);
! }
!
! JNDIContainer container = (JNDIContainer) table.get(name);
! if (container != null)
! {
! context.setAttribute(Constants.WEBAPP_TREE, container);
! }
! }
!
! return (mapping.findForward("view"));
! }
! }
!
--- 1,137 ----
! /*
! * EJTools, the Enterprise Java Tools
! *
! * Distributable under LGPL license.
! * See terms of license at www.gnu.org.
! */
! package org.ejtools.jndi.browser.web.action;
!
! import java.io.IOException;
! import java.util.Collection;
! import java.util.Hashtable;
! import java.util.Iterator;
! import java.util.Locale;
! import java.util.Vector;
!
! import javax.servlet.ServletContext;
! import javax.servlet.ServletException;
! import javax.servlet.http.HttpServletRequest;
! import javax.servlet.http.HttpServletResponse;
!
! import org.apache.log4j.Logger;
! import org.apache.struts.action.Action;
! import org.apache.struts.action.ActionError;
! import org.apache.struts.action.ActionErrors;
! import org.apache.struts.action.ActionForm;
! import org.apache.struts.action.ActionForward;
! import org.apache.struts.action.ActionMapping;
! import org.apache.struts.util.MessageResources;
! import org.ejtools.jndi.browser.web.Constants;
! import org.ejtools.jndi.browser.web.JNDIContainer;
! import org.ejtools.jndi.browser.web.form.ViewForm;
!
!
! /**
! * Description of the Class
! *
! * @author letiemble
! * @created 12 novembre 2001
! * @version $Revision$
! * @todo Javadoc to complete
! */
! public class ViewAction extends Action
! {
! /** Description of the Field */
! private static Logger logger = Logger.getLogger(ViewAction.class);
!
!
! /** Constructor for the ViewAction object */
! public ViewAction() { }
!
!
! /**
! * Description of the Method
! *
! * @param mapping Description of Parameter
! * @param form Description of Parameter
! * @param request Description of Parameter
! * @param response Description of Parameter
! * @return Description of the Returned Value
! * @exception IOException Description of Exception
! * @exception ServletException Description of Exception
! */
! public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
! throws IOException, ServletException
! {
! String name = null;
! String type = null;
!
! // Extract attributes we will need
! Locale locale = getLocale(request);
! MessageResources messages = getResources();
!
! // Validate the request parameters specified by the user
! ActionErrors errors = new ActionErrors();
!
! if (form instanceof ViewForm)
! {
! name = ((ViewForm) form).getName();
! type = ((ViewForm) form).getType();
! }
! else
! {
! errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("web.index.title"));
! }
!
! // Report any errors we have discovered back to the original form
! if (!errors.empty())
! {
! this.saveErrors(request, errors);
! return (new ActionForward(mapping.getInput()));
! }
!
! ServletContext context = this.getServlet().getServletContext();
!
! if ("ejbmodule".equals(type))
! {
! Hashtable moduleTrees = (Hashtable) context.getAttribute(Constants.EJBMODULE_TREES);
! logger.debug("Viewing JNDI for " + moduleTrees);
! if (moduleTrees == null)
! {
! moduleTrees = new Hashtable();
! }
!
! Collection containers = (Collection) moduleTrees.get(name);
! logger.debug("Viewing JNDI for " + containers);
! if (containers != null)
! {
! context.setAttribute(Constants.EJBMODULE_TREE, containers);
! }
! }
! if ("webapp".equals(type))
! {
! Vector applications = (Vector) context.getAttribute(Constants.WEBAPP_TREES);
! if (applications == null)
! {
! applications = new Vector();
! }
!
! // Create a search table
! Hashtable table = new Hashtable();
! for (Iterator it = applications.iterator(); it.hasNext(); )
! {
! JNDIContainer container = (JNDIContainer) it.next();
! table.put(container.getName(), container);
! }
!
! JNDIContainer container = (JNDIContainer) table.get(name);
! if (container != null)
! {
! context.setAttribute(Constants.WEBAPP_TREE, container);
! }
! }
!
! return (mapping.findForward("view"));
! }
! }
!
|