jdk/test/com/sun/servicetag/JavaServiceTagTest.java
author xdono
Thu, 30 Apr 2009 15:04:39 -0700
changeset 2691 bad7bbf42755
parent 1327 912486b03832
child 5506 202f599c92aa
permissions -rw-r--r--
Added tag jdk7-b57 for changeset 93833fce07e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1327
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     1
/*
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     2
 * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     4
 *
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    10
 *
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    15
 * accompanied this code).
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    16
 *
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    20
 *
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    23
 * have any questions.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    24
 */
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    25
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    26
/*
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    27
 * @test
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    28
 * @bug     6622366
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    29
 * @summary Basic Test for ServiceTag.getJavaServiceTag()
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    30
 *          Disable creating the service tag in the system registry.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    31
 *          Verify the existence of registration.xml file and the
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    32
 *          content of the service tag.
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    33
 * @author  Mandy Chung
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    34
 *
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    35
 * @run build JavaServiceTagTest
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    36
 * @run main JavaServiceTagTest
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    37
 */
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    38
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    39
import com.sun.servicetag.*;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    40
import java.io.*;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    41
import java.util.*;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    42
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    43
public class JavaServiceTagTest {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    44
    public static void main(String[] argv) throws Exception {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    45
        String registrationDir = System.getProperty("test.classes");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    46
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    47
        // disable calling to stclient
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    48
        System.setProperty("servicetag.sthelper.supported", "false");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    49
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    50
        if (Registry.isSupported()) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    51
            throw new RuntimeException("Registry.isSupported() should " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    52
                "return false");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    53
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    54
        // For debugging
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    55
        // System.setProperty("servicetag.verbose", "");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    56
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    57
        // cleanup the registration.xml and servicetag file in the test directory
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    58
        System.setProperty("servicetag.dir.path", registrationDir);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    59
        File regFile = new File(registrationDir, "registration.xml");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    60
        regFile.delete();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    61
        File svcTagFile = new File(registrationDir, "servicetag");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    62
        svcTagFile.delete();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    63
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    64
        ServiceTag svctag = ServiceTag.getJavaServiceTag("JavaServiceTagTest");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    65
        checkServiceTag(svctag);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    66
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    67
        if (svcTagFile.exists()) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    68
            throw new RuntimeException(svcTagFile + " should not exist.");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    69
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    70
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    71
        // registration.xml should be created
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    72
        if (!regFile.exists()) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    73
            throw new RuntimeException(regFile + " not created.");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    74
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    75
        BufferedInputStream in = new BufferedInputStream(new FileInputStream(regFile));
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    76
        RegistrationData registration = RegistrationData.loadFromXML(in);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    77
        Set<ServiceTag> c = registration.getServiceTags();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    78
        if (c.size() != 1) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    79
            throw new RuntimeException(regFile + " has " + c.size() +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    80
                " service tags. Expected 1.");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    81
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    82
        ServiceTag st = registration.getServiceTag(svctag.getInstanceURN());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    83
        if (!Util.matches(st, svctag)) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    84
            throw new RuntimeException("ServiceTag " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    85
                " doesn't match.");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    86
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    87
    }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    88
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    89
    private static void checkServiceTag(ServiceTag st) throws IOException {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    90
        Properties props = loadSwordfishEntries();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    91
        if (st.getProductURN().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    92
                equals(props.getProperty("servicetag.jdk.urn"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    93
            if (!st.getProductName().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    94
                    equals(props.getProperty("servicetag.jdk.name"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    95
                throw new RuntimeException("Product URN and name don't match.");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    96
            }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    97
        } else if (st.getProductURN().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    98
                equals(props.getProperty("servicetag.jre.urn"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
    99
            if (!st.getProductName().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   100
                    equals(props.getProperty("servicetag.jre.name"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   101
                throw new RuntimeException("Product URN and name don't match.");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   102
            }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   103
        } else {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   104
            throw new RuntimeException("Unexpected product_urn: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   105
                st.getProductURN());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   106
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   107
        if (!st.getProductVersion().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   108
                equals(System.getProperty("java.version"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   109
            throw new RuntimeException("Unexpected product_version: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   110
                st.getProductVersion());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   111
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   112
        if (!st.getProductParent().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   113
                equals(props.getProperty("servicetag.parent.name"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   114
            throw new RuntimeException("Unexpected product_parent: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   115
                st.getProductParent());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   116
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   117
        if (!st.getProductParentURN().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   118
                equals(props.getProperty("servicetag.parent.urn"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   119
            throw new RuntimeException("Unexpected product_parent_urn: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   120
                st.getProductParentURN());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   121
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   122
        if (!st.getPlatformArch().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   123
                equals(System.getProperty("os.arch"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   124
            throw new RuntimeException("Unexpected platform_arch: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   125
                st.getPlatformArch());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   126
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   127
        if (!st.getProductVendor().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   128
                equals("Sun Microsystems")) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   129
            throw new RuntimeException("Unexpected product_vendor: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   130
                st.getProductVendor());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   131
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   132
        if (!st.getSource().
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   133
                equals("JavaServiceTagTest")) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   134
            throw new RuntimeException("Unexpected source: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   135
                st.getSource());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   136
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   137
        String[] ss = st.getProductDefinedInstanceID().split(",");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   138
        boolean id = false;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   139
        boolean dir = false;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   140
        for (String s : ss) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   141
            String[] values = s.split("=");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   142
            if (values[0].equals("id")) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   143
                id = true;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   144
                String[] sss = values[1].split(" ");
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   145
                if (!sss[0].equals(System.getProperty("java.runtime.version"))) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   146
                    throw new RuntimeException("Unexpected version in id: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   147
                        sss[0]);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   148
                }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   149
                if (sss.length < 2) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   150
                    throw new RuntimeException("Unexpected id=" + values[1]);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   151
                }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   152
            } else if (values[0].equals("dir")) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   153
                dir = true;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   154
            }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   155
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   156
        if (!id || !dir) {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   157
            throw new RuntimeException("Unexpected product_defined_instance_id: " +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   158
                st.getProductDefinedInstanceID());
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   159
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   160
    }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   161
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   162
    private static Properties loadSwordfishEntries()
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   163
           throws IOException {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   164
        int version = sun.misc.Version.jdkMinorVersion();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   165
        String filename = "/com/sun/servicetag/resources/javase_" +
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   166
                version + "_swordfish.properties";
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   167
        InputStream in = Installer.class.getClass().getResourceAsStream(filename);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   168
        Properties props = new Properties();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   169
        try {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   170
            props.load(in);
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   171
        } finally {
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   172
            in.close();
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   173
        }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   174
        return props;
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   175
    }
912486b03832 6581243: Service Tag and Product Registration Support in JDK 7
mchung
parents:
diff changeset
   176
}