<%-- IBM Confidential OCO Source Material --%> <%-- 5724-J34 (C) COPYRIGHT International Business Machines Corp. 2004, 2010 --%> <%-- The source code for this program is not published or otherwise divested --%> <%-- of its trade secrets, irrespective of what has been deposited with the --%> <%-- U.S. Copyright Office. --%> <%@ page errorPage="error.jsp" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %> <%@ page import="java.util.*" %> <%@ page import="java.net.*" %> <%@ page import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action" %> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizer" %> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizerFactory"%> <%@ page import="com.ibm.websphere.management.metadata.*"%> <%@ page import="com.ibm.ws.*"%> <%@ page import="com.ibm.wsspi.*"%> <%@ page import="com.ibm.ws.console.core.Constants"%> <%@ page import="com.ibm.ws.console.core.form.ContextScopeForm"%> <%@ page import="com.ibm.ws.console.core.item.CollectionItem"%> <%@ page import="com.ibm.ws.console.core.selector.*"%> <%@ page import="com.ibm.ws.console.core.json.JSUtil"%> <%@ page import="com.ibm.ws.console.core.json.JSONObject"%> <%@ page import="com.ibm.ws.console.core.json.JSONArray"%> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper" %> <%@ page import="com.ibm.ws.console.dynamiccluster.form.DynamicClusterCollectionForm" %> <%@ page import="com.ibm.ws.xd.admin.utils.ConfigUtils"%> <%@ page import="com.ibm.ws.console.dynamiccluster.servlet.OpModeServlet"%> <% int wasVersion = ConfigUtils.getWASVersionInts()[0]; MessageResources statusMessages = (MessageResources)application.getAttribute(org.apache.struts.Globals.MESSAGES_KEY); String statusAlt = statusMessages.getMessage(request.getLocale(),"accessibility.needs"); String opmodeHeader = "null"; String opmodeManual = "null"; String opmodeSupervised = "null"; String opmodeAutomatic = "null"; String opmodeUnknown = "null"; String opmodeUnavailable = "null"; MessageResources opmodeMessages = (MessageResources)application.getAttribute(org.apache.struts.Globals.MESSAGES_KEY); try { opmodeManual = opmodeMessages.getMessage(request.getLocale(),"OperationalMode.MANUAL"); } catch (Exception e) { } try { opmodeSupervised = opmodeMessages.getMessage(request.getLocale(),"OperationalMode.SUPERVISED"); } catch (Exception e) { } try { opmodeAutomatic = opmodeMessages.getMessage(request.getLocale(),"OperationalMode.AUTOMATIC"); } catch (Exception e) { } try { opmodeUnavailable = opmodeMessages.getMessage(request.getLocale(),"OperationalMode.UNAVAILABLE"); } catch (Exception e) { } try { opmodeUnknown = opmodeMessages.getMessage(request.getLocale(),"OperationalMode.UNKNOWN"); } catch (Exception e) { } try { opmodeHeader = opmodeMessages.getMessage(request.getLocale(),"dynamiccluster.detail.opmode"); } catch (Exception e) { } %> <% int chkcounter = 0; try { %> <% String contextType=(String)request.getAttribute("contextType"); Properties props= null; ArrayList collectionList_ext = new java.util.ArrayList(); for(int i=0;i0) || (extensions_preferences!=null && extensions_preferences.length>0)){ if(contextId!=null && contextId!="nocontext"){ props = ConfigFileHelper.getNodeMetadataProperties((String)contextId); //213515 } } if(extensions!=null && extensions.length>0){ collectionList_ext = CollectionItemSelector.getCollectionItems(extensions,collectionList_ext,props); } pageContext.setAttribute("collectionList_ext",collectionList_ext); if(extensions_preferences!=null && extensions_preferences.length>0){ collectionPreferenceList_ext = PreferenceSelector.getPreferences(extensions_preferences,collectionPreferenceList_ext,props); } %> <%-- Generate a map of roles--%> <% Map contextToRolesMap = new HashMap(); if (wasVersion >= 7) { %> <%String contextId_detail = null;%> <%contextId_detail = contextId_new;%> <% contextId_detail = ConfigFileHelper.encodeContextUri(contextId_detail); if(contextId_detail==null) contextId_detail=contextId; if (wasVersion >= 7) contextId_detail = contextId_detail.replaceFirst("dynamicclusters", "clusters"); contextToRolesMap.put(contextId_detail, ConfigFileHelper.getRoles(contextId_detail)); %> <%-- We need to get ALL items in the collection so that we can display the correct values in the PreferenceFilter --%> <%-- It would be nice if there was a more efficient way to do that without looking through every item. (417407) --%> <%String contextId_detail = null;%> <%contextId_detail = contextId_new;%> <% contextId_detail = ConfigFileHelper.encodeContextUri(contextId_detail); if(contextId_detail==null) contextId_detail=contextId; contextId_detail = contextId_detail.replaceFirst("dynamicclusters", "clusters"); contextToRolesMap.put(contextId_detail, ConfigFileHelper.getRoles(contextId_detail)); %> <% //The goal is to populate contextToRolesMap with // 1. The valid roles of all items in collection table // 2. The valid roles for current scope (if selected), or else for all possible scopes if "All Scopes" is selected if (contextId != null) { if (contextId.equals("none") || contextId.equals(Constants.ALLSCOPES)) { //try to get a list of scopes from a scope form ContextScopeForm scopeForm = (ContextScopeForm) session.getAttribute("contextScopeForm"); List allScopes = scopeForm.getAllscopes(); for (Iterator i = allScopes.iterator(); i.hasNext(); ) { String scopeContextId = (String) i.next(); contextToRolesMap.put(scopeContextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeContextId))); } } else if (contextId.equals("CONTEXT_NOT_SET")) { //This happens when using AbstractController ContextScopeForm scopeForm = (ContextScopeForm) session.getAttribute("contextScopeForm"); if (scopeForm.getCurrentScope().equals("All Scopes")) { List allScopes = scopeForm.getAllscopes(); for (Iterator i = allScopes.iterator(); i.hasNext(); ) { String scopeContextId = (String) i.next(); contextToRolesMap.put(scopeContextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeContextId))); } } else { contextToRolesMap.put(scopeForm.getCurrentScope(), ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeForm.getCurrentScope()))); } } else { //context is set to a single scope--use that contextToRolesMap.put(contextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(contextId))); } } } %> <%-- NOTES: The sorting icons are specified in defaultIconList. The icons are assumed to be located in the images folder. Checkboxes are NOT displayed for all objects whose refIds start with "builtin_" --%> <%@ include file="/secure/layouts/filterSetup.jspf" %> <% session.removeAttribute("preferences"); %> <% for (Iterator i = collectionPreferenceList_ext.iterator(); i.hasNext();) { preferences.add(i.next()); } %> <% if (request.getAttribute("role.filtering.disabled") == null) { %> <% } %> <%@ include file="/secure/layouts/tableControlsLayout.jspf" %>
<% if (showCheckBoxes.equals ("true")) { %> <% } %> <% sortable = (String)cellItem.getIsSortable(); columnField = (String)cellItem.getColumnField(); String tmpName = cellItem.getTooltip(); String columnName = translatedText.getMessage(request.getLocale(),tmpName); if (chkcounter == 0) { if (searchFilter.equals("")) { searchFilter = columnField; } } %> <% chkcounter = chkcounter + 1; %> <%@ include file="/secure/layouts/filterControlsLayout.jspf" %> <% chkcounter = 0; %> <% String prevRole = null; Object scriptVars = null; boolean roleFilteringEnabled = true; if (wasVersion >= 7) { scriptVars = new JSONObject(); if (request.getAttribute("role.filtering.disabled") != null) roleFilteringEnabled = false; } %> <% String primaryRole = null; if (wasVersion >= 7) { String contextId_detail = contextId.replaceFirst("dynamicclusters", "clusters"); primaryRole = ConfigFileHelper.getAssumedRole((Set)contextToRolesMap.get(contextId_detail)); if (roleFilteringEnabled) { if (prevRole == null || !primaryRole.equals(prevRole)) { prevRole = primaryRole; String roleMessageKey = "resource.access." + primaryRole; %> <% } } } %> <% if (showCheckBoxes.equals("true")) { if (!((wasVersion >= 7) && ("monitor".equals(primaryRole))) && ( ConfigFileHelper.isDeleteable(refId) == true)) { String delId = (String)resourceUri + "#" + (String) refId ; String selectedObjectIds = "selectedObjectIds" + chkcounter; %> <% } else { %> <% } } %> <% columnField = (String)cellItem.getColumnField(); %> <% chkcounter = chkcounter + 1; %> <% if (wasVersion >= 7) { JSUtil.getScriptingContext(request).storeObject("collectionFilter", (JSONObject)scriptVars); //These are used for dynamically adding tooltips to disabled buttons JSONObject roleNLS = new JSONObject(); roleNLS.put("administrator", statusMessages.getMessage(request.getLocale(), "role.administrator")); roleNLS.put("operator", statusMessages.getMessage(request.getLocale(), "role.operator")); roleNLS.put("configurator", statusMessages.getMessage(request.getLocale(), "role.configurator")); roleNLS.put("monitor", statusMessages.getMessage(request.getLocale(), "role.monitor")); roleNLS.put("deployer", statusMessages.getMessage(request.getLocale(), "role.deployer")); roleNLS.put("button.disabled.desc", statusMessages.getMessage(request.getLocale(), "button.disabled.desc")); JSUtil.getScriptingContext(request).storeObject("roleNLS", roleNLS); } %>
<% if (sortIconLocation.equalsIgnoreCase ("right")) { %> <% } if (sortable.equals ("false")) { %> <% } if ((sortable.equals ("true")) && (!columnField.equals("status"))) { if (columnField.equals (sortedColumn)) { String nextOrder; if (order.equalsIgnoreCase ("ASC")) { nextOrder = "DSC"; } else { nextOrder = "ASC"; } %> <% if (order.equalsIgnoreCase ("ASC")) { %> <bean:message key="> <% } else if (order.equalsIgnoreCase ("DSC")) { %> <bean:message key="> <% } } else { %> <bean:message key="> <% } if (sortIconLocation.equalsIgnoreCase ("left")) { %> <% } if (sortable.equals ("false")) { %> <% } } %> <% //add refresh.gif after status column to refresh page if (columnField.equals("status")) { %> <bean:message key=" align="texttop" border="0"/> <% } %> <%//add refresh.gif after op mode column to refresh page if (columnField.equals("opMode")) {%> <bean:message key=" align="texttop" border="0" /> <%}%> <% if (!filterDisplay.equals("none")) { if (columnField.equals(searchFilter)) { %>
: <% } } %>
<% if ( !idColumn.equals("") ) { %>   <% if (cellItem.getIcon()!=null && cellItem.getIcon().length() > 0) { %>   <% } if (cellItem.getLink().length() > 0) { String hRef = cellItem.getLink() + "&refId="+refId + "&contextId=" + contextId + "&resourceUri=" + URLEncoder.encode(resourceUri) + "&perspective=" + URLEncoder.encode(perspective); %> <% } if (columnField.equalsIgnoreCase("status")) { String statusservlet = "/ibm/console/status"; if(cellItem.getStatusServlet()!=null) statusservlet = cellItem.getStatusServlet(); %> <%if (iterationName.equals("DynamicClusterCollectionForm")) { String encodedStatusLink = statusservlet + "?text=true&type=cluster&name=" + URLEncoder.encode((String)name, "UTF-8"); String imageSrcLink = statusservlet + "?type=cluster&name=" + URLEncoder.encode((String)name, "UTF-8"); %> <%=statusAlt%> <%} else { %> <% String encodedStatusLink = statusservlet + "?text=true&type=ClusterMember&memberName=" + URLEncoder.encode((String)name, "UTF-8") + "&node=" + node; String imageSrcLink = statusservlet + "?type=ClusterMember&memberName=" + URLEncoder.encode((String)name, "UTF-8") + "&node=" + node; %> <%=statusAlt%> <%}%> <% } else if (columnField.equalsIgnoreCase("opMode")) {%> <% String opModeMsgKey = OpModeServlet.getOperationalModeStatic(request.getSession(), (String)dc); %> <% } else if (cellItem.getTranslate()) { %> <% } else { %>   <% } %> <% if (cellItem.getLink().length() > 0) { %> <% } %>
<% } catch (Exception e) {e.printStackTrace(); } %> <% ServletContext servletContext = (ServletContext)pageContext.getServletContext(); MessageResources messages = (MessageResources)servletContext.getAttribute(Action.MESSAGES_KEY); String nonefound = messages.getMessage(request.getLocale(),"Persistence.none"); if (chkcounter == 0) { out.println("
"+nonefound+"
"); } %>