<%-- IBM Confidential OCO Source Material --%> <%-- 5724-J34 (C) COPYRIGHT International Business Machines Corp. 2006, 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 language="java" import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action" %> <%@ page errorPage="error.jsp" %> <%@ page import="com.ibm.ws.*" %> <%@ page import="com.ibm.wsspi.*" %> <%@ page import="com.ibm.ws.console.core.item.CollectionItem" %> <%@ page import="com.ibm.ws.console.core.selector.*" %> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper" %> <%@ page import="com.ibm.ws.security.core.SecurityContext" %> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizer"%> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizerFactory"%> <%@ page import="com.ibm.websphere.management.metadata.ManagedObjectMetadataAccessor" %> <%@ page import="com.ibm.websphere.management.metadata.ManagedObjectMetadataAccessorFactory" %> <%@ page import="com.ibm.ws.console.middlewareapps.form.MiddlewareAppsDetailForm" %> <%@ page import="com.ibm.ws.xd.middlewareapp.status.OverallAppStatus" %> <%@ page import="com.ibm.ws.console.middlewareapps.servlet.MiddlewareAppsDeploymentStatusServlet" %> <%@page import="com.ibm.ws.xd.admin.utils.ConfigUtils"%> <%@ 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.*" %> <% int chkcounter = 0; try { %> <%-- MiddlewareAppsDetailForm adf = new MiddlewareAppsDetailForm(); adf.setDeploymentStatusMsg(""); request.setAttribute("theForm", adf); --%> <% // BEGIN Javascript Translated Text Variables String pleaseWait = "null"; String statusDeploymentErr = "null"; String statusPartialDeploymentErr = "null"; String statusUnknownDeployment = "null"; String statusPartialDeployed = "null"; MessageResources statusMessages = (MessageResources)application.getAttribute(Action.MESSAGES_KEY); try { pleaseWait = statusMessages.getMessage(request.getLocale(),"trace.tree.pleaseWaitLabel"); } catch (Exception e) { } try { statusDeploymentErr = statusMessages.getMessage(request.getLocale(), "middlewareapps.deployment.overall.error"); } catch (Exception e) { } try { statusPartialDeploymentErr = statusMessages.getMessage(request.getLocale(), "middlewareapps.deployment.overall.partialerror"); } catch (Exception e) { } try { statusUnknownDeployment = statusMessages.getMessage(request.getLocale(), "middlewareapps.deployment.unknowndeployment"); } catch (Exception e) { } try { statusPartialDeployed = statusMessages.getMessage(request.getLocale(), "middlewareapps.deployment.overall.partiallydeployed"); } catch (Exception e) { } %> <% int wasVersion = ConfigUtils.getWASVersionInts()[0]; if(treatAdminSecurityManagerRoleAsMonitor==null) { treatAdminSecurityManagerRoleAsMonitor="true"; } AdminAuthorizer adminAuthorizer = AdminAuthorizerFactory.getAdminAuthorizer(); String contextUri = ConfigFileHelper.decodeContextUri(contextId); String contextType = (String) request.getAttribute("contextType"); Properties props = null; ArrayList collectionList_ext = new ArrayList(); for (int i = 0; i < collectionList.size(); i++) { collectionList_ext.add(collectionList.get(i)); } ArrayList collectionPreferenceList_ext = new ArrayList(); for (int i = 0; i < collectionPreferenceList.size(); i++) { collectionPreferenceList_ext.add(collectionPreferenceList.get(i)); } IPluginRegistry registry = IPluginRegistryFactory.getPluginRegistry(); String extensionId = "com.ibm.websphere.wsc.collectionItem"; IConfigurationElementSelector ic = new ConfigurationElementSelector(contextType, extensionId); IExtension[] extensions = registry.getExtensions(extensionId, ic); String extensionId_preferences = "com.ibm.websphere.wsc.preferences"; IConfigurationElementSelector ic_preferences = new ConfigurationElementSelector(contextType, extensionId_preferences); IExtension[] extensions_preferences = registry.getExtensions(extensionId_preferences, ic); if ((extensions != null && extensions.length > 0) || (extensions_preferences != null && extensions_preferences.length > 0)) { if(contextId != null && contextId != "nocontext") { props = ConfigFileHelper.getNodeMetadataProperties((String) contextId); } props = ConfigFileHelper.getAdditionalAdaptiveProperties(request, props, formName); } 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(); boolean showButtons = true; if (wasVersion >= 7) { showButtons = false; %> <%String contextId_detail = null;%> <%contextId_detail = contextId_new;%> <% contextId_detail = ConfigFileHelper.encodeContextUri(contextId_detail); if(contextId_detail==null) contextId_detail=contextId; Set roles = ConfigFileHelper.getRoles(contextId_detail); // Show buttons if user can perform the button actions on any of the apps. if ((roles.contains(AdminAuthorizer.ADMIN_ROLE)) || (roles.contains(AdminAuthorizer.CONFIG_ROLE)) || (roles.contains(AdminAuthorizer.OPERATOR_ROLE)) || (roles.contains(AdminAuthorizer.DEPLOYER_ROLE))) { showButtons = true; } contextToRolesMap.put(contextId_detail, roles); %> <% } %> <%-- 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" %> <%-- Preferences at the top --%> <% session.removeAttribute("preferences"); %> <% for (Iterator i = collectionPreferenceList_ext.iterator(); i.hasNext();) { preferences.add(i.next()); } %> <% if (wasVersion == 6) { if (SecurityContext.isSecurityEnabled() && !(adminAuthorizer.checkAccess(contextUri, "administrator") || adminAuthorizer.checkAccess(contextUri, "configurator") || adminAuthorizer.checkAccess(contextUri, "deployer"))) { showButtons = false; } } if (showButtons) { %> <% } %> <%@ 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; %> <% String primaryRole = null; if (wasVersion >= 7) { primaryRole = ConfigFileHelper.getAssumedRole((Set)contextToRolesMap.get(contextId)); //515386: Treat Admin security manager role as monitor if(primaryRole.equals(AdminAuthorizer.ADMINSECURITY_ROLE) && treatAdminSecurityManagerRoleAsMonitor.equals("true")) { primaryRole=AdminAuthorizer.MONITOR_ROLE; } if (prevRole == null || !primaryRole.equals(prevRole)) { prevRole = primaryRole; String roleMessageKey = "resource.access." + primaryRole; %> <% } } %> <% session.setAttribute("typeKey", typeKey); if (showCheckBoxes.equals("true")) { if ((wasVersion >= 7) && ("monitor".equals(primaryRole))) { //empty table cell where the check box normally would be %> <% } else { if (ConfigFileHelper.isDeleteable(refId) == true) { String delId = (String) resourceUri + "#" + (String) refId ; %> <% } else { %> <% } } } else { %> <%-- zoght 4361 21, display empty cell if monitor role --%> <% } %> <% columnField = (String) cellItem.getColumnField(); %> <% chkcounter = chkcounter + 1; %>
<% if (sortIconLocation.equalsIgnoreCase("right")) { %> <%=columnName%> <% } if (sortable.equals("false")) { %> <% } // if ((sortable.equals("true")) && (!columnField.equals("status"))) { if (sortable.equals("true")) { 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 state column to refresh page if (columnField.equals("currentState")) { %> <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) { if (columnField.equalsIgnoreCase("name")) { String hRef = cellItem.getLink() + "&refId=" + refId + "&contextId=" + URLEncoder.encode(contextId) + "&resourceUri=" + URLEncoder.encode(resourceUri) + "&perspective=" + URLEncoder.encode(perspective); %> <% } // end if } // end if link if (columnField.equalsIgnoreCase("status")) { if (statusType.equals("unknown")) { String statusServlet = "/ibm/console/AppManagementStatus"; String middlewareappsStatusServlet = "/ibm/console/MiddlewareAppsStatus"; String middlewareappsDeploymentStatusServlet = "/ibm/console/MiddlewareAppsDeploymentStatus"; %> <%-- --%> <% if (typeKey.equals("middlewareapps.type.j2ee")) { String mangledName = name + "-edition" + editionAlias; if (edition.equals("")) { mangledName = name; } %> <bean:message key=" TITLE=""> <% } else { String encoding = response.getCharacterEncoding(); String encodedStatusLink = middlewareappsStatusServlet + "?text=true&name=" + URLEncoder.encode((String) name, encoding) + "&edition=" + URLEncoder.encode((String) editionAlias, encoding) + "&typeKey=" + URLEncoder.encode((String) typeKey, encoding); String imageSrcLink = middlewareappsStatusServlet + "?name=" + URLEncoder.encode((String) name, encoding) + "&edition=" + URLEncoder.encode((String) editionAlias, encoding) + "&typeKey=" + URLEncoder.encode((String) typeKey, encoding); %> <bean:message key=" TITLE=""> <% if (typeKey.equals("middlewareapps.type.wasce")) { String encodedDeploymentStatusLink = middlewareappsDeploymentStatusServlet + "?text=true&name=" + URLEncoder.encode((String) name, encoding) + "&edition=" + URLEncoder.encode((String) editionAlias, encoding) + "&typeKey=" + URLEncoder.encode((String) typeKey, encoding); String deploymentStatusImageSrcLink = middlewareappsDeploymentStatusServlet + "?name=" + URLEncoder.encode((String) name, encoding) + "&edition=" + URLEncoder.encode((String) editionAlias, encoding) + "&typeKey=" + URLEncoder.encode((String) typeKey, encoding); request.setAttribute("name", name); request.setAttribute("edition",editionAlias); OverallAppStatus overallAppStatus = new OverallAppStatus(request); String deploystatus = overallAppStatus.deploymentStatus(); if(deploystatus.equals("ExecutionState.SUCCESS") || deploystatus.equals("")){ ; } else { String statusImgLink = "/ibm/console/com.ibm.ws.console.middlewareapps" + MiddlewareAppsDeploymentStatusServlet.getForwardName(deploystatus); String statusText = MiddlewareAppsDeploymentStatusServlet.getStatusTextKey(deploystatus); MessageResources messages = (MessageResources) getServletContext().getAttribute(org.apache.struts.Globals.MESSAGES_KEY); statusText = messages.getMessage(request.getLocale(), statusText); %> <%-- <bean:message key=" TITLE=""> --%> <bean:message key=" TITLE=""> <%=statusText%> <% } } %> <% } %> <%-- --%> <%-- <bean:message key=" TITLE=""> --%> <% } else { %> <% String queryString = ""; Iterator cols = statusCols.iterator(); while (cols.hasNext()) { String col = (String) cols.next(); %> <% queryString += "&" + col + "=" + URLEncoder.encode((String) colvar , "UTF-8"); } String encodedStatusLink = "/ibm/console/status?text=true&type=" + statusType + queryString; String imageSrcLink = "/ibm/console/status?type=" + statusType + queryString; %> <bean:message key=" TITLE=""> <% } } else if (columnField.equalsIgnoreCase("action")) { if ((wasVersion < 7) || ((showCheckBoxes.equals("true")) && (!("monitor".equals(primaryRole))))) { %> <% } } else if (columnField.equalsIgnoreCase("type")) { %> <%-- --%> <%=type%> <% } else if (columnField.equalsIgnoreCase("editionState")) { %> <%=editionState%> <% } else if (cellItem.getTranslate()) { %> <% } else { if (htmlFilter.equalsIgnoreCase("false")) { %> <% } else { %> <% } } if (cellItem.getLink().length() > 0) { %> <% } else { if (!columnField.equalsIgnoreCase("status")) { %>   <% } } %>
<% } 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(""); out.println("
" + nonefound + "
"); } %>