|
Glassfish example source code file (JDKServiceTag.java)
The Glassfish JDKServiceTag.java source code
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 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.
*/
package com.sun.enterprise.registration.impl;
import java.io.File;
import java.io.InputStream;
import java.util.Properties;
import java.io.IOException;
/**
* JDKServiceTag class is defined for Glassfish to register JDK 6u4
* which does not have the product registration support.
*
* Glassfish 9.1 U1 will include the product registration support
* but the JDK product registration support is not released in time
* so that the JDK 6u4 bundled in Glassfish 9.1 U1 doesn't have
* the interface for Glassfish to use.
*
* This class is created to be included in the Glassfish source
* as an interim solution until the JDK supports the product registration
* and Glassfish will make the change to use the exported JDK interface.
*/
public class JDKServiceTag {
// Service Tag Node names
private final static String ST_NODE_SERVICE_TAG = "service_tag";
private final static String ST_NODE_INSTANCE_URN = "instance_urn";
private final static String ST_NODE_PRODUCT_NAME = "product_name";
private final static String ST_NODE_PRODUCT_VERSION = "product_version";
private final static String ST_NODE_PRODUCT_URN = "product_urn";
private final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn";
private final static String ST_NODE_PRODUCT_PARENT = "product_parent";
private final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id";
private final static String ST_NODE_PRODUCT_VENDOR = "product_vendor";
private final static String ST_NODE_PLATFORM_ARCH = "platform_arch";
private final static String ST_NODE_CONTAINER = "container";
private final static String ST_NODE_SOURCE = "source";
// Swordfish entry for JDK 6
private final static String JDK_6_URN = "urn:uuid:b58ef9a8-5ae8-11db-a023-080020a9ed93";
private final static String JDK_6_NAME = "Java SE 6 Development Kit";
private final static String JRE_6_URN = "urn:uuid:92d1de8c-1e59-42c6-a280-1c379526bcbc";
private final static String JRE_6_NAME = "Java SE 6 Runtime Environment";
private final static String PARENT_6_URN = "urn:uuid:fdc90b21-018d-4cab-b866-612c7c119ed3";
private final static String PARENT_6_NAME = "Java Platform Standard Edition 6 (Java SE 6)";
// Swordfish entry for JDK 5
private final static String JDK_5_URN = "urn:uuid:d5bed446-05f2-42ed-ba0a-153105a52413";
private final static String JDK_5_NAME = "J2SE 5.0 Development Kit";
private final static String JRE_5_URN = "urn:uuid:5c6686aa-fd05-46a6-ba3e-700e2d5f7043";
private final static String JRE_5_NAME = "J2SE 5.0 Runtime Environment";
private final static String PARENT_5_URN = "urn:uuid:f3c20172-557a-11d7-93d0-d6a41ea318df";
private final static String PARENT_5_NAME = "Java 2 Platform, Standard Edition 5.0";
private JDKServiceTag() {
}
/**
* Returns a (@code Properties) object containing the required fields
* for creating the service tag for Java SE. The key will be the
* element tag name defined in the Service Tags schema.
* This method returns {@code null} if not supported.
*
* @param bundleOwner the product name of the bundle owner
*
* @throw NullPointerException if bundleOwner is null.
* @throw IllegalArgumentException if the input arugment is null or empty.
*/
public static Properties getServiceTagProperties(String bundleOwner) {
if (bundleOwner.length() == 0) {
throw new IllegalArgumentException("Empty bundleOwner value");
}
// only support JDK 5 and JDK 6
int version = getJdkVersion();
if (version != 5 && version != 6) {
return null;
}
Properties svcTagProps = new Properties();
String javaHome = System.getProperty("java.home");
boolean isJdk;
String jrePath;
// Determine the JRE path by checking the existence of
// <HOME>/jre/lib and
Other Glassfish examples (source code examples)Here is a short list of links related to this Glassfish JDKServiceTag.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.