1 23 24 29 30 package com.sun.enterprise.tools.admingui.handlers; 31 32 import java.util.HashMap ; 33 import com.iplanet.jato.RequestContext; 34 import com.iplanet.jato.view.View; 35 36 import com.sun.enterprise.tools.guiframework.view.HandlerContext; 37 import com.sun.enterprise.tools.guiframework.util.Util; 38 import com.sun.enterprise.deployment.util.XModuleType; 39 import javax.enterprise.deploy.shared.ModuleType ; 40 41 public class DisplayItemMapper { 42 43 44 final public static int MODULE_EAR = ModuleType.EAR.getValue(); 45 final public static int MODULE_EJB = ModuleType.EJB.getValue(); 46 final public static int MODULE_CAR = ModuleType.CAR.getValue(); 47 final public static int MODULE_RAR = ModuleType.RAR.getValue(); 48 final public static int MODULE_WAR = ModuleType.WAR.getValue(); 49 final public static int MODULE_LIFECYCLE = XModuleType.LCM.getValue(); 50 final public static int MODULE_MBEAN = XModuleType.CMB.getValue(); 51 52 public static HashMap displayItemMap, treeNodesMap; 53 54 55 public void getDisplayItem(RequestContext ctx, HandlerContext handlerCtx) { 56 if (displayItemMap == null) { 57 initDisplayItemMap(); 58 } 59 String displayItemName = 60 (String )displayItemMap.get((String )handlerCtx.getInputValue("key")); 61 if (displayItemName == null) 62 displayItemName = Util.getParentViewBean(handlerCtx.getView()).getName(); 63 handlerCtx.setOutputValue("displayItem", displayItemName); 64 } 65 66 public void getTreeNode(RequestContext ctx, HandlerContext handlerCtx) { 67 if (displayItemMap == null) { 68 initDisplayItemMap(); 69 } 70 String nodeName = 71 (String )treeNodesMap.get((String )handlerCtx.getInputValue("key")); 72 handlerCtx.setOutputValue("nodeName", nodeName); 73 } 74 75 private static void initDisplayItemMap() { 76 displayItemMap = new HashMap (); 77 displayItemMap.put("cluster", "cluster"); 78 displayItemMap.put("server", "serverInstance"); 79 displayItemMap.put("mail-resource", "javaMailSessionsEdit"); 80 displayItemMap.put("jdbc-resource", "jdbcResourcesEdit"); 81 displayItemMap.put("admin-object-resource", "adminObjectResourceEdit"); 82 displayItemMap.put("connector-resource", "connectorResourceEdit"); 83 displayItemMap.put("custom-resource", "customResourcesEdit"); 84 displayItemMap.put("external-jndi-resource", "externalResourcesEdit"); 85 displayItemMap.put("jdbc-connection-pool", "connectionPoolResourcesEdit"); 86 displayItemMap.put("connector-connection-pool", "connectorConnectionPoolEdit"); 87 88 displayItemMap.put("ear", "enterpriseApplicationsEdit"); 89 displayItemMap.put("war", "webApplicationsEdit"); 90 displayItemMap.put("ejb", "ejbModulesEdit"); 91 displayItemMap.put("rar", "connectorModulesEdit"); 92 displayItemMap.put("car", "appclientModulesEdit"); 93 displayItemMap.put("lifecycle", "lifecycleModulesEdit"); 94 displayItemMap.put("mbean", "customMBeansEdit"); 95 96 97 98 displayItemMap.put(""+MODULE_EAR, "enterpriseApplicationsEdit"); 99 displayItemMap.put(""+MODULE_WAR, "webApplicationsEdit"); 100 displayItemMap.put(""+MODULE_EJB, "ejbModulesEdit"); 101 displayItemMap.put(""+MODULE_RAR, "connectorModulesEdit"); 102 displayItemMap.put(""+MODULE_CAR, "appclientModulesEdit"); 103 displayItemMap.put(""+MODULE_LIFECYCLE, "lifecycleModulesEdit"); 104 displayItemMap.put(""+MODULE_MBEAN, "customMBeansEdit"); 105 106 107 treeNodesMap = new HashMap (); 108 treeNodesMap.put("cluster", "clusters"); 109 treeNodesMap.put("serverInstance", "standAloneInstances"); 110 treeNodesMap.put("jdbcResourcesEdit", "jdbcResources"); 111 treeNodesMap.put("javaMailSessionsEdit", "javaMailSessions"); 112 treeNodesMap.put("adminObjectResourceEdit", "adminObjectResources"); 113 treeNodesMap.put("connectorResourceEdit", "connectorResources"); 114 treeNodesMap.put("customResourcesEdit", "customResources"); 115 treeNodesMap.put("externalResourcesEdit", "externalResources"); 116 treeNodesMap.put("connectionPoolResourcesEdit", "connectionPoolResources"); 117 treeNodesMap.put("connectorConnectionPoolEdit", "connectorConnectionPools"); 118 119 treeNodesMap.put("enterpriseApplicationsEdit", "enterpriseApplications"); 120 treeNodesMap.put("webApplicationsEdit", "webApplications"); 121 treeNodesMap.put("ejbModulesEdit", "ejbModules"); 122 treeNodesMap.put("connectorModulesEdit", "connectorModules"); 123 treeNodesMap.put("appclientModulesEdit", "appclientModules"); 124 treeNodesMap.put("lifecycleModulesEdit", "lifecycleModules"); 125 treeNodesMap.put("customMBeansEdit", "customMBeans"); 126 } 127 128 } 129 | Popular Tags |