alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Glassfish example source code file (JDKSelection.xml)

This example Glassfish source code file (JDKSelection.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Glassfish tags/keywords

busrequest, busrequest, busresponse, componentdetails, gpl, gpl, hidden_jdk, jdk_list, jdk_type_in, license, license, string, version, version

The Glassfish JDKSelection.xml source code

<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 2006, 2007-2010 Oracle and/or its affiliates. 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_1_1.html
    or packager/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 packager/legal/LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [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.

-->

<apt:template apt:name="JDKSelection" xmlns:apt="http://www.sun.com/jds/apoc/2004/template"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:oor="http://openoffice.org/2001/registry"
  xsi:schemaLocation="http://www.sun.com/jds/apoc/2004/template ../../../consumables/schemas/config/apoc/policytemplate.xsd">
 <apt:category apt:name="JDKSelection" apt:label="JDKSelection" >

 <apt:page apt:name="Install_page" apt:label="InstallHome" >

  <apt:section apt:name="directory" apt:label="DirectorySelection" >
      <apt:property apt:name="JDK_HOME_TEXT"
         apt:dataPath=""
         apt:type="xs:string">
         <apt:prop-value>$JDK_HOME_TEXT
         <apt:visual>
            <apt:htmlPanel/>
         </apt:visual>
        </apt:property>

    <apt:property apt:name="JDK_FROM_LIST_CHOICE" apt:label=""
         apt:dataPath="directory.JDK_FROM_LIST_CHOICE"
         apt:type="xs:boolean">
         <apt:prop-value>true
         <apt:visual>
            <apt:checkBox apt:labelPost="$JDK_FROM_LIST_CHOICE_TEXT"/>
         </apt:visual>
         <apt:scriptHandler apt:scriptLanguage="beanshell" >
           <apt:scriptCode>
         </apt:scriptHandler>
    </apt:property>

    <apt:property apt:name="JDK_LIST" apt:label=""
         apt:dataPath="directory.JDK_LIST"
         apt:type="xs:string">
         <apt:prop-value>
         <apt:visual>
            <apt:comboBox apt:toolTip="$JDK_LIST_TOOLTIP"/>
         </apt:visual>
    </apt:property>
    <apt:property apt:name="JDK_TYPED_IN_CHOICE" apt:label=""
         apt:dataPath="directory.JDK_TYPED_IN_CHOICE"
         apt:type="xs:boolean">
       <apt:prop-value>false
       <apt:visual>
          <apt:checkBox apt:labelPost="$JDK_TYPED_IN_CHOICE_TEXT"/>
       </apt:visual>
       <apt:scriptHandler apt:scriptLanguage="beanshell" >
          <apt:scriptCode>
         </apt:scriptHandler>
        </apt:property>
        <apt:property apt:name="JDK_TYPE_IN" apt:label=""
         apt:dataPath="directory.JDK_TYPE_IN"
         apt:type="xs:string">
         <apt:prop-value>
         <apt:visual>
           <apt:directorySelector apt:toolTip="$JDK_TYPE_IN_TOOLTIP"/>
         </apt:visual>
        </apt:property>
        <apt:property apt:name="HIDDEN_JDK" apt:label=""
         apt:dataPath="directory.HIDDEN_JDK"
         apt:type="xs:string">
         <apt:prop-value>
         <apt:visual>
           <apt:textField apt:columns="55"/>
         </apt:visual>
        </apt:property>
  </apt:section>
  <apt:scriptHandler apt:scriptLanguage="beanshell" >
  <apt:scriptCode>
"); theVersionContent.append(theInfo); theVersionContent.append("</center>"); theVersionHolder.setText(theVersionContent.toString()); } else { option2.setSelected(true); option2.requestFocus(); } frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); theJava = new JavaDetection(ConfigHelper.getStringValue("JDKSelection.directory.JDK_VERSIONRANGE")); theJDKComps = (List) theJava.getInstalledJDKDetails(); frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); /* * See if we need to exclude any JDKs in 'theJDKComps': * - get value of 'Exclude-JVMs' property * - remove entries in 'theJDKComps' if needed */ /* * Get value of 'Exclude-JVMs' property if it was set * Example value of this property: * /foo/bar:/thispath/thatpath (Unix) * C:\foo\bar;D:\thispath\thatpath */ BusRequest opsReq = new BusRequest("ConfigRequest", new EngineConfigCommand(EngineConfigCommand.COMMAND.GET_CONFIG, EngineConfigItem.EXCLUDE_JVMS)); BusResponse opsResp = bus.publishRequest(opsReq, "svc://general/EngineConfig"); String excludeJVMs = (String)opsResp.getResult(); List pathAList = null; /* * Store list of paths in ArrayList */ if (excludeJVMs != null) { StringTokenizer st = new StringTokenizer(excludeJVMs, File.pathSeparator); pathAList = new ArrayList(); excludeList = new ArrayList(); while (st.hasMoreTokens()) { String theNextToken = st.nextToken(); pathAList.add(theNextToken); } /* * Remove entries in theJDKComps as needed * - build an exclude list i.e. a list of JDKs to remove from theJDKComps * - use the exclude list to perform the actual removal * * The above need to be separate because removing an item from a list while * iterating through the list will give you a ConcurrentModificationException */ if (pathAList.size() > 0) { for (ComponentDetails theJDK : theJDKComps) { /* * Check if theJDK is in the exclude list */ for (String oneExclude : pathAList) { if (theJDK.getLabel().startsWith(oneExclude)) { /* * Add it to the exclude list */ excludeList.add(theJDK); break; } } } /* * If the exclude list was non empty, iterate through it, removing * entries from theJDKComps. */ if (excludeList.size() > 0) { for (ComponentDetails oneComp : excludeList) { theJDKComps.remove(oneComp); } } } } if (theJDKComps == null || theJDKComps.size() == 0) { option2.setEnabled(false); option2.setSelected(false); if (!isProductIncluded(theProdName)) { option3.setSelected(true); theJDKTypeIn.setEnabled(true); theMsg = StringUtils.wrap(Msg.get("NO_JDKS_DETECTED_OR_BUNDLED", null), 70); } else { option3.setSelected(true); option3.requestFocus(); theMsg = StringUtils.wrap(Msg.get("NO_JDKS_DETECTED", null), 70); } JOptionPane.showMessageDialog(frame, theMsg, Msg.get("INFO", null), JOptionPane.INFORMATION_MESSAGE); } else { for (ComponentDetails theJDK : theJDKComps) { theCombo.addItem(theJDK.getLabel()); } theCombo.setSelectedIndex(0); setValueForCombo(0); theListAL = new ActionListener() { actionPerformed(e) { theIndex = theCombo.getSelectedIndex(); setValueForCombo(theIndex); } }; theCombo.addActionListener(theListAL); } theTextListener = new ActionListener() { actionPerformed(e) { theHiddenJDK.setText(theJDKTypeIn.getText()); } }; theJDKTypeIn.getTextField().addActionListener(theTextListener); wizard.enableCancel(true); wizard.enableHelp(true); wizard.enableBack(true); wizard.enableNext(true); } return (Runnable)this; ]]></apt:scriptCode> </apt:scriptHandler> </apt:page> </apt:category> </apt:template>

Other Glassfish examples (source code examples)

Here is a short list of links related to this Glassfish JDKSelection.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.