![JAR search and dependency download from the Maven repository](/logo.png)
org.glassfish.web.admingui.handlers.WebDDHandlers Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.web.admingui.handlers;
//import com.sun.appserv.management.config.ApplicationConfigConfig;
//import com.sun.appserv.management.config.DeployedItemRefConfig;
//import com.sun.appserv.management.ext.runtime.RuntimeMgr;
//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.io.StringReader;
//import java.net.URLDecoder;
//import java.net.URLEncoder;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import javax.xml.stream.XMLInputFactory;
//import javax.xml.stream.XMLStreamReader;
//import org.glassfish.admingui.common.util.GuiUtil;
//import org.glassfish.admingui.common.util.TargetUtil;
//import org.glassfish.admingui.common.util.DeployUtil;
//import org.glassfish.web.plugin.common.WebAppConfig;
//import org.jvnet.hk2.config.ConfigParser;
//import org.jvnet.hk2.config.DomDocument;
//import org.glassfish.web.plugin.common.ContextParam;
//import org.glassfish.web.plugin.common.EnvEntry;
//
//import com.sun.org.apache.xerces.internal.parsers.DOMParser;
//
//import javax.enterprise.deploy.spi.Target;
//import org.glassfish.admingui.common.util.AMXRoot;
//import org.glassfish.deployment.client.DFDeploymentStatus;
//import org.glassfish.deployment.client.DFProgressObject;
//import org.glassfish.deployment.client.DeploymentFacility;
//import org.w3c.dom.Node;
//import org.w3c.dom.Document;
//import org.w3c.dom.NodeList;
//import org.xml.sax.InputSource;
/**
*
* @author anilam
*/
public class WebDDHandlers {
//
// /**
// * This handler returns the and list for display
// */
// @Handler(id="getWebDDInfo",
// input={
// @HandlerInput(name="appName", type=String.class, required=true),
// @HandlerInput(name="serverName", type=String.class, defaultValue="server"),
// @HandlerInput(name="appType", type=String.class, required=true),
// @HandlerInput(name="webXML", type=String.class, required=true)},
// output={
// @HandlerOutput(name="envList", type=List.class),
// @HandlerOutput(name="ctxParamList", type=List.class)})
// public static void getWebDDInfo(HandlerContext handlerCtx) {
//
// String appName = (String) handlerCtx.getInputValue("appName");
// String appType = (String) handlerCtx.getInputValue("appType");
// String serverName = (String) handlerCtx.getInputValue("serverName");
//
// List envList = new ArrayList();
// List ctxParamList = new ArrayList();
//
// // Get the list from the DD
// RuntimeMgr runtimeMgr = AMXRoot.getInstance().getRuntimeMgr();
// String webXML = runtimeMgr.getDeploymentConfigurations(appName).get(WEB_DESCRIPTOR_PATH); //get the content of web.xml;
//
// if (GuiUtil.isEmpty(webXML)){
// handlerCtx.setOutputValue("envList", envList);
// handlerCtx.setOutputValue("ctxParamList", ctxParamList);
//
// System.out.printf("Could not locate %s%n", WEB_DESCRIPTOR_PATH);
// }
//
// NodeList envNodeList = null;
// NodeList ctxParamNodeList = null;
// try{
// DOMParser parser = new DOMParser();
// parser.parse(new InputSource( new StringReader(webXML)));
// Document document = parser.getDocument();
// envNodeList = document.getElementsByTagName(ENV_ENTRY);
// ctxParamNodeList = document.getElementsByTagName(CONTEXT_PARAM);
// }catch(Exception ex){
// ex.printStackTrace();
// handlerCtx.setOutputValue("envList", envList);
// handlerCtx.setOutputValue("ctxParamList", ctxParamList);
// return;
// }
//
// //If there is no and no in DD, there is nothing to customized, so return an empty table list.
// if ( (envNodeList == null || envNodeList.getLength() <=0) &&
// (ctxParamNodeList == null || ctxParamNodeList.getLength() <=0) ){
// handlerCtx.setOutputValue("envList", envList);
// handlerCtx.setOutputValue("ctxParamList", ctxParamList);
// return;
// }
//
// // Get the customized list in domain.xml
// DeployedItemRefConfig refConfig = TargetUtil.getDeployedItemRefObject(appName, serverName);
// ApplicationConfigConfig acc = refConfig.getApplicationConfigConfigMap().get(appType);
// List envListFromDomain = new ArrayList();
// List ctxParamListFromDomain = new ArrayList();
// if (acc != null){
// String rawData = acc.getConfig();
// WebAppConfig wac = getConfigData(rawData, true);
// if (wac != null){
// envListFromDomain = wac.getEnvEntry();
// ctxParamListFromDomain = wac.getContextParam();
// }
// }
//
// for(int i=0; i< envNodeList.getLength(); i++){
// HashMap oneRow = new HashMap();
// Node aNode = envNodeList.item(i);
// String envName = getChildNodeValue(ENV_ENTRY_NAME, aNode);
// oneRow.put("name",envName);
// oneRow.put("orig", getChildNodeValue(ENV_ENTRY_VALUE, aNode));
// oneRow.put("type", getChildNodeValue(ENV_ENTRY_TYPE, aNode));
// oneRow.put("desc", getChildNodeValue(DESC, aNode));
// oneRow.put("value", getEnvValueFromDomain(envName, envListFromDomain ));
// envList.add(oneRow);
// }
//
// for(int i=0; i< ctxParamNodeList.getLength(); i++){
// HashMap oneRow = new HashMap();
// Node aNode = ctxParamNodeList.item(i);
// String paramName = getChildNodeValue(PARAM_NAME, aNode);
// oneRow.put("paramName",paramName);
// oneRow.put("paramOrigValue", getChildNodeValue(PARAM_VALUE, aNode));
// oneRow.put("paramValue", getCtxParamValueFromDomain(paramName, ctxParamListFromDomain));
// ctxParamList.add(oneRow);
// }
// handlerCtx.setOutputValue("envList", envList);
// handlerCtx.setOutputValue("ctxParamList", ctxParamList);
// }
//
//
//
// @Handler(id="saveWebDDInfo",
// input={
// @HandlerInput(name="appName", type=String.class, required=true),
// @HandlerInput(name="serverName", type=String.class, defaultValue="server"),
// @HandlerInput(name="appType", type=String.class, required=true),
// @HandlerInput(name="reload", type=Boolean.class, required=true),
// @HandlerInput(name="envList", type=List.class, required=true),
// @HandlerInput(name="ctxParamList", type=List.class, required=true)})
// public static void saveWebDDInfo(HandlerContext handlerCtx) {
//
// String appName = (String) handlerCtx.getInputValue("appName");
// String appType = (String) handlerCtx.getInputValue("appType");
// String serverName = (String) handlerCtx.getInputValue("serverName");
// boolean reload = (Boolean) handlerCtx.getInputValue("reload");
// List