blob: fd387230cb685d7a31b311df921d26c6d94dc664 [file] [log] [blame]
<!--
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!-- jdbc/jdbcConnectionPoolEdit.jsf -->
<!initPage
setResourceBundle(key="i18n" bundle="org.glassfish.admingui.core.Strings")
setResourceBundle(key="i18njdbc" bundle="org.glassfish.jdbc.admingui.Strings")
setResourceBundle(key="help_jdbc" bundle="org.glassfish.jdbc.admingui.Helplinks");
/>
<!composition template="/templates/default.layout" guiTitle="$resource{i18njdbc.jdbcConnectionPool.editPageTitle}" guiOnLoad="initDisableFields('#{valueMap.resType}');" >
<!define name="content">
<event>
<!beforeCreate
setSessionAttribute(key="jdbcPoolTabs" value="general");
getRequestValue(key="name" value="#{pageSession.Name}");
urlencode(value="#{pageSession.Name}" encoding="UTF-8" result="#{pageSession.encodedName}");
getRequestValue(key="isAppScopedRes" value="#{pageSession.isAppScopedRes}");
if(#{pageSession.isAppScopedRes}){
getRequestValue(key="appName" value="#{pageSession.encodedAppName}");
getRequestValue(key="moduleName" value="#{pageSession.moduleName}");
if(#{pageSession.moduleName}) {
urlencode(value="#{pageSession.moduleName}" encoding="UTF-8" result="#{pageSession.encodedModuleName}");
setPageSessionAttribute(key="selfPageArgs" value="&isAppScopedRes=$boolean{true}&appName=#{pageSession.encodedAppName}&moduleName=#{pageSession.encodedModuleName}");
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/applications/application/#{pageSession.encodedAppName}/module/#{pageSession.encodedModuleName}/resources");
}
if(!#{pageSession.moduleName}) {
setPageSessionAttribute(key="selfPageArgs" value="&isAppScopedRes=$boolean{true}&appName=#{pageSession.encodedAppName}");
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/applications/application/#{pageSession.encodedAppName}/resources");
}
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/common/applications/resources/appScopedResources.jsf?appName=#{pageSession.encodedAppName}&listPageLink=/common/applications/applications.jsf");
}
if(!#{pageSession.isAppScopedRes}){
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/jdbc/jdbcConnectionPools.jsf");
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/resources");
}
setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/jdbc/jdbcConnectionPoolEdit.jsf?name=#{pageSession.encodedName}#{pageSession.selfPageArgs}");
setPageSessionAttribute(key="childType" value="jdbc-connection-pool");
gf.buildResourceUrl(base="#{pageSession.parentUrl}/#{pageSession.childType}", resourceName="#{pageSession.Name}", url="#{pageSession.resourceUrl}");
setPageSessionAttribute(key="rest-api" value="true");
setPageSessionAttribute(key="poolGeneralAttrs" value={"name" "resType" "datasourceClassname"
"driverClassname" "ping" "description" "deploymentOrder" "steadyPoolSize" "maxPoolSize" "poolResizeQuantity"
"idleTimeoutInSeconds" "maxWaitTimeInMillis" "nonTransactionalConnections"
"transactionIsolationLevel" "isIsolationLevelGuaranteed"});
gf.getEntityAttrs(endpoint="#{pageSession.resourceUrl}.json", valueMap="#{pageSession.valueMap}");
gf.filterMap(map="#{pageSession.valueMap}" attrNames="#{pageSession.poolGeneralAttrs}" resultMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="type" value="#{valueMap.resType}");
setPageSessionAttribute(key="convertToFalseList" value={"ping" "isConnectionValidationRequired" "failAllConnections" "allowNonComponentCallers" "nonTransactionalConnections" "isIsolationLevelGuaranteed"});
setPageSessionAttribute(key="skipAttrsList", value={"jndiName"});
//set the following for including buttons.inc
setPageSessionAttribute(key="edit" value="#{true}" );
setPageSessionAttribute(key="showDefaultButton" value="#{true}" );
setPageSessionAttribute(key="showCancelButton" value="#{true}" );
setPageSessionAttribute(key="hasPropertySheet" value="#{true}" );
setPageSessionAttribute(key="hasPropertyTable" value="#{false}" );
/>
</event>
<sun:form id="propertyForm">
#include "/jdbc/jdbcConnectionPoolTabs.inc"
#include "/common/shared/alertMsg_1.inc"
<!-- Page Title -->
<sun:title id="propertyContentPage" title="$resource{i18njdbc.jdbcConnectionPool.editPageTitle}"
helpText="$resource{i18njdbc.jdbcConnection.editPageHelp}">
<!-- Buttons -->
#include "/common/shared/editPageLoadDefaultButton.inc"
<sun:button id="flush" text="$resource{i18njdbc.button.Flush}" primary="#{false}" >
<!command
gf.createAttributeMap(keys={"id"} values={"$pageSession{Name}"} map="#{requestScope.attrMap}");
if(#{pageSession.isAppScopedRes}){
mapPut(map="#{requestScope.attrMap}" key="appname" value="#{pageSession.encodedAppName}");
if(#{pageSession.moduleName}){
mapPut(map="#{requestScope.attrMap}" key="modulename" value="#{pageSession.encodedModuleName}");
}
}
gf.restRequest(endpoint="#{sessionScope.REST_URL}/resources/flush-connection-pool.json"
attrs="#{requestScope.attrMap}"
method="POST"
result="#{requestScope.result}");
if ("#{requestScope.result.data['exit_code']} = SUCCESS") {
prepareAlertMsg(summary="$resource{i18n.msg.FlushSucceed}", type="success");
}
/>
</sun:button>
<sun:button id="ping" text="$resource{i18n.button.Ping}" primary="#{false}" >
<!command
gf.restRequest(endpoint="#{pageSession.resourceUrl}/property.json", method="GET", result="#{requestScope.propTable}");
setPageSessionAttribute(key="tableList", value="#{requestScope.propTable.data.extraProperties.properties}");
javaToJSON(obj="#{pageSession.tableList}" json="#{requestScope.tmpJSON}");
gf.restRequest(endpoint="#{pageSession.resourceUrl}/property.json", method="POST", data="#{requestScope.tmpJSON}", result="#{requestScope.restResponse}");
urlencode(value="#{valueMap['name']}" encoding="UTF-8" result="#{pageSession.encodeName}");
gf.createAttributeMap(keys={"id"} values={"$pageSession{encodeName}"} map="#{requestScope.attrMap}");
if(#{pageSession.isAppScopedRes}){
mapPut(map="#{requestScope.attrMap}" key="appname" value="#{pageSession.encodedAppName}");
if(#{pageSession.moduleName}){
mapPut(map="#{requestScope.attrMap}" key="modulename" value="#{pageSession.encodedModuleName}");
}
}
gf.restRequest(endpoint="#{sessionScope.REST_URL}/resources/ping-connection-pool.json"
attrs="#{requestScope.attrMap}"
method="GET"
result="#{requestScope.result}");
if ("#{requestScope.result.data['exit_code']} = SUCCESS") {
prepareAlertMsg(summary="$resource{i18n.msg.PingSucceed}", type="success");
}
/>
</sun:button>
#include "/jdbc/jdbcConnectionPoolEditButtons.inc"
</sun:title>
#include "/jdbc/poolPropertyEdit.inc"
<sun:title>
#include "/jdbc/jdbcConnectionPoolEditButtons.inc"
</sun:title>
<sun:hidden id="helpKey" value="$resource{help_jdbc.jdbcConnectionPoolEdit}" />
</sun:form>
#include "/common/shared/changeButtonsJS.inc"
<f:verbatim>
<script type="text/javascript">
function initDisableFields(type) {
disableEnableFields(type);
}
function disableFields() {
var type = getSelectElement("$pageSession{resTypeVal}");
disableEnableFields(type.value);
}
function disableEnableFields(type) {
if(type == 'java.sql.Driver') {
var val = document.getElementById("$pageSession{dsTextField}").value;
disableComponent("$pageSession{dsTextField}", 'text');
document.getElementById("$pageSession{dsTextField}").value = val;
enableComponent("$pageSession{ddsTextField}", 'text');
} else{
enableComponent("$pageSession{dsTextField}", 'text');
var val = document.getElementById("$pageSession{ddsTextField}").value;
disableComponent("$pageSession{ddsTextField}", 'text');
document.getElementById("$pageSession{ddsTextField}").value = val;
}
}
function isClassNamePresent(reqMsg) {
var resType = document.getElementById("$pageSession{resTypeVal}").value;
var className = '';
if (resType == 'java.sql.Driver') {
className = document.getElementById("$pageSession{ddsTextField}").value;
} else {
className = document.getElementById("$pageSession{dsTextField}").value;
}
if (className == null || className == ''){
showAlert(reqMsg);
return false;
}
return true;
}
</script>
</f:verbatim>
</define>
</composition>