Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2009, 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
*/
/*
* JdbcHandler.java
*
* Created on August 10, 2006, 2:32 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author anilam
*/
package org.glassfish.admingui.common.handlers;
import com.sun.jsftemplating.annotation.Handler;
import com.sun.jsftemplating.annotation.HandlerInput;
import com.sun.jsftemplating.annotation.HandlerOutput;
import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.admingui.common.util.GuiUtil;
import org.glassfish.admingui.common.util.RestUtil;
public class JdbcTempHandler {
/** Creates a new instance of JdbcHandler */
public JdbcTempHandler() {
}
/**
*
This handler gets the default values and resource type and puts them in session
*/
@Handler(id = "setJDBCPoolWizard",
input = {
@HandlerInput(name = "fromStep2", type = Boolean.class),
@HandlerInput(name = "attrMap", type = Map.class)},
output = {
@HandlerOutput(name = "ResTypeList", type = java.util.List.class),
@HandlerOutput(name = "DBVendorList", type = java.util.List.class)
})
public static void setJDBCPoolWizard(HandlerContext handlerCtx) {
//We need to use 2 maps for JDBC Connection Pool creation because there are extra info we need to keep track in
//the wizard, but cannot be passed to the creation API.
Boolean fromStep2 = (Boolean) handlerCtx.getInputValue("fromStep2");
if ((fromStep2 != null) && fromStep2) {
//wizardPool is already in session map
} else {
Map attrMap = (Map) handlerCtx.getInputValue("attrMap");
Map sessionMap = handlerCtx.getFacesContext().getExternalContext().getSessionMap();
sessionMap.put("wizardMap", attrMap);
sessionMap.put("wizardPoolExtra", new HashMap());
//sessionMap.put("wizardPoolProperties", new HashMap());
}
handlerCtx.setOutputValue("ResTypeList", resTypeList);
handlerCtx.setOutputValue("DBVendorList", dbVendorList);
}
/**
*
This handler gets the datasource classname and properties and sets them in session
*/
@Handler(id = "gf.updateJDBCPoolWizardStep1")
public static void updateJDBCPoolWizardStep1(HandlerContext handlerCtx) {
//Map pool = (Map) handlerCtx.getFacesContext().getExternalContext().getSessionMap().get("wizardPool");
Map extra = (Map) handlerCtx.getFacesContext().getExternalContext().getSessionMap().get("wizardPoolExtra");
String resType = (String) extra.get("resType");
String dbVendorBox = (String) extra.get("DBVendorBox");
String dbVendorField = (String) extra.get("DBVendorField");
String introspect = (String) extra.get("introspect");
if (introspect == null || introspect.isEmpty()) {
introspect = Boolean.toString(false);
}
String dbVendor = (GuiUtil.isEmpty(dbVendorField)) ? dbVendorBox : dbVendorField;
extra.put("DBVendor", dbVendor);
String previousResType = (String) extra.get("PreviousResType");
String previousDB = (String) extra.get("PreviousDB");
String previousInstrospect = (String) extra.get("PreviousIntrospect");
if (resType.equals(previousResType) && dbVendor.equals(previousDB) && introspect.equals(previousInstrospect)) {
//&& !GuiUtil.isEmpty((String) extra.get("DatasourceClassname"))) {
//User didn't change type and DB, keep the datasource classname as the same.
} else {
if (!GuiUtil.isEmpty(resType) && !GuiUtil.isEmpty(dbVendor)) {
try {
List dsl = getJdbcDriverClassNames(dbVendor, resType, Boolean.valueOf(introspect));
if (guiLogger.isLoggable(Level.FINE)) {
guiLogger.fine("======= getJdbcDriverClassNames(" + dbVendor + ", " + resType + ")");
guiLogger.fine("======= # of items for JDBC_DRIVER_CLASS_NAMES_KEY " + dsl.size());
for (int i = 0; i < dsl.size(); i++) {
guiLogger.fine("classname[" + i + "] : " + dsl.get(i));
}
}
List