/* * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.org.apache.xalan.internal; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; /** * Commonly used constants. * * @author Huizhe Wang, Oracle * * @version $Id: Constants.java,v 1.14 2011-06-07 04:39:40 joehw Exp $ */ public final class XalanConstants { // // Constants // // Oracle Feature: /** * <p>Use Service Mechanism</p> * * <ul> * <li> * {@code true} instruct an object to use service mechanism to * find a service implementation. This is the default behavior. * </li> * <li> * {@code false} instruct an object to skip service mechanism and * use the default implementation for that service. * </li> * </ul> */ public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism"; /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */ public static final String ORACLE_JAXP_PROPERTY_PREFIX = "http://www.oracle.com/xml/jaxp/properties/"; //System Properties corresponding to ACCESS_EXTERNAL_* properties public static final String SP_ACCESS_EXTERNAL_STYLESHEET = "javax.xml.accessExternalStylesheet"; public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; //all access keyword public static final String ACCESS_EXTERNAL_ALL = "all"; /** * Default value when FEATURE_SECURE_PROCESSING (FSP) is set to true */ public static final String EXTERNAL_ACCESS_DEFAULT_FSP = ""; /** * FEATURE_SECURE_PROCESSING (FSP) is false by default */ public static final String EXTERNAL_ACCESS_DEFAULT = ACCESS_EXTERNAL_ALL; public static final String XML_SECURITY_PROPERTY_MANAGER = ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; /** * Check if we're in jdk8 or above */ public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8); /* * Check the version of the current JDK against that specified in the * parameter * * There is a proposal to change the java version string to: * MAJOR.MINOR.FU.CPU.PSU-BUILDNUMBER_BUGIDNUMBER_OPTIONAL * This method would work with both the current format and that proposed * * @param compareTo a JDK version to be compared to * @return true if the current version is the same or above that represented * by the parameter */ public static boolean isJavaVersionAtLeast(int compareTo) { String javaVersion = SecuritySupport.getSystemProperty("java.version"); String versions[] = javaVersion.split("\\.", 3); if (Integer.parseInt(versions[0]) >= compareTo || Integer.parseInt(versions[1]) >= compareTo) { return true; } return false; } } // class Constants