提交 83e48e14 编写于 作者: L lana

Merge

......@@ -45,7 +45,7 @@ SUBDIRS_management = jmx
SUBDIRS_desktop = image
SUBDIRS_enterprise = crypto/provider jndi \
org rowset net/httpserver
SUBDIRS_misc = $(SCRIPT_SUBDIR) tracing servicetag nio demo
SUBDIRS_misc = $(SCRIPT_SUBDIR) tracing nio demo
SUBDIRS_tools = tools
......
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
BUILDDIR = ../../..
PACKAGE = com.sun.servicetag
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# Files to compile
#
AUTO_FILES_JAVA_DIRS = com/sun/servicetag
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
SERVICETAG_LIBDIR = $(LIBDIR)/servicetag
SERVICETAG_RESOURCES_DIR = $(CLASSDESTDIR)/com/sun/servicetag/resources
FILES_copy = $(SERVICETAG_RESOURCES_DIR)/product_registration.xsd \
$(SERVICETAG_RESOURCES_DIR)/register.html \
$(SERVICETAG_RESOURCES_DIR)/register_ja.html \
$(SERVICETAG_RESOURCES_DIR)/register_zh_CN.html \
$(SERVICETAG_LIBDIR)/jdk_header.png
# Add all properties files to the FILES_copy list
SWORDFISH_properties := $(shell \
$(CD) $(SHARE_SRC)/classes/com/sun/servicetag/resources; \
$(FIND) . -name 'javase_*.properties' -print ; \
)
FILES_copy += $(shell \
for f in $(SWORDFISH_properties) ; do \
echo $(SERVICETAG_RESOURCES_DIR)/$$f ; \
done \
)
#
#OTHER_JAVACFLAGS += -Xlint:unchecked
build: install-servicetag-lib copy-files
copy-files: $(FILES_copy)
$(CLASSBINDIR)/%: $(SHARE_SRC)/classes/%
$(install-file)
$(SERVICETAG_LIBDIR)/jdk_header.png: $(SHARE_SRC)/classes/com/sun/servicetag/resources/jdk_header.png
$(install-file)
$(call chmod-file, 444)
install-servicetag-lib:
@$(RM) -rf $(SERVICETAG_LIBDIR)
$(MKDIR) $(SERVICETAG_LIBDIR)
clean clobber::
@$(RM) $(FILES_copy)
.PHONY: copy-files
......@@ -59,8 +59,7 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
# This is an interim solution until the ct.sym is replaced
# with a new module system (being discussed for JDK 8).
#
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
com.oracle.net \
EXPORTED_PRIVATE_PKGS = com.oracle.net \
com.oracle.nio
# 64-bit solaris has a few special cases. We define the variable
......
......@@ -209,6 +209,7 @@ JAVA_JAVA_java = \
sun/util/locale/provider/CalendarDataProviderImpl.java \
sun/util/locale/provider/CalendarDataUtility.java \
sun/util/locale/provider/CalendarNameProviderImpl.java \
sun/util/locale/provider/CalendarProviderImpl.java \
sun/util/locale/provider/CollationRules.java \
sun/util/locale/provider/CollatorProviderImpl.java \
sun/util/locale/provider/CurrencyNameProviderImpl.java \
......@@ -232,6 +233,7 @@ JAVA_JAVA_java = \
sun/util/locale/provider/SPILocaleProviderAdapter.java \
sun/util/locale/provider/TimeZoneNameProviderImpl.java \
sun/util/locale/provider/TimeZoneNameUtility.java \
sun/util/spi/CalendarProvider.java \
java/util/LocaleISOData.java \
sun/util/cldr/CLDRLocaleProviderAdapter.java \
java/util/MissingResourceException.java \
......
......@@ -133,6 +133,7 @@ SUNWprivate_1.1 {
Java_java_lang_ClassLoader_00024NativeLibrary_find;
Java_java_lang_ClassLoader_00024NativeLibrary_load;
Java_java_lang_ClassLoader_00024NativeLibrary_unload;
Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib;
Java_java_lang_ClassLoader_getCaller;
Java_java_lang_ClassLoader_registerNatives;
Java_java_lang_Compiler_registerNatives;
......
#
# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -384,9 +384,7 @@ OTHER_INCLUDES += \
ifeq ($(PLATFORM),windows)
OTHER_LDLIBS += $(JVMLIB) ws2_32.lib \
-libpath:$(LIBDIR) java.lib \
$(OBJDIR)/../../../../sun/java.net/net/$(OBJDIRNAME)/net.lib \
$(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/io_util.obj \
$(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/FileDescriptor_md.obj
$(OBJDIR)/../../../../sun/java.net/net/$(OBJDIRNAME)/net.lib
endif
ifeq ($(PLATFORM), linux)
OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread $(LIBDL)
......
#
# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -76,6 +76,7 @@ FILES_c = \
debug_trace.c \
debug_util.c \
awt_Plugin.c \
gnome_interface.c \
gtk2_interface.c \
swing_GTKEngine.c \
swing_GTKStyle.c \
......
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -843,6 +843,7 @@ LIBAWT_XAWT_FILES:=\
debug_trace.c \
debug_util.c \
awt_Plugin.c \
gnome_interface.c \
gtk2_interface.c \
swing_GTKEngine.c \
swing_GTKStyle.c \
......@@ -1959,8 +1960,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO,\
-lsendfile -ljava -lnet -lc,\
LDFLAGS_SUFFIX_windows:=jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
$(JDK_OUTPUTDIR)/objs/libnet/net.lib \
$(JDK_OUTPUTDIR)/objs/libjava/io_util.obj \
$(JDK_OUTPUTDIR)/objs/libjava/FileDescriptor_md.obj \
advapi32.lib,\
LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread -framework CoreFoundation,\
LDFLAGS_SUFFIX:=,\
......
......@@ -81,17 +81,6 @@ endif
##########################################################################################
LIBDIR = $(JDK_OUTPUTDIR)/lib
SERVICETAG_LIBDIR = $(LIBDIR)/servicetag
$(SERVICETAG_LIBDIR)/jdk_header.png: $(JDK_TOPDIR)/src/share/classes/com/sun/servicetag/resources/jdk_header.png
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(CHMOD) 444 $@
COPY_FILES += $(SERVICETAG_LIBDIR)/jdk_header.png
##########################################################################################
MGMT_LIBDIR = $(LIBDIR)/management
MGMT_LIB_SRC = $(JDK_TOPDIR)/src/share/lib/management
......
......@@ -59,15 +59,6 @@ COPY_FILES += \
COPY_FILES += \
$(JDK_TOPDIR)/src/share/classes/sun/jvmstat/perfdata/resources/aliasmap
# Servicetag resources
SERVICETAG_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/servicetag/resources
COPY_FILES += \
$(SERVICETAG_RESOURCES_DIR)/product_registration.xsd \
$(SERVICETAG_RESOURCES_DIR)/register.html \
$(SERVICETAG_RESOURCES_DIR)/register_ja.html \
$(SERVICETAG_RESOURCES_DIR)/register_zh_CN.html \
$(wildcard $(SERVICETAG_RESOURCES_DIR)/javase_*.properties)
# JConsole resources
JCONSOLE_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources
COPY_FILES += \
......
......@@ -76,8 +76,6 @@ $(eval $(call SetupArchive,BUILD_DNS_JAR,,\
$(IMAGES_OUTPUTDIR)/lib/tzdb.jar: $(JDK_OUTPUTDIR)/lib/tzdb.jar
$(install-file)
JARS += $(IMAGES_OUTPUTDIR)/lib/tzdb.jar
##########################################################################################
LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in is it \
......@@ -213,28 +211,28 @@ RT_JAR_EXCLUDES += \
org/relaxng/datatype \
sun/awt/HKSCS.class \
sun/awt/motif/X11GB2312.class \
sun/awt/motif/X11GB2312\$$Decoder.class \
sun/awt/motif/X11GB2312\$$Encoder.class \
sun/awt/motif/X11GB2312\$$$$Decoder.class \
sun/awt/motif/X11GB2312\$$$$Encoder.class \
sun/awt/motif/X11GBK.class \
sun/awt/motif/X11GBK\$$Encoder.class \
sun/awt/motif/X11GBK\$$$$Encoder.class \
sun/awt/motif/X11KSC5601.class \
sun/awt/motif/X11KSC5601\$$Decoder.class \
sun/awt/motif/X11KSC5601\$$Encoder.class \
sun/awt/motif/X11KSC5601\$$$$Decoder.class \
sun/awt/motif/X11KSC5601\$$$$Encoder.class \
sun/jvmstat \
sun/net/spi/nameservice/dns \
sun/nio/cs/ext \
sun/rmi/rmic \
sun/security/ec/ECDHKeyAgreement.class \
sun/security/ec/ECDSASignature.class \
sun/security/ec/ECDSASignature\$$Raw.class \
sun/security/ec/ECDSASignature\$$SHA1.class \
sun/security/ec/ECDSASignature\$$SHA224.class \
sun/security/ec/ECDSASignature\$$SHA256.class \
sun/security/ec/ECDSASignature\$$SHA384.class \
sun/security/ec/ECDSASignature\$$SHA512.class \
sun/security/ec/ECDSASignature\$$$$Raw.class \
sun/security/ec/ECDSASignature\$$$$SHA1.class \
sun/security/ec/ECDSASignature\$$$$SHA224.class \
sun/security/ec/ECDSASignature\$$$$SHA256.class \
sun/security/ec/ECDSASignature\$$$$SHA384.class \
sun/security/ec/ECDSASignature\$$$$SHA512.class \
sun/security/ec/ECKeyFactory.class \
sun/security/ec/ECKeyPairGenerator.class \
sun/security/ec/SunEC\$$1.class \
sun/security/ec/SunEC\$$$$1.class \
sun/security/ec/SunEC.class \
sun/security/ec/SunECEntries.class \
sun/security/internal \
......@@ -357,23 +355,25 @@ $(PROFILE_VERSION_CLASS_TARGETS) : $(PROFILE_VERSION_JAVA_TARGETS)
# Support for removing the addPropertyChangeListener and removePropertyChangeListener
# methods from classes that only go into the profile builds. For now the Pack200.Packer
# and Packer200.Unpacker classes have special handling because of the $ in the file
# name.
# methods from classes that only go into the profile builds.
BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless
# When there are $ characters in filenames we have some very subtle interactions between
# make expansion and shell expansion. In this particular case $< will contain a single $ while
# $@ will contain \$. So we have to pass $< in single-quotes to avoid shell expansion
$(BEANLESS_CLASSES)/%: $(JDK_OUTPUTDIR)/classes/%
$(MKDIR) -p $(@D)
$(TOOL_REMOVEMETHODS) $< $@ addPropertyChangeListener removePropertyChangeListener
$(TOOL_REMOVEMETHODS) '$<' $@ addPropertyChangeListener removePropertyChangeListener
CLASSES_TO_DEBEAN = \
java/util/logging/LogManager.class \
java/util/jar/Pack200\$$Packer.class \
java/util/jar/Pack200\$$Unpacker.class \
com/sun/java/util/jar/pack/PackerImpl.class \
com/sun/java/util/jar/pack/UnpackerImpl.class
com/sun/java/util/jar/pack/UnpackerImpl.class
BEANLESS_CLASSES_TARGETS =
ifneq ($(PROFILE),)
BEANLESS_CLASSES_TARGETS := $(foreach c, $(CLASSES_TO_DEBEAN), $(BEANLESS_CLASSES)/$c)
BEANLESS_CLASSES_TARGETS := $(addprefix $(BEANLESS_CLASSES)/, $(CLASSES_TO_DEBEAN))
endif
......@@ -400,13 +400,8 @@ $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the
$(ECHO) Updating rt.jar $(PROFILE) && \
$(CD) $(patsubst %$(VERSION_CLASS_PATH),%,$(CLASS_FILE)) && \
$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
$(MKDIR) -p $(BEANLESS_CLASSES)/java/util/jar; \
$(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Packer.class \
$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Packer.class addPropertyChangeListener removePropertyChangeListener; \
$(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Unpacker.class \
$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Unpacker.class addPropertyChangeListener removePropertyChangeListener; \
$(CD) $(BEANLESS_CLASSES) && \
$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN) java/util/jar/* ; \
$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN); \
fi
$(MV) $@.tmp $@
......@@ -871,8 +866,7 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
# This is an interim solution until the ct.sym is replaced
# with a new module system (being discussed for JDK 8).
#
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
com.oracle.net \
EXPORTED_PRIVATE_PKGS = com.oracle.net \
com.oracle.nio
$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
......@@ -1123,8 +1117,6 @@ endif
$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar
$(install-file)
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar
##########################################################################################
-include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
......
......@@ -194,7 +194,6 @@ $(eval $(call add_properties_to_clean,COM_SUN_ROWSET_HK,\
$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/rowset)),\
%zh_TW,%zh_HK))
#com/sun/servicetag/resources
#com/sun/swing/internal/plaf/basic/resources
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC,\
$(filter %.properties,\
......
......@@ -30,9 +30,8 @@
PROFILE_NAMES := compact1 compact2 compact3
# The include files use 1,2,3,4 for simplicity and conciseness. Internally we
# use profile_1, profile_2 and profile_3. Note that profile_4 is a full JRE so
# we never have to use it directly.
# The include files use 1,2,3 for simplicity and conciseness. Internally we
# use profile_1, profile_2 and profile_3.
ALL_PROFILES := profile_1 profile_2 profile_3
......
......@@ -74,19 +74,19 @@ PROFILE_3_JARS := \
$(PROFILE_2_JARS)
ifdef OPENJDK
PROFILE_4_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(PROFILE_4_JRE_JAR_FILES))
FULL_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(FULL_JRE_JAR_FILES))
endif
PROFILE_4_JARS := \
$(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_4_JRE_JAR_FILES)) \
FULL_JRE_JARS := \
$(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(FULL_JRE_JAR_FILES)) \
$(PROFILE_3_JARS)
# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
# are also included.)
# Note we need to add back the regular form of all the custom profile jars e.g.
# rt.jar and resources.jar
# rt.jar and resources.jar that we filtered out above
ALL_JARS := $(PROFILE_4_JARS) \
ALL_JARS := $(FULL_JRE_JARS) \
$(IMAGES_OUTPUTDIR)/lib/rt.jar \
$(IMAGES_OUTPUTDIR)/lib/resources.jar \
$(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
......@@ -94,7 +94,6 @@ ALL_JARS := $(PROFILE_4_JARS) \
$(IMAGES_OUTPUTDIR)/lib/tools.jar \
$(IMAGES_OUTPUTDIR)/lib/ct.sym \
$(IMAGES_OUTPUTDIR)/src.zip \
$(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar \
$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
ifeq ($(OPENJDK_TARGET_OS),solaris)
......@@ -140,7 +139,7 @@ ALL_JRE_BIN_FILES := \
$(PROFILE_1_JRE_BIN_FILES) \
$(PROFILE_2_JRE_BIN_FILES) \
$(PROFILE_3_JRE_BIN_FILES) \
$(PROFILE_4_JRE_BIN_FILES)
$(FULL_JRE_BIN_FILES)
NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
......@@ -149,18 +148,18 @@ ifeq ($(PROFILE), profile_1)
NOT_JRE_BIN_FILES += \
$(PROFILE_2_JRE_BIN_FILES) \
$(PROFILE_3_JRE_BIN_FILES) \
$(PROFILE_4_JRE_BIN_FILES)
$(FULL_JRE_BIN_FILES)
endif
ifeq ($(PROFILE), profile_2)
NOT_JRE_BIN_FILES += \
$(PROFILE_3_JRE_BIN_FILES) \
$(PROFILE_4_JRE_BIN_FILES)
$(FULL_JRE_BIN_FILES)
endif
ifeq ($(PROFILE), profile_3)
NOT_JRE_BIN_FILES += \
$(PROFILE_4_JRE_BIN_FILES)
$(FULL_JRE_BIN_FILES)
endif
NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
......@@ -173,7 +172,7 @@ ALL_JRE_LIB_FILES := \
$(PROFILE_1_JRE_LIB_FILES) \
$(PROFILE_2_JRE_LIB_FILES) \
$(PROFILE_3_JRE_LIB_FILES) \
$(PROFILE_4_JRE_LIB_FILES)
$(FULL_JRE_LIB_FILES)
NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
......@@ -189,18 +188,18 @@ ifeq ($(PROFILE), profile_1)
NOT_JRE_LIB_FILES += \
$(PROFILE_2_JRE_LIB_FILES) \
$(PROFILE_3_JRE_LIB_FILES) \
$(PROFILE_4_JRE_LIB_FILES)
$(FULL_JRE_LIB_FILES)
endif
ifeq ($(PROFILE), profile_2)
NOT_JRE_LIB_FILES += \
$(PROFILE_3_JRE_LIB_FILES) \
$(PROFILE_4_JRE_LIB_FILES)
$(FULL_JRE_LIB_FILES)
endif
ifeq ($(PROFILE), profile_3)
NOT_JRE_LIB_FILES += \
$(PROFILE_4_JRE_LIB_FILES)
$(FULL_JRE_LIB_FILES)
endif
# Exclude the custom jar files as these will be added back via a special rule
......@@ -279,13 +278,13 @@ class_list = $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
ifeq ($(PROFILE), profile_1)
RT_JAR_EXCLUDES += \
$(PROFILE_1_RTJAR_EXCLUDE_TYPES) \
$(call class_list, $(PROFILE_1_RTJAR_EXCLUDE_TYPES)) \
$(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
$(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
$(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
$(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
RT_JAR_INCLUDE_TYPES := \
$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
PROFILE_INCLUDE_METAINF_SERVICES := \
......@@ -293,11 +292,11 @@ ifeq ($(PROFILE), profile_1)
endif
ifeq ($(PROFILE), profile_2)
RT_JAR_EXCLUDES += \
$(PROFILE_2_RTJAR_EXCLUDE_TYPES) \
$(call class_list, $(PROFILE_2_RTJAR_EXCLUDE_TYPES)) \
$(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
$(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
$(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
RT_JAR_INCLUDE_TYPES := \
$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
......@@ -307,9 +306,9 @@ ifeq ($(PROFILE), profile_2)
endif
ifeq ($(PROFILE), profile_3)
RT_JAR_EXCLUDES += \
$(PROFILE_3_RTJAR_EXCLUDE_TYPES) \
$(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
$(call class_list, $(PROFILE_3_RTJAR_EXCLUDE_TYPES)) \
$(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
$(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
RT_JAR_INCLUDE_TYPES := \
$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
......
......@@ -133,6 +133,7 @@ SUNWprivate_1.1 {
Java_java_lang_ClassLoader_00024NativeLibrary_find;
Java_java_lang_ClassLoader_00024NativeLibrary_load;
Java_java_lang_ClassLoader_00024NativeLibrary_unload;
Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib;
Java_java_lang_ClassLoader_getCaller;
Java_java_lang_ClassLoader_registerNatives;
Java_java_lang_Compiler_registerNatives;
......
......@@ -27,6 +27,7 @@ PROFILE_1_JRE_BIN_FILES := \
keytool$(EXE_SUFFIX)
PROFILE_1_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pkcs11$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig.diz \
......@@ -34,6 +35,7 @@ PROFILE_1_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
......@@ -61,7 +63,9 @@ PROFILE_1_JRE_LIB_FILES := \
currency.data \
ext/localedata.jar \
ext/meta-index \
ext/sunec.jar \
ext/sunjce_provider.jar \
ext/sunpkcs11.jar \
jce.jar \
jsse.jar \
logging.properties \
......@@ -88,7 +92,9 @@ PROFILE_1_JRE_OTHER_FILES := \
PROFILE_1_JRE_JAR_FILES := \
ext/localedata.jar \
ext/sunec.jar \
ext/sunjce_provider.jar \
ext/sunpkcs11.jar \
jce.jar \
jsse.jar \
resources.jar \
......@@ -142,7 +148,7 @@ PROFILE_3_JRE_JAR_FILES := \
management-agent.jar
PROFILE_4_JRE_BIN_FILES := \
FULL_JRE_BIN_FILES := \
orbd$(EXE_SUFFIX) \
pack200$(EXE_SUFFIX) \
policytool$(EXE_SUFFIX) \
......@@ -150,7 +156,7 @@ PROFILE_4_JRE_BIN_FILES := \
tnameserv$(EXE_SUFFIX) \
unpack200$(EXE_SUFFIX)
PROFILE_4_JRE_LIB_FILES := \
FULL_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_xawt$(SHARED_LIBRARY_SUFFIX) \
......@@ -158,7 +164,6 @@ PROFILE_4_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pkcs11$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
......@@ -167,7 +172,6 @@ PROFILE_4_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)kcms$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
alt-rt.jar \
charsets.jar \
......@@ -178,8 +182,7 @@ PROFILE_4_JRE_LIB_FILES := \
cmm/sRGB.pf \
ext/cldrdata.jar \
ext/dnsns.jar \
ext/sunec.jar \
ext/sunpkcs11.jar \
ext/nashorn.jar \
ext/zipfs.jar \
flavormap.properties \
fontconfig.RedHat.5.bfc \
......@@ -219,10 +222,9 @@ PROFILE_4_JRE_LIB_FILES := \
oblique-fonts/fonts.dir \
psfont.properties.ja \
psfontj2d.properties \
servicetag/jdk_header.png \
sound.properties
PROFILE_4_JRE_OTHER_FILES := \
FULL_JRE_OTHER_FILES := \
man/ja_JP.UTF-8/man1/java.1 \
man/ja_JP.UTF-8/man1/javaws.1 \
man/ja_JP.UTF-8/man1/keytool.1 \
......@@ -246,13 +248,12 @@ PROFILE_4_JRE_OTHER_FILES := \
man/man1/tnameserv.1 \
man/man1/unpack200.1
PROFILE_4_JRE_JAR_FILES := \
FULL_JRE_JAR_FILES := \
alt-rt.jar \
charsets.jar \
ext/cldrdata.jar \
ext/dnsns.jar \
ext/sunec.jar \
ext/sunpkcs11.jar \
ext/nashorn.jar \
ext/zipfs.jar
......@@ -83,14 +83,19 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
painter.state.set(state);
painter.state.set((state != State.DISABLED && state != State.INACTIVE) && b.isFocusPainted() && isFocused(b) ? Focused.YES : Focused.NO);
// Full border size of the component.
// g.setColor(new Color(0, 255, 0, 70));
// g.drawRect(x, y, width - 1, height - 1);
final Insets subInsets = sizeVariant.insets;
x += subInsets.left;
y += subInsets.top;
width -= (subInsets.left + subInsets.right);
height -= (subInsets.top + subInsets.bottom);
// g.setColor(Color.magenta);
// g.drawRect(x, y, width - 1, height - 1);
// Where the native border should start to paint.
// g.setColor(new Color(255, 0, 255, 70));
// g.drawRect(x, y, width - 1, height - 1);
doButtonPaint(b, model, g, x, y, width, height);
}
......
......@@ -184,30 +184,30 @@ public class AquaButtonExtendedTypes {
new BorderDefinedTypeSpecifier("round", Widget.BUTTON_ROUND, new SizeVariant().alterInsets(2, 0, 0, 0).alterMinSize(28, 28), -3, -3, -3, -3),
new BorderDefinedTypeSpecifier("texturedRound", Widget.BUTTON_ROUND_INSET, new SizeVariant().alterInsets(0, 0, 0, 0).alterMinSize(26, 26), -2, -2, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmented-first", Widget.BUTTON_SEGMENTED, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 16, 6, 10).alterInsets(5, 3, 5, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmented-middle", Widget.BUTTON_SEGMENTED, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 9, 6, 10).alterInsets(5, 0, 5, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmented-last", Widget.BUTTON_SEGMENTED, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 9, 6, 16).alterInsets(5, 0, 5, 3).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmented-only", Widget.BUTTON_SEGMENTED, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 16, 6, 16).alterInsets(5, 3, 5, 3).alterMinSize(34, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-first", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(5, 2, 5, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-middle", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(5, 0, 5, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-last", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(5, 0, 5, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-only", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(5, 2, 5, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-first", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(5, 2, 5, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-middle", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(5, 0, 5, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-last", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(5, 0, 5, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-only", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(5, 2, 5, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-first", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(6, 3, 6, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-middle", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(6, 0, 6, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-last", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(6, 0, 6, 3).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-only", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(6, 3, 6, 3).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-first", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(5, 2, 5, 0).alterMinSize(0, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-middle", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(5, 0, 5, 0).alterMinSize(0, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-last", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(5, 0, 5, 2).alterMinSize(0, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-only", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(5, 2, 5, 2).alterMinSize(34, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmented-first", Widget.BUTTON_SEGMENTED, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 16, 6, 10).alterInsets(2, 3, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmented-middle", Widget.BUTTON_SEGMENTED, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 9, 6, 10).alterInsets(2, 0, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmented-last", Widget.BUTTON_SEGMENTED, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 9, 6, 16).alterInsets(2, 0, 2, 3).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmented-only", Widget.BUTTON_SEGMENTED, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 16, 6, 16).alterInsets(2, 3, 2, 3).alterMinSize(34, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-first", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(2, 2, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-middle", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(2, 0, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-last", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(2, 0, 2, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedRoundRect-only", Widget.BUTTON_SEGMENTED_INSET, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(2, 2, 2, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-first", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(2, 2, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-middle", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(2, 0, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-last", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(2, 0, 2, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTexturedRounded-only", Widget.BUTTON_SEGMENTED_SCURVE, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(2, 2, 2, 2).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-first", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(2, 3, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-middle", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(2, 0, 2, 0).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-last", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(2, 0, 2, 3).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedTextured-only", Widget.BUTTON_SEGMENTED_TEXTURED, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(2, 3, 2, 3).alterMinSize(0, 28), 0, -3, 0, -3),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-first", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.FIRST, new SizeVariant().alterMargins(6, 12, 6, 8).alterInsets(2, 2, 2, 0).alterMinSize(0, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-middle", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.MIDDLE, new SizeVariant().alterMargins(6, 8, 6, 8).alterInsets(2, 0, 2, 0).alterMinSize(0, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-last", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.LAST, new SizeVariant().alterMargins(6, 8, 6, 12).alterInsets(2, 0, 2, 2).alterMinSize(0, 28), 0, 0, 0, 0),
new SegmentedBorderDefinedTypeSpecifier("segmentedCapsule-only", Widget.BUTTON_SEGMENTED_TOOLBAR, SegmentPosition.ONLY, new SizeVariant().alterMargins(6, 12, 6, 12).alterInsets(2, 2, 2, 2).alterMinSize(34, 28), 0, 0, 0, 0),
new BorderDefinedTypeSpecifier("segmentedGradient-first", Widget.BUTTON_BEVEL_INSET, new SizeVariant(18, 18).alterMargins(4, 5, 4, 5).replaceInsets(new Insets(-2,-0,-2,-0))),
new BorderDefinedTypeSpecifier("segmentedGradient-middle", Widget.BUTTON_BEVEL_INSET, new SizeVariant(18, 18).alterMargins(4, 5, 4, 5).replaceInsets(new Insets(-2,-1,-2,-0))),
......
......@@ -32,11 +32,13 @@ import java.text.spi.DateFormatSymbolsProvider;
import java.text.spi.DecimalFormatSymbolsProvider;
import java.text.spi.NumberFormatProvider;
import java.util.Collections;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle.Control;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReferenceArray;
......@@ -45,6 +47,7 @@ import java.util.spi.CalendarNameProvider;
import java.util.spi.CurrencyNameProvider;
import java.util.spi.LocaleNameProvider;
import java.util.spi.TimeZoneNameProvider;
import sun.util.spi.CalendarProvider;
/**
* LocaleProviderAdapter implementation for the Mac OS X locale data
......@@ -94,17 +97,56 @@ public class HostLocaleProviderAdapterImpl {
private static final Set<Locale> supportedLocaleSet;
static {
Set<Locale> tmpSet = new HashSet<Locale>();
Set<Locale> tmpSet = new HashSet<>();
// Assuming the default locales do not include any extensions, so
// no stripping is needed here.
Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replaceAll("_","-"));
Locale l = convertMacOSXLocaleToJavaLocale(getDefaultLocale(CAT_FORMAT));
tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replaceAll("_","-"));
l = convertMacOSXLocaleToJavaLocale(getDefaultLocale(CAT_DISPLAY));
tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
}
private final static Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]);
@SuppressWarnings("fallthrough")
private static Locale convertMacOSXLocaleToJavaLocale(String macosxloc) {
// MacOSX may return ICU notation, here is the quote from CFLocale doc:
// "The corresponding value is a CFString containing the POSIX locale
// identifier as used by ICU, such as "ja_JP". If you have a variant
// locale or a different currency or calendar, it can be as complex as
// "en_US_POSIX@calendar=japanese;currency=EUR" or
// "az_Cyrl_AZ@calendar=buddhist;currency=JPY".
String[] tmp = macosxloc.split("@");
String langTag = tmp[0].replace('_', '-');
if (tmp.length > 1) {
String[] ext = tmp[1].split(";");
for (String keyval : ext) {
// We are only interested in "calendar" value for now.
if (keyval.startsWith("calendar=")) {
String calid = keyval.substring(keyval.indexOf('=')+1);
switch (calid) {
case "gregorian":
langTag += "-u-ca-gregory";
break;
case "japanese":
// Tweak for ja_JP_JP
if (tmp[0].equals("ja_JP")) {
return JRELocaleConstants.JA_JP_JP;
}
// fall through
default:
langTag += "-u-ca-" + calid;
break;
}
}
}
}
return Locale.forLanguageTag(langTag);
}
public static DateFormatProvider getDateFormatProvider() {
return new DateFormatProvider() {
......@@ -170,9 +212,8 @@ public class HostLocaleProviderAdapterImpl {
if (isSupportedLocale(Locale.getDefault(Locale.Category.FORMAT))) {
return supportedLocale;
}
return new Locale[0];
}
return new Locale[0];
}
@Override
public boolean isSupportedLocale(Locale locale) {
......@@ -362,6 +403,30 @@ public class HostLocaleProviderAdapterImpl {
};
}
public static CalendarProvider getCalendarProvider() {
return new CalendarProvider() {
@Override
public Locale[] getAvailableLocales() {
return getSupportedCalendarLocales();
}
@Override
public boolean isSupportedLocale(Locale locale) {
return isSupportedCalendarLocale(locale);
}
@Override
public Calendar getInstance(TimeZone zone, Locale locale) {
return new Calendar.Builder()
.setLocale(locale)
.setCalendarType(getCalendarID(locale.toLanguageTag()))
.setTimeZone(zone)
.setInstant(System.currentTimeMillis())
.build();
}
};
}
public static CurrencyNameProvider getCurrencyNameProvider() {
return new CurrencyNameProvider() {
@Override
......@@ -455,23 +520,20 @@ public class HostLocaleProviderAdapterImpl {
}
private static boolean isSupportedCalendarLocale(Locale locale) {
// special case for ja_JP_JP
if (JRELocaleConstants.JA_JP_JP.equals(locale)) {
return isJapaneseCalendar();
}
Locale base = locale.stripExtensions();
if (!supportedLocaleSet.contains(base)) {
return false;
}
String caltype = locale.getUnicodeLocaleType("ca");
if (caltype == null) {
return true;
}
String requestedCalType = locale.getUnicodeLocaleType("ca");
String nativeCalType =
getCalendarID(locale.toLanguageTag()).replaceFirst("gregorian", "gregory");
return caltype.replaceFirst("gregory", "gregorian").equals(
getCalendarID(locale.toLanguageTag()));
if (requestedCalType == null) {
return Calendar.getAvailableCalendarTypes().contains(nativeCalType);
} else {
return requestedCalType.equals(nativeCalType);
}
}
private static boolean isJapaneseCalendar() {
......@@ -479,18 +541,15 @@ public class HostLocaleProviderAdapterImpl {
}
private static Locale getCalendarLocale(Locale locale) {
Locale.Builder lb = new Locale.Builder().setLocale(locale);
String calid = getCalendarID(locale.toLanguageTag());
switch (calid) {
case "gregorian":
calid = "gregory";
// FALL THROUGH!
case "japanese":
case "buddhist":
lb.setUnicodeLocaleKeyword("ca", calid);
return lb.build();
default:
return locale;
String nativeCalType = getCalendarID(locale.toLanguageTag())
.replaceFirst("gregorian", "gregory");
if (Calendar.getAvailableCalendarTypes().contains(nativeCalType)) {
return new Locale.Builder()
.setLocale(locale)
.setUnicodeLocaleKeyword("ca", nativeCalType)
.build();
} else {
return locale;
}
}
......
......@@ -49,6 +49,42 @@ static int getBPPFromModeString(CFStringRef mode)
return 0;
}
static BOOL isValidDisplayMode(CGDisplayModeRef mode){
return (1 < CGDisplayModeGetWidth(mode) && 1 < CGDisplayModeGetHeight(mode));
}
static CFMutableArrayRef getAllValidDisplayModes(jint displayID){
CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
CFIndex numModes = CFArrayGetCount(allModes);
CFMutableArrayRef validModes = CFArrayCreateMutable(kCFAllocatorDefault, numModes + 1, NULL);
CFIndex n;
for (n=0; n < numModes; n++) {
CGDisplayModeRef cRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(allModes, n);
if (cRef != NULL && isValidDisplayMode(cRef)) {
CFArrayAppendValue(validModes, cRef);
}
}
CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(displayID);
BOOL containsCurrentMode = NO;
numModes = CFArrayGetCount(validModes);
for (n=0; n < numModes; n++) {
if(CFArrayGetValueAtIndex(validModes, n) == currentMode){
containsCurrentMode = YES;
break;
}
}
if (!containsCurrentMode) {
CFArrayAppendValue(validModes, currentMode);
}
return validModes;
}
/*
* Find the best possible match in the list of display modes that we can switch to based on
* the provided parameters.
......@@ -198,28 +234,30 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode
(JNIEnv *env, jclass class, jint displayID, jint w, jint h, jint bpp, jint refrate)
{
JNF_COCOA_ENTER(env);
CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
CFArrayRef allModes = getAllValidDisplayModes(displayID);
CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
__block CGError retCode = kCGErrorSuccess;
if (closestMatch != NULL) {
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
CGDisplayConfigRef config;
CGError retCode = CGBeginDisplayConfiguration(&config);
retCode = CGBeginDisplayConfiguration(&config);
if (retCode == kCGErrorSuccess) {
CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
if (config != NULL) {
CFRelease(config);
}
retCode = CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
}
}];
} else {
[JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"];
}
if (retCode != kCGErrorSuccess){
[JNFException raise:env as:kIllegalArgumentException reason:"Unable to set display mode!"];
}
CFRelease(allModes);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_awt_CGraphicsDevice
* Method: nativeGetDisplayMode
......@@ -247,7 +285,8 @@ Java_sun_awt_CGraphicsDevice_nativeGetDisplayModes
{
jobjectArray jreturnArray = NULL;
JNF_COCOA_ENTER(env);
CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
CFArrayRef allModes = getAllValidDisplayModes(displayID);
CFIndex numModes = CFArrayGetCount(allModes);
static JNF_CLASS_CACHE(jc_DisplayMode, "java/awt/DisplayMode");
......
......@@ -32,8 +32,11 @@ import javax.security.auth.spi.*;
import javax.naming.*;
import javax.naming.directory.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.LinkedList;
import java.util.ResourceBundle;
import com.sun.security.auth.UnixPrincipal;
import com.sun.security.auth.UnixNumericUserPrincipal;
......@@ -150,8 +153,14 @@ import com.sun.security.auth.UnixNumericGroupPrincipal;
*/
public class JndiLoginModule implements LoginModule {
static final java.util.ResourceBundle rb =
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
private static final ResourceBundle rb = AccessController.doPrivileged(
new PrivilegedAction<ResourceBundle>() {
public ResourceBundle run() {
return ResourceBundle.getBundle(
"sun.security.util.AuthResources");
}
}
);
/** JNDI Provider */
public final String USER_PROVIDER = "user.provider.url";
......
......@@ -30,22 +30,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AuthProvider;
import java.security.GeneralSecurityException;
import java.security.Key;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.UnrecoverableKeyException;
import java.security.*;
import java.security.cert.*;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.*;
import javax.security.auth.Destroyable;
import javax.security.auth.DestroyFailedException;
import javax.security.auth.Subject;
......@@ -123,8 +112,14 @@ import sun.security.util.Password;
*/
public class KeyStoreLoginModule implements LoginModule {
static final java.util.ResourceBundle rb =
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
private static final ResourceBundle rb = AccessController.doPrivileged(
new PrivilegedAction<ResourceBundle>() {
public ResourceBundle run() {
return ResourceBundle.getBundle(
"sun.security.util.AuthResources");
}
}
);
/* -- Fields -- */
......
......@@ -27,6 +27,8 @@
package com.sun.security.auth.module;
import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.MessageFormat;
import java.util.*;
......@@ -429,8 +431,14 @@ public class Krb5LoginModule implements LoginModule {
private static final String NAME = "javax.security.auth.login.name";
private static final String PWD = "javax.security.auth.login.password";
static final java.util.ResourceBundle rb =
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
private static final ResourceBundle rb = AccessController.doPrivileged(
new PrivilegedAction<ResourceBundle>() {
public ResourceBundle run() {
return ResourceBundle.getBundle(
"sun.security.util.AuthResources");
}
}
);
/**
* Initialize this <code>LoginModule</code>.
......
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.servicetag;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.io.IOException;
import java.net.URI;
/**
* BrowserSupport class.
*
* The implementation of the com.sun.servicetag API needs to be
* compiled with JDK 5 as well since the consumer of this API
* may require to support JDK 5 (e.g. NetBeans).
*
* The Desktop.browse() method can be backported in this class
* if needed. The current implementation only supports JDK 6.
*/
class BrowserSupport {
private static boolean isBrowseSupported = false;
private static Method browseMethod = null;
private static Object desktop = null;
private static volatile Boolean result = false;
private static void initX() {
if (desktop != null) {
return;
}
boolean supported = false;
Method browseM = null;
Object desktopObj = null;
try {
// Determine if java.awt.Desktop is supported
Class<?> desktopCls = Class.forName("java.awt.Desktop", true, null);
Method getDesktopM = desktopCls.getMethod("getDesktop");
browseM = desktopCls.getMethod("browse", URI.class);
Class<?> actionCls = Class.forName("java.awt.Desktop$Action", true, null);
final Method isDesktopSupportedMethod = desktopCls.getMethod("isDesktopSupported");
Method isSupportedMethod = desktopCls.getMethod("isSupported", actionCls);
Field browseField = actionCls.getField("BROWSE");
// isDesktopSupported calls getDefaultToolkit which can block
// infinitely, see 6636099 for details, to workaround we call
// in a thread and time it out, noting that the issue is specific
// to X11, it does not hurt for Windows.
Thread xthread = new Thread() {
public void run() {
try {
// support only if Desktop.isDesktopSupported() and
// Desktop.isSupported(Desktop.Action.BROWSE) return true.
result = (Boolean) isDesktopSupportedMethod.invoke(null);
} catch (IllegalAccessException e) {
// should never reach here
throw new InternalError("Desktop.getDesktop() method not found", e);
} catch (InvocationTargetException e) {
// browser not supported
if (Util.isVerbose()) {
e.printStackTrace();
}
}
}
};
// set it to daemon, so that the vm will exit.
xthread.setDaemon(true);
xthread.start();
try {
xthread.join(5 * 1000);
} catch (InterruptedException ie) {
// ignore the exception
}
if (result.booleanValue()) {
desktopObj = getDesktopM.invoke(null);
result = (Boolean) isSupportedMethod.invoke(desktopObj, browseField.get(null));
supported = result.booleanValue();
}
} catch (IllegalAccessException e) {
// should never reach here
throw new InternalError("Desktop.getDesktop() method not found", e);
} catch (ReflectiveOperationException e) {
// browser not supported
if (Util.isVerbose()) {
e.printStackTrace();
}
}
isBrowseSupported = supported;
browseMethod = browseM;
desktop = desktopObj;
}
static boolean isSupported() {
initX();
return isBrowseSupported;
}
/**
* Launches the default browser to display a {@code URI}.
* If the default browser is not able to handle the specified
* {@code URI}, the application registered for handling
* {@code URIs} of the specified type is invoked. The application
* is determined from the protocol and path of the {@code URI}, as
* defined by the {@code URI} class.
* <p>
* This method calls the Desktop.getDesktop().browse() method.
* <p>
* @param uri the URI to be displayed in the user default browser
*
* @throws NullPointerException if {@code uri} is {@code null}
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Desktop.Action#BROWSE} action
* @throws IOException if the user default browser is not found,
* or it fails to be launched, or the default handler application
* failed to be launched
* @throws IllegalArgumentException if the necessary permissions
* are not available and the URI can not be converted to a {@code URL}
*/
static void browse(URI uri) throws IOException {
if (uri == null) {
throw new NullPointerException("null uri");
}
if (!isSupported()) {
throw new UnsupportedOperationException("Browse operation is not supported");
}
// Call Desktop.browse() method
try {
if (Util.isVerbose()) {
System.out.println("desktop: " + desktop + ":browsing..." + uri);
}
browseMethod.invoke(desktop, uri);
} catch (IllegalAccessException e) {
// should never reach here
throw new InternalError("Desktop.getDesktop() method not found", e);
} catch (InvocationTargetException e) {
Throwable x = e.getCause();
if (x != null) {
if (x instanceof UnsupportedOperationException) {
throw (UnsupportedOperationException) x;
} else if (x instanceof IllegalArgumentException) {
throw (IllegalArgumentException) x;
} else if (x instanceof IOException) {
throw (IOException) x;
} else if (x instanceof SecurityException) {
throw (SecurityException) x;
} else {
// ignore
}
}
}
}
}
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.servicetag;
// This class is a copy of the com.sun.scn.servicetags.LinuxSystemEnvironment
// class from the Sun Connection source.
//
// The Service Tags team maintains the latest version of the implementation
// for system environment data collection. JDK will include a copy of
// the most recent released version for a JDK release. We rename
// the package to com.sun.servicetag so that the Sun Connection
// product always uses the latest version from the com.sun.scn.servicetags
// package. JDK and users of the com.sun.servicetag API
// (e.g. NetBeans and SunStudio) will use the version in JDK.
//
// So we keep this class in src/share/classes instead of src/<os>/classes.
import java.io.*;
/**
* Linux implementation of the SystemEnvironment class.
*/
class LinuxSystemEnvironment extends SystemEnvironment {
LinuxSystemEnvironment() {
setHostId(getLinuxHostId());
setSystemModel(getCommandOutput("/bin/uname", "-i"));
setSystemManufacturer(getLinuxSystemManufacturer());
setCpuManufacturer(getLinuxCpuManufacturer());
setSerialNumber(getLinuxSN());
}
private String dmiInfo = null;
private static final int SN = 1;
private static final int SYS = 2;
private static final int CPU = 3;
private String getLinuxHostId() {
String output = getCommandOutput("/usr/bin/hostid");
// trim off the leading 0x
if (output.startsWith("0x")) {
output = output.substring(2);
}
return output;
}
/**
* Tries to obtain and return the cpu manufacturer.
* @return The cpu manufacturer (an empty string if not found or an error occurred)
*/
private String getLinuxCpuManufacturer() {
String tmp = getLinuxPSNInfo(CPU);
if (tmp.length() > 0) {
return tmp;
}
String contents = getFileContent("/proc/cpuinfo");
for (String line : contents.split("\n")) {
if (line.contains("vendor_id")) {
String[] ss = line.split(":", 2);
if (ss.length > 1) {
return ss[1].trim();
}
}
}
// returns an empty string if it can't be found or an error happened
return getLinuxDMIInfo("dmi type 4", "manufacturer");
}
/**
* Tries to obtain and return the system manufacturer.
* @return The system manufacturer (an empty string if not found or an error occurred)
*/
private String getLinuxSystemManufacturer() {
String tmp = getLinuxPSNInfo(SYS);
if (tmp.length() > 0) {
return tmp;
}
// returns an empty string if it can't be found or an error happened
return getLinuxDMIInfo("dmi type 1", "manufacturer");
}
/**
* Tries to obtain and return the serial number of the system.
* @return The serial number (an empty string if not found or an error occurred)
*/
private String getLinuxSN() {
String tmp = getLinuxPSNInfo(SN);
if (tmp.length() > 0) {
return tmp;
}
// returns an empty string if it can't be found or an error happened
return getLinuxDMIInfo("dmi type 1", "serial number");
}
private String getLinuxPSNInfo(int target) {
// try to read from the psn file if it exists
String contents = getFileContent("/var/run/psn");
String[] ss = contents.split("\n");
if (target <= ss.length) {
return ss[target-1];
}
// default case is to return ""
return "";
}
// reads from dmidecode with the given type and target
// returns an empty string if nothing was found or an error occurred
//
// Sample output segment:
// Handle 0x0001
// DMI type 1, 25 bytes.
// System Information
// Manufacturer: System manufacturer
// Product Name: System Product Name
// Version: System Version
// Serial Number: System Serial Number
// UUID: 3091D719-B25B-D911-959D-6D1B12C7686E
// Wake-up Type: Power Switch
private synchronized String getLinuxDMIInfo(String dmiType, String target) {
// only try to get dmidecode information once, after that, we can
// reuse the output
if (dmiInfo == null) {
Thread dmidecodeThread = new Thread() {
public void run() {
dmiInfo = getCommandOutput("/usr/sbin/dmidecode");
}
};
dmidecodeThread.start();
try {
dmidecodeThread.join(2000);
if (dmidecodeThread.isAlive()) {
dmidecodeThread.interrupt();
dmiInfo = "";
}
} catch (InterruptedException ie) {
dmidecodeThread.interrupt();
}
}
if (dmiInfo.length() == 0) {
return "";
}
boolean dmiFlag = false;
for (String s : dmiInfo.split("\n")) {
String line = s.toLowerCase();
if (dmiFlag) {
if (line.contains(target)) {
String key = target + ":";
int indx = line.indexOf(key) + key.length();
if (line.contains(key) && indx < line.length()) {
return line.substring(indx).trim();
}
String[] ss = line.split(":");
return ss[ss.length-1];
}
} else if (line.contains(dmiType)) {
dmiFlag = true;
}
}
return "";
}
}
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.servicetag;
import java.io.*;
import java.net.UnknownHostException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import static com.sun.servicetag.RegistrationDocument.*;
/**
* A {@code RegistrationData} object is a container of one or more
* {@link #getServiceTags service tags} that identify the
* components for product registration.
* Each {@code RegistrationData} object has a {@link #getRegistrationURN
* uniform resource name} (URN) as its identifier.
* <a name="EnvMap"></a>
* It also has an <i>environment map</i> with
* the following elements:
* <blockquote>
* <table border=0>
* <tr>
* <td><tt>hostname</tt></td>
* <td>Hostname of the system</td>
* <td>e.g. woody</td>
* </tr>
* <tr>
* <td><tt>hostId</tt></td>
* <td>Host ID of the system</td>
* <td>e.g. 83abc1ab</td>
* </tr>
* <tr>
* <td><tt>osName</tt></td>
* <td>Operating system name</td>
* <td> e.g. SunOS</td>
* </tr>
* <tr>
* <td><tt>osVersion</tt></td>
* <td>Operating system version</td>
* <td> e.g. 5.10</td>
* </tr>
* <tr>
* <td><tt>osArchitecture</tt></td>
* <td>Operating system architecture</td>
* <td> e.g. sparc</td>
* </tr>
* <tr>
* <td><tt>systemModel</tt></td>
* <td>System model</td>
* <td> e.g. SUNW,Sun-Fire-V440</td>
* </tr>
* <tr>
* <td><tt>systemManufacturer</tt></td>
* <td>System manufacturer</td>
* <td> e.g. Oracle Corporation</td>
* </tr>
* <tr>
* <td><tt>cpuManufacturer</tt></td>
* <td>CPU manufacturer</td>
* <td> e.g. Oracle Corporation</td>
* </tr>
* <tr>
* <td><tt>serialNumber</tt></td>
* <td>System serial number</td>
* <td> e.g. BEL078932</td>
* </tr>
* </table>
* </blockquote>
* The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value.
* If an element is not available on a system and their value will be
* empty.
* <p>
* <a name="XMLSchema">
* <b>Registration XML Schema</b></a>
* <p>
* A {@code RegistrationData} object can be {@link #loadFromXML loaded} from
* and {@link #storeToXML stored} into an XML file in the format described
* by the
* <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd">
* registration data schema</a>. The registration data schema is defined by the
* Service Tags Technology.
* <p>
* Typically the registration data is constructed at installation time
* and stored in an XML file for later service tag lookup or registration.
*
* <p>
* <b>Example Usage</b>
* <p>
* The examples below show how the {@code RegistrationData} can be
* used for product registration.
* Exception handling is not shown in these examples for clarity.
* <ol>
* <li>This example shows how the JDK creates a JDK service tag, installs it
* in the system service tag registry and adds it to the registration data.
* <br>
* <blockquote><pre>
* // create a service tag object with an instance_urn
* ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
* ....);
* // Adds to the system service tag registry if supported
* if (Registry.isSupported()) {
* Registry.getSystemRegistry().addServiceTag(st);
* }
*
* // add to the registration data
* RegistrationData registration = new RegistrationData();
* registration.addServiceTag(st);
* </pre></blockquote>
* </li>
* <li>At this point, the registration data is ready to
* send to Sun Connection for registration. This example shows how to register
* the JDK via the <i>Registration Relay Service</i>.
* <p>
* There are several registration services for Sun Connection. For example,
* the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService">
* Registration Relay Service</a> is a web application interface that
* processes the registration data payload sent via HTTP post
* and hosts the registration user interface for a specified
* registration URL. Refer to the
* Registration Relay Service Specification for details.
* <p>
* <blockquote><pre>
* // Open the connection to the URL of the registration service
* HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
* con.setDoInput(true);
* con.setDoOutput(true);
* con.setUseCaches(false);
* con.setAllowUserInteraction(false);
* con.setRequestMethod("POST");
* con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
* con.connect();
*
* // send the registration data to the registration service
* OutputStream out = con.getOutputStream();
* registration.storeToXML(out);
* out.close();
* </pre></blockquote>
* </li>
* <li>This example shows how to store the registration data in an XML file.
* for later service tag lookup or registration.
* <br>
* <blockquote><pre>
* BufferedOutputStream out = new BufferedOutputStream(
* new FileOutputStream(""&lt;JAVA_HOME&gt;/lib/servicetag/registration.xml"));
* registration.storeToXML(out);
* out.close();
* </pre></blockquote>
* </li>
* <li>This example shows how to install service tags that are in the
* registration data in the system service tag registry when determined
* to be available. The system service tag registry might not have existed
* when the registration data was constructed.
* <br>
* <blockquote><pre>
* if (Registry.isSupported()) {
* Set&lt;ServiceTag&gt; svctags = registration.getServiceTags();
* for (ServiceTag st : svctags) {
* Registry.getSystemRegistry().addServiceTag(st);
* }
* }
* </pre></blockquote>
* </li>
* </ol>
*
* @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a>
*/
public class RegistrationData {
private final Map<String, String> environment = initEnvironment();
private final Map<String, ServiceTag> svcTagMap =
new LinkedHashMap<String, ServiceTag>();
private final String urn;
/**
* Creates a {@code RegistrationData} object with a generated
* {@link #getRegistrationURN registration URN}.
* The following keys in the {@link #getEnvironmentMap environment map}
* will be initialized for the configuration of the
* running system:
* <blockquote>
* <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and
* <tt>osArchitecture</tt>
* </blockquote>
* and the value of other keys may be empty.
*/
public RegistrationData() {
this(Util.generateURN());
SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
setEnvironment(ST_NODE_HOSTNAME, sysEnv.getHostname());
setEnvironment(ST_NODE_HOST_ID, sysEnv.getHostId());
setEnvironment(ST_NODE_OS_NAME, sysEnv.getOsName());
setEnvironment(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
setEnvironment(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
setEnvironment(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
setEnvironment(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());
setEnvironment(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
}
// package private
RegistrationData(String urn) {
this.urn = urn;
}
private Map<String, String> initEnvironment() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put(ST_NODE_HOSTNAME, "");
map.put(ST_NODE_HOST_ID, "");
map.put(ST_NODE_OS_NAME, "");
map.put(ST_NODE_OS_VERSION, "");
map.put(ST_NODE_OS_ARCH, "");
map.put(ST_NODE_SYSTEM_MODEL, "");
map.put(ST_NODE_SYSTEM_MANUFACTURER, "");
map.put(ST_NODE_CPU_MANUFACTURER, "");
map.put(ST_NODE_SERIAL_NUMBER, "");
return map;
}
/**
* Returns the uniform resource name of this registration data
* in this format:
* <tt>urn:st:&lt;32-char {@link java.util.UUID uuid}&gt;</tt>
*
* @return the URN of this registration data.
*/
public String getRegistrationURN() {
return urn;
}
/**
* Returns a map containing the environment information for this
* registration data. See the set of <a href="#EnvMap">keys</a>
* in the environment map. Subsequent update to the environment
* map via the {@link #setEnvironment setEnvironment} method will not be reflected
* in the returned map.
*
* @return an environment map for this registration data.
*/
public Map<String, String> getEnvironmentMap() {
return new LinkedHashMap<String,String>(environment);
}
/**
* Sets an element of the specified {@code name} in the environment map
* with the given {@code value}.
*
* @throws IllegalArgumentException if {@code name} is not a valid key
* in the environment map, or {@code value} is not valid.
*/
public void setEnvironment(String name, String value) {
if (name == null) {
throw new NullPointerException("name is null");
}
if (value == null) {
throw new NullPointerException("value is null");
}
if (environment.containsKey(name)) {
if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) {
if (value.length() == 0) {
throw new IllegalArgumentException("\"" +
name + "\" requires non-empty value.");
}
}
environment.put(name, value);
} else {
throw new IllegalArgumentException("\"" +
name + "\" is not an environment element.");
}
}
/**
* Returns all service tags in this registration data.
*
* @return a {@link Set Set} of the service tags
* in this registration data.
*/
public Set<ServiceTag> getServiceTags() {
return new HashSet<ServiceTag>(svcTagMap.values());
}
/**
* Adds a service tag to this registration data.
* If the given service tag has an empty <tt>instance_urn</tt>,
* this method will generate a URN and place it in the copy
* of the service tag in this registration data.
* This method will return the {@code ServiceTag} object
* added to this registration data.
*
* @param st {@code ServiceTag} object to be added.
* @return a {@code ServiceTag} object added to this registration data.
*
* @throws IllegalArgumentException if
* a service tag of the same {@link ServiceTag#getInstanceURN
* <tt>instance_urn</tt>} already exists in the registry.
*/
public synchronized ServiceTag addServiceTag(ServiceTag st) {
ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st);
String instanceURN = svcTag.getInstanceURN();
if (svcTagMap.containsKey(instanceURN)) {
throw new IllegalArgumentException("Instance_urn = " + instanceURN +
" already exists in the registration data.");
} else {
svcTagMap.put(instanceURN, svcTag);
}
return svcTag;
}
/**
* Returns a service tag of the given <tt>instance_urn</tt> in this registration
* data.
*
* @param instanceURN the <tt>instance_urn</tt> of the service tag
* @return the {@code ServiceTag} object of the given <tt>instance_urn</tt>
* if exists; otherwise return {@code null}.
*/
public synchronized ServiceTag getServiceTag(String instanceURN) {
if (instanceURN == null) {
throw new NullPointerException("instanceURN is null");
}
return svcTagMap.get(instanceURN);
}
/**
* Removes a service tag of the given <tt>instance_urn</tt> from this
* registration data.
*
* @param instanceURN the <tt>instance_urn</tt> of
* the service tag to be removed.
*
* @return the removed {@code ServiceTag} object;
* or {@code null} if the service tag does not exist in this
* registration data.
*/
public synchronized ServiceTag removeServiceTag(String instanceURN) {
if (instanceURN == null) {
throw new NullPointerException("instanceURN is null");
}
ServiceTag svcTag = null;
if (svcTagMap.containsKey(instanceURN)) {
svcTag = svcTagMap.remove(instanceURN);
}
return svcTag;
}
/**
* Updates the <tt>product_defined_instance_id</tt> in the service tag
* of the given <tt>instance_urn</tt> in this registration data.
*
* @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated.
* @param productDefinedInstanceID the value of the
* <tt>product_defined_instance_id</tt> to be set.
*
* @return the updated {@code ServiceTag} object;
* or {@code null} if the service tag does not exist in this
* registration data.
*/
public synchronized ServiceTag updateServiceTag(String instanceURN,
String productDefinedInstanceID) {
ServiceTag svcTag = getServiceTag(instanceURN);
if (svcTag == null) {
return null;
}
svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag);
// update the product defined instance ID field
svcTag.setProductDefinedInstanceID(productDefinedInstanceID);
svcTagMap.put(instanceURN, svcTag);
return svcTag;
}
/**
* Reads the registration data from the XML document on the
* specified input stream. The XML document must be
* in the format described by the <a href="#XMLSchema">
* registration data schema</a>.
* The specified stream is closed after this method returns.
*
* @param in the input stream from which to read the XML document.
* @return a {@code RegistrationData} object read from the input
* stream.
*
* @throws IllegalArgumentException if the input stream
* contains an invalid registration data.
*
* @throws IOException if an error occurred when reading from the input stream.
*/
public static RegistrationData loadFromXML(InputStream in) throws IOException {
try {
return RegistrationDocument.load(in);
} finally {
in.close();
}
}
/**
* Writes the registration data to the specified output stream
* in the format described by the <a href="#XMLSchema">
* registration data schema</a> with "UTF-8" encoding.
* The specified stream remains open after this method returns.
*
* @param os the output stream on which to write the XML document.
*
* @throws IOException if an error occurred when writing to the output stream.
*/
public void storeToXML(OutputStream os) throws IOException {
RegistrationDocument.store(os, this);
os.flush();
}
/**
* Returns a newly allocated byte array containing the registration
* data in XML format.
*
* @return a newly allocated byte array containing the registration
* data in XML format.
*/
public byte[] toXML() {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
storeToXML(out);
return out.toByteArray();
} catch (IOException e) {
// should not reach here
return new byte[0];
}
}
/**
* Returns a string representation of this registration data in XML
* format.
*
* @return a string representation of this registration data in XML
* format.
*/
@Override
public String toString() {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
storeToXML(out);
return out.toString("UTF-8");
} catch (IOException e) {
// should not reach here
return "Error creating the return string.";
}
}
}
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.servicetag;
import java.io.*;
import java.net.URL;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.xml.sax.InputSource;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
// For write operation
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
/**
* XML Support Class for Product Registration.
*/
class RegistrationDocument {
private static final String REGISTRATION_DATA_SCHEMA =
"/com/sun/servicetag/resources/product_registration.xsd";
private static final String REGISTRATION_DATA_VERSION = "1.0";
private static final String SERVICE_TAG_VERSION = "1.0";
final static String ST_NODE_REGISTRATION_DATA = "registration_data";
final static String ST_ATTR_REGISTRATION_VERSION = "version";
final static String ST_NODE_ENVIRONMENT = "environment";
final static String ST_NODE_HOSTNAME = "hostname";
final static String ST_NODE_HOST_ID = "hostId";
final static String ST_NODE_OS_NAME = "osName";
final static String ST_NODE_OS_VERSION = "osVersion";
final static String ST_NODE_OS_ARCH = "osArchitecture";
final static String ST_NODE_SYSTEM_MODEL = "systemModel";
final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer";
final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer";
final static String ST_NODE_SERIAL_NUMBER = "serialNumber";
final static String ST_NODE_REGISTRY = "registry";
final static String ST_ATTR_REGISTRY_URN = "urn";
final static String ST_ATTR_REGISTRY_VERSION = "version";
final static String ST_NODE_SERVICE_TAG = "service_tag";
final static String ST_NODE_INSTANCE_URN = "instance_urn";
final static String ST_NODE_PRODUCT_NAME = "product_name";
final static String ST_NODE_PRODUCT_VERSION = "product_version";
final static String ST_NODE_PRODUCT_URN = "product_urn";
final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn";
final static String ST_NODE_PRODUCT_PARENT = "product_parent";
final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id";
final static String ST_NODE_PRODUCT_VENDOR = "product_vendor";
final static String ST_NODE_PLATFORM_ARCH = "platform_arch";
final static String ST_NODE_TIMESTAMP = "timestamp";
final static String ST_NODE_CONTAINER = "container";
final static String ST_NODE_SOURCE = "source";
final static String ST_NODE_INSTALLER_UID = "installer_uid";
static RegistrationData load(InputStream in) throws IOException {
Document document = initializeDocument(in);
// Gets the registration URN
Element root = getRegistrationDataRoot(document);
Element registryRoot =
getSingletonElementFromRoot(root, ST_NODE_REGISTRY);
String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN);
// Construct a new RegistrationData object from the DOM tree
// Initialize the environment map and service tags
RegistrationData regData = new RegistrationData(urn);
addServiceTags(registryRoot, regData);
Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT);
buildEnvironmentMap(envRoot, regData);
return regData;
}
static void store(OutputStream os, RegistrationData registration)
throws IOException {
// create a new document with the root node
Document document = initializeDocument();
// create the nodes for the environment map and the service tags
// in the registration data
addEnvironmentNodes(document,
registration.getEnvironmentMap());
addServiceTagRegistry(document,
registration.getRegistrationURN(),
registration.getServiceTags());
transform(document, os);
}
// initialize a document from an input stream
private static Document initializeDocument(InputStream in) throws IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
// XML schema for validation
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA);
Schema schema = sf.newSchema(xsdUrl);
Validator validator = schema.newValidator();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(in));
validator.validate(new DOMSource(doc));
return doc;
} catch (SAXException sxe) {
IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing");
e.initCause(sxe);
throw e;
} catch (ParserConfigurationException pce) {
// Parser with specific options can't be built
// should not reach here
throw new InternalError("Error in creating the new document", pce);
}
}
// initialize a new document for the registration data
private static Document initializeDocument() throws IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
// initialize the document with the registration_data root
Element root = doc.createElement(ST_NODE_REGISTRATION_DATA);
doc.appendChild(root);
root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION);
return doc;
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
// should not reach here
throw new InternalError("Error in creating the new document", pce);
}
}
// Transform the current DOM tree with the given output stream.
private static void transform(Document document, OutputStream os) {
try {
// Use a Transformer for output
TransformerFactory tFactory = TransformerFactory.newInstance();
tFactory.setAttribute("indent-number", new Integer(3));
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
transformer.transform(new DOMSource(document),
new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8"))));
} catch (UnsupportedEncodingException ue) {
// Should not reach here
throw new InternalError("Error generated during transformation", ue);
} catch (TransformerConfigurationException tce) {
// Error generated by the parser
// Should not reach here
throw new InternalError("Error in creating the new document", tce);
} catch (TransformerException te) {
// Error generated by the transformer
throw new InternalError("Error generated during transformation", te);
}
}
private static void addServiceTagRegistry(Document document,
String registryURN,
Set<ServiceTag> svcTags) {
// add service tag registry node and its attributes
Element reg = document.createElement(ST_NODE_REGISTRY);
reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN);
reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION);
Element root = getRegistrationDataRoot(document);
root.appendChild(reg);
// adds the elements for the service tags
for (ServiceTag st : svcTags) {
addServiceTagElement(document, reg, st);
}
}
private static void addServiceTagElement(Document document,
Element registryRoot,
ServiceTag st) {
Element svcTag = document.createElement(ST_NODE_SERVICE_TAG);
registryRoot.appendChild(svcTag);
addChildElement(document, svcTag,
ST_NODE_INSTANCE_URN, st.getInstanceURN());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_NAME, st.getProductName());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_VERSION, st.getProductVersion());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_URN, st.getProductURN());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_PARENT, st.getProductParent());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_DEFINED_INST_ID,
st.getProductDefinedInstanceID());
addChildElement(document, svcTag,
ST_NODE_PRODUCT_VENDOR, st.getProductVendor());
addChildElement(document, svcTag,
ST_NODE_PLATFORM_ARCH, st.getPlatformArch());
addChildElement(document, svcTag,
ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp()));
addChildElement(document, svcTag,
ST_NODE_CONTAINER, st.getContainer());
addChildElement(document, svcTag,
ST_NODE_SOURCE, st.getSource());
addChildElement(document, svcTag,
ST_NODE_INSTALLER_UID,
String.valueOf(st.getInstallerUID()));
}
private static void addChildElement(Document document, Element root,
String element, String text) {
Element node = document.createElement(element);
node.appendChild(document.createTextNode(text));
root.appendChild(node);
}
// Constructs service tags from the document
private static void addServiceTags(Element registryRoot,
RegistrationData registration) {
NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG);
int length = (children == null ? 0 : children.getLength());
for (int i = 0; i < length; i++) {
Element svcTagElement = (Element) children.item(i);
ServiceTag st = getServiceTag(svcTagElement);
registration.addServiceTag(st);
}
}
// build environment map from the document
private static void buildEnvironmentMap(Element envRoot,
RegistrationData registration) {
registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME));
registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID));
registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME));
registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION));
registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH));
registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL));
registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER));
registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER));
registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER));
}
// add the nodes representing the environment map in the document
private static void addEnvironmentNodes(Document document,
Map<String, String> envMap) {
Element root = getRegistrationDataRoot(document);
Element env = document.createElement(ST_NODE_ENVIRONMENT);
root.appendChild(env);
Set<Map.Entry<String, String>> keys = envMap.entrySet();
for (Map.Entry<String, String> entry : keys) {
addChildElement(document, env, entry.getKey(), entry.getValue());
}
}
private static Element getRegistrationDataRoot(Document doc) {
Element root = doc.getDocumentElement();
if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) {
throw new IllegalArgumentException("Not a " +
ST_NODE_REGISTRATION_DATA +
" node \"" + root.getNodeName() + "\"");
}
return root;
}
private static Element getSingletonElementFromRoot(Element root, String name) {
NodeList children = root.getElementsByTagName(name);
int length = (children == null ? 0 : children.getLength());
if (length != 1) {
throw new IllegalArgumentException("Invalid number of " + name +
" nodes = " + length);
}
Element e = (Element) children.item(0);
if (!e.getNodeName().equals(name)) {
throw new IllegalArgumentException("Not a " + name +
" node \"" + e.getNodeName() + "\"");
}
return e;
}
// Constructs one ServiceTag instance from a service tag element root
private static ServiceTag getServiceTag(Element svcTagElement) {
return new ServiceTag(
getTextValue(svcTagElement, ST_NODE_INSTANCE_URN),
getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME),
getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION),
getTextValue(svcTagElement, ST_NODE_PRODUCT_URN),
getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT),
getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN),
getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID),
getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR),
getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH),
getTextValue(svcTagElement, ST_NODE_CONTAINER),
getTextValue(svcTagElement, ST_NODE_SOURCE),
Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)),
Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP))
);
}
private static String getTextValue(Element e, String tagName) {
String value = "";
NodeList nl = e.getElementsByTagName(tagName);
if (nl != null && nl.getLength() > 0) {
Element el = (Element) nl.item(0);
Node node = el.getFirstChild();
if (node != null) {
value = node.getNodeValue();
}
}
return value;
}
}
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.servicetag;
// This class is a copy of the com.sun.scn.servicetags.SolarisSystemEnvironment
// class from the Sun Connection source.
//
// The Service Tags team maintains the latest version of the implementation
// for system environment data collection. JDK will include a copy of
// the most recent released version for a JDK release. We rename
// the package to com.sun.servicetag so that the Sun Connection
// product always uses the latest version from the com.sun.scn.servicetags
// package. JDK and users of the com.sun.servicetag API
// (e.g. NetBeans and SunStudio) will use the version in JDK.
//
// So we keep this class in src/share/classes instead of src/<os>/classes.
import java.io.*;
/**
* Solaris implementation of the SystemEnvironment class.
*/
class SolarisSystemEnvironment extends SystemEnvironment {
private static final String ORACLE = "Oracle Corporation";
SolarisSystemEnvironment() {
setHostId(getCommandOutput("/usr/bin/hostid"));
setSystemModel(getCommandOutput("/usr/bin/uname", "-i"));
setSystemManufacturer(getSolarisSystemManufacturer());
setCpuManufacturer(getSolarisCpuManufacturer());
setSerialNumber(getSolarisSN());
}
/**
* Tries to obtain the cpu manufacturer.
* @return The cpu manufacturer (an empty string if not found or an error occurred)
*/
private String getSolarisCpuManufacturer() {
// not fully accurate, this could be another manufacturer (fujitsu for example)
if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) {
return ORACLE;
}
// if we're here, then we'll try smbios (type 4)
return getSmbiosData("4", "Manufacturer: ");
}
/**
* Tries to obtain the system manufacturer.
* @return The system manufacturer (an empty string if not found or an error occurred)
*/
private String getSolarisSystemManufacturer() {
// not fully accurate, this could be another manufacturer (fujitsu for example)
if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) {
return ORACLE;
}
// if we're here, then we'll try smbios (type 1)
return getSmbiosData("1", "Manufacturer: ");
}
/**
* Tries to obtain the serial number.
* @return The serial number (empty string if not found or an error occurred)
*/
private String getSolarisSN() {
// try to read from the psn file if it exists
String tmp = getFileContent("/var/run/psn");
if (tmp.length() > 0) {
return tmp.trim();
}
// if we're here, then we'll try sneep
String tmpSN = getSneepSN();
if (tmpSN.length() > 0) {
return tmpSN;
}
// if we're here, then we'll try smbios (type 1)
tmpSN = getSmbiosData("1", "Serial Number: ");
if (tmpSN.length() > 0) {
return tmpSN;
}
// if we're here, then we'll try smbios (type 3)
tmpSN = getSmbiosData("3", "Serial Number: ");
if (tmpSN.length() > 0) {
return tmpSN;
}
// give up and return
return "";
}
// Sample smbios output segment:
// ID SIZE TYPE
// 1 150 SMB_TYPE_SYSTEM (system information)
//
// Manufacturer: Oracle Corporation
// Product: Sun Fire X4600
// Version: To Be Filled By O.E.M.
// Serial Number: 00:14:4F:45:0C:2A
private String getSmbiosData(String type, String target) {
String output = getCommandOutput("/usr/sbin/smbios", "-t", type);
for (String s : output.split("\n")) {
if (s.contains(target)) {
int indx = s.indexOf(target) + target.length();
if (indx < s.length()) {
String tmp = s.substring(indx).trim();
String lowerCaseStr = tmp.toLowerCase();
if (!lowerCaseStr.startsWith("not available")
&& !lowerCaseStr.startsWith("to be filled by o.e.m")) {
return tmp;
}
}
}
}
return "";
}
private String getSneepSN() {
String basedir = getCommandOutput("pkgparam","SUNWsneep","BASEDIR");
File f = new File(basedir + "/bin/sneep");
if (f.exists()) {
String sneepSN = getCommandOutput(basedir + "/bin/sneep");
if (sneepSN.equalsIgnoreCase("unknown")) {
return "";
} else {
return sneepSN;
}
} else {
return "";
}
}
}
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.servicetag;
// This class is a copy of the com.sun.scn.servicetags.WindowsSystemEnvironment
// class from the Sun Connection source.
//
// The Service Tags team maintains the latest version of the implementation
// for system environment data collection. JDK will include a copy of
// the most recent released version for a JDK release. We rename
// the package to com.sun.servicetag so that the Sun Connection
// product always uses the latest version from the com.sun.scn.servicetags
// package. JDK and users of the com.sun.servicetag API
// (e.g. NetBeans and SunStudio) will use the version in JDK.
//
// So we keep this class in src/share/classes instead of src/<os>/classes.
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* Windows implementation of the SystemEnvironment class.
*/
class WindowsSystemEnvironment extends SystemEnvironment {
WindowsSystemEnvironment() {
super();
// run a call to make sure things are initialized
// ignore the first call result as the system may
// give inconsistent data on the first invocation ever
getWmicResult("computersystem", "get", "model");
setSystemModel(getWmicResult("computersystem", "get", "model"));
setSystemManufacturer(getWmicResult("computersystem", "get", "manufacturer"));
setSerialNumber(getWmicResult("bios", "get", "serialnumber"));
String cpuMfr = getWmicResult("cpu", "get", "manufacturer");
// this isn't as good an option, but if we couldn't get anything
// from wmic, try the processor_identifier
if (cpuMfr.length() == 0) {
String procId = System.getenv("processor_identifer");
if (procId != null) {
String[] s = procId.split(",");
cpuMfr = s[s.length - 1].trim();
}
}
setCpuManufacturer(cpuMfr);
// try to remove the temp file that gets created from running wmic cmds
try {
// look in the current working directory
File f = new File("TempWmicBatchFile.bat");
if (f.exists()) {
f.delete();
}
} catch (Exception e) {
// ignore the exception
}
}
/**
* This method invokes wmic outside of the normal environment
* collection routines.
*
* An initial call to wmic can be costly in terms of time.
*
* <code>
* Details of why the first call is costly can be found at:
*
* http://support.microsoft.com/kb/290216/en-us
*
* "When you run the Wmic.exe utility for the first time, the utility
* compiles its .mof files into the repository. To save time during
* Windows installation, this operation takes place as necessary."
* </code>
*/
private String getWmicResult(String alias, String verb, String property) {
String res = "";
BufferedReader in = null;
try {
ProcessBuilder pb = new ProcessBuilder("cmd", "/C", "WMIC", alias, verb, property);
Process p = pb.start();
// need this for executing windows commands (at least
// needed for executing wmic command)
BufferedWriter bw = null;
try {
bw = new BufferedWriter(
new OutputStreamWriter(p.getOutputStream()));
bw.write(13);
bw.flush();
} finally {
if (bw != null) {
bw.close();
}
}
p.waitFor();
if (p.exitValue() == 0) {
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
line = line.trim();
if (line.length() == 0) {
continue;
}
res = line;
}
// return the *last* line read
return res;
}
} catch (Exception e) {
// ignore the exception
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// ignore
}
}
}
return res.trim();
}
}
README for auto-generating of the offline registration page.
1. register.html is defined by the xDesign team.
2. Before putback in the workspace, we need to modify the
register.html to contain the following:
(a) replace the pathname of the jdk_header.png image to
<img src="@@JDK_HEADER_PNG@@" ....>
(b) replace the product name from:
Java Development Kit Version 6 Update 5 (e.g.)
to:
Java Development Kit @@JDK_VERSION@@
(c) replace the form action for the "Register My JDK" button with:
<form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
(d) Add this input in the form for posting data after
the <form name=....> line:
<input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
3. The jdk_header.png is located under <JRE>/lib/servicetag directory.
......@@ -52,7 +52,8 @@ class DirectMethodHandle extends MethodHandle {
super(mtype, form);
if (!member.isResolved()) throw new InternalError();
if (member.getDeclaringClass().isInterface() && !member.isAbstract()) {
if (member.getDeclaringClass().isInterface() &&
member.isMethod() && !member.isAbstract()) {
// Check for corner case: invokeinterface of Object method
MemberName m = new MemberName(Object.class, member.getName(), member.getMethodType(), member.getReferenceKind());
m = MemberName.getFactory().resolveOrNull(m.getReferenceKind(), m, null);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -57,6 +57,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI
*/
@Override
protected void installDefaults() {
super.installDefaults();
trackHighlight = NO_HIGHLIGHT;
if (scrollbar.getLayout() == null ||
(scrollbar.getLayout() instanceof UIResource)) {
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册