feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
245
jdkSrc/jdk8/com/sun/jmx/snmp/defaults/DefaultPaths.java
Normal file
245
jdkSrc/jdk8/com/sun/jmx/snmp/defaults/DefaultPaths.java
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.jmx.snmp.defaults;
|
||||
|
||||
|
||||
// java import
|
||||
//
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* This class represents a set of default directories used by Java DMK.
|
||||
*
|
||||
* <p><b>This API is a Sun Microsystems internal API and is subject
|
||||
* to change without notice.</b></p>
|
||||
* @since 1.5
|
||||
*/
|
||||
public class DefaultPaths {
|
||||
private static final String INSTALL_PATH_RESOURCE_NAME = "com/sun/jdmk/defaults/install.path";
|
||||
// private constructor defined to "hide" the default public constructor
|
||||
private DefaultPaths() {
|
||||
|
||||
}
|
||||
|
||||
// PUBLIC STATIC METHODS
|
||||
//----------------------
|
||||
|
||||
/**
|
||||
* Returns the installation directory for Java DMK.
|
||||
*
|
||||
* The default value of the installation directory is:
|
||||
* <CODE><base_dir> + File.separator + SUNWjdmk + File.separator + jdmk5.0 </CODE>
|
||||
*
|
||||
* @return Java DMK installation directory.
|
||||
*/
|
||||
public static String getInstallDir() {
|
||||
if (installDir == null)
|
||||
return useRessourceFile();
|
||||
else
|
||||
return installDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the installation directory for Java DMK concatenated with dirname.
|
||||
*
|
||||
* The default value of the installation directory is:
|
||||
* <CODE><base_dir> + File.separator + SUNWjdmk + File.separator + jdmk5.0 </CODE>
|
||||
*
|
||||
* @param dirname The directory to be appended.
|
||||
*
|
||||
* @return Java DMK installation directory + <CODE>File.separator</CODE> + <CODE>dirname</CODE>.
|
||||
*/
|
||||
public static String getInstallDir(String dirname) {
|
||||
if (installDir == null) {
|
||||
if (dirname == null) {
|
||||
return getInstallDir();
|
||||
} else {
|
||||
return getInstallDir() + File.separator + dirname;
|
||||
}
|
||||
} else {
|
||||
if (dirname == null) {
|
||||
return installDir;
|
||||
} else {
|
||||
return installDir + File.separator + dirname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the installation directory for Java DMK.
|
||||
*
|
||||
* @param dirname The directory where Java DMK resides.
|
||||
*/
|
||||
public static void setInstallDir(String dirname) {
|
||||
installDir = dirname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <CODE>etc</CODE> directory for Java DMK.
|
||||
* <P>
|
||||
* The default value of the <CODE>etc</CODE> directory is:
|
||||
* <UL>
|
||||
* <LI><CODE>DefaultPaths.getInstallDir("etc")</CODE>.
|
||||
* </UL>
|
||||
*
|
||||
* @return Java DMK <CODE>etc</CODE> directory.
|
||||
*/
|
||||
public static String getEtcDir() {
|
||||
if (etcDir == null)
|
||||
return getInstallDir("etc");
|
||||
else
|
||||
return etcDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <CODE>etc</CODE> directory for Java DMK concatenated with dirname.
|
||||
* <P>
|
||||
* The default value of the <CODE>etc</CODE> directory is:
|
||||
* <UL>
|
||||
* <LI><CODE>DefaultPaths.getInstallDir("etc")</CODE>.
|
||||
* </UL>
|
||||
*
|
||||
* @param dirname The directory to be appended.
|
||||
*
|
||||
* @return Java DMK <CODE>etc</CODE> directory + <CODE>File.separator</CODE> + <CODE>dirname</CODE>.
|
||||
*/
|
||||
public static String getEtcDir(String dirname) {
|
||||
if (etcDir == null) {
|
||||
if (dirname == null) {
|
||||
return getEtcDir();
|
||||
} else {
|
||||
return getEtcDir() + File.separator + dirname;
|
||||
}
|
||||
} else {
|
||||
if (dirname == null) {
|
||||
return etcDir;
|
||||
} else {
|
||||
return etcDir + File.separator + dirname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <CODE>etc</CODE> directory for Java DMK.
|
||||
*
|
||||
* @param dirname The <CODE>etc</CODE> directory for Java DMK.
|
||||
*/
|
||||
public static void setEtcDir(String dirname) {
|
||||
etcDir = dirname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <CODE>tmp</CODE> directory for the product.
|
||||
* <P>
|
||||
* The default value of the <CODE>tmp</CODE> directory is:
|
||||
* <UL>
|
||||
* <LI><CODE>DefaultPaths.getInstallDir("tmp")</CODE>.
|
||||
* </UL>
|
||||
*
|
||||
* @return Java DMK <CODE>tmp</CODE> directory.
|
||||
*/
|
||||
public static String getTmpDir() {
|
||||
if (tmpDir == null)
|
||||
return getInstallDir("tmp");
|
||||
else
|
||||
return tmpDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <CODE>tmp</CODE> directory for Java DMK concatenated with dirname.
|
||||
* <P>
|
||||
* The default value of the <CODE>tmp</CODE> directory is:
|
||||
* <UL>
|
||||
* <LI><CODE>DefaultPaths.getInstallDir("tmp")</CODE>.
|
||||
* </UL>
|
||||
*
|
||||
* @param dirname The directory to be appended.
|
||||
*
|
||||
* @return Java DMK <CODE>tmp</CODE> directory + <CODE>File.separator</CODE> + <CODE>dirname</CODE>.
|
||||
*/
|
||||
public static String getTmpDir(String dirname) {
|
||||
if (tmpDir == null) {
|
||||
if (dirname == null) {
|
||||
return getTmpDir();
|
||||
} else {
|
||||
return getTmpDir() + File.separator + dirname;
|
||||
}
|
||||
} else {
|
||||
if (dirname == null) {
|
||||
return tmpDir;
|
||||
} else {
|
||||
return tmpDir + File.separator + dirname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <CODE>tmp</CODE> directory for the product
|
||||
*
|
||||
* @param dirname The <CODE>tmp</CODE> directory for Java DMK.
|
||||
*/
|
||||
public static void setTmpDir(String dirname) {
|
||||
tmpDir = dirname;
|
||||
}
|
||||
|
||||
|
||||
// PRIVATE STATIC METHODS
|
||||
//-----------------------
|
||||
|
||||
private static String useRessourceFile() {
|
||||
InputStream in = null;
|
||||
BufferedReader r = null;
|
||||
try {
|
||||
in =
|
||||
DefaultPaths.class.getClassLoader().getResourceAsStream(INSTALL_PATH_RESOURCE_NAME);
|
||||
if(in == null) return null;
|
||||
r = new BufferedReader(new InputStreamReader(in));
|
||||
installDir = r.readLine();
|
||||
}catch(Exception e) {
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if(in != null) in.close();
|
||||
if(r != null) r.close();
|
||||
}catch(Exception e) {}
|
||||
}
|
||||
return installDir;
|
||||
}
|
||||
|
||||
// PRIVATE VARIABLES
|
||||
//------------------
|
||||
|
||||
/**
|
||||
* Directories used by Java DMK.
|
||||
*/
|
||||
private static String etcDir;
|
||||
private static String tmpDir;
|
||||
private static String installDir;
|
||||
}
|
||||
178
jdkSrc/jdk8/com/sun/jmx/snmp/defaults/SnmpProperties.java
Normal file
178
jdkSrc/jdk8/com/sun/jmx/snmp/defaults/SnmpProperties.java
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, 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.jmx.snmp.defaults;
|
||||
|
||||
// java import
|
||||
//
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* This class reads a file containing the property list defined for Java DMK
|
||||
* and adds all the read properties to the list of system properties.
|
||||
*
|
||||
* <p><b>This API is a Sun Microsystems internal API and is subject
|
||||
* to change without notice.</b></p>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public class SnmpProperties {
|
||||
|
||||
// private constructor defined to "hide" the default public constructor
|
||||
private SnmpProperties() {
|
||||
}
|
||||
|
||||
// PUBLIC STATIC METHODS
|
||||
//----------------------
|
||||
|
||||
/**
|
||||
* Reads the Java DMK property list from a file and
|
||||
* adds the read properties as system properties.
|
||||
*/
|
||||
public static void load(String file) throws IOException {
|
||||
Properties props = new Properties();
|
||||
InputStream is = new FileInputStream(file);
|
||||
props.load(is);
|
||||
is.close();
|
||||
for (final Enumeration<?> e = props.keys(); e.hasMoreElements() ; ) {
|
||||
final String key = (String) e.nextElement();
|
||||
System.setProperty(key,props.getProperty(key));
|
||||
}
|
||||
}
|
||||
|
||||
// PUBLIC STATIC VARIABLES
|
||||
//------------------------
|
||||
|
||||
/**
|
||||
* References the property that specifies the directory where
|
||||
* the native libraries will be stored before the MLet Service
|
||||
* loads them into memory.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.mlet.library.dir</B>
|
||||
*/
|
||||
public static final String MLET_LIB_DIR = "jmx.mlet.library.dir";
|
||||
|
||||
/**
|
||||
* References the property that specifies the ACL file
|
||||
* used by the SNMP protocol adaptor.
|
||||
* <p>
|
||||
* Property Name: <B>jdmk.acl.file</B>
|
||||
*/
|
||||
public static final String ACL_FILE = "jdmk.acl.file";
|
||||
|
||||
/**
|
||||
* References the property that specifies the Security file
|
||||
* used by the SNMP protocol adaptor.
|
||||
* <p>
|
||||
* Property Name: <B>jdmk.security.file</B>
|
||||
*/
|
||||
public static final String SECURITY_FILE = "jdmk.security.file";
|
||||
|
||||
/**
|
||||
* References the property that specifies the User ACL file
|
||||
* used by the SNMP protocol adaptor.
|
||||
* <p>
|
||||
* Property Name: <B>jdmk.uacl.file</B>
|
||||
*/
|
||||
public static final String UACL_FILE = "jdmk.uacl.file";
|
||||
|
||||
/**
|
||||
* References the property that specifies the default mib_core file
|
||||
* used by the mibgen compiler.
|
||||
* <p>
|
||||
* Property Name: <B>mibcore.file</B>
|
||||
*/
|
||||
public static final String MIB_CORE_FILE = "mibcore.file";
|
||||
|
||||
/**
|
||||
* References the property that specifies the full name of the JMX
|
||||
* specification implemented by this product.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.specification.name</B>
|
||||
*/
|
||||
public static final String JMX_SPEC_NAME = "jmx.specification.name";
|
||||
|
||||
/**
|
||||
* References the property that specifies the version of the JMX
|
||||
* specification implemented by this product.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.specification.version</B>
|
||||
*/
|
||||
public static final String JMX_SPEC_VERSION = "jmx.specification.version";
|
||||
|
||||
/**
|
||||
* References the property that specifies the vendor of the JMX
|
||||
* specification implemented by this product.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.specification.vendor</B>
|
||||
*/
|
||||
public static final String JMX_SPEC_VENDOR = "jmx.specification.vendor";
|
||||
|
||||
/**
|
||||
* References the property that specifies the full name of this product
|
||||
* implementing the JMX specification.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.implementation.name</B>
|
||||
*/
|
||||
public static final String JMX_IMPL_NAME = "jmx.implementation.name";
|
||||
|
||||
/**
|
||||
* References the property that specifies the name of the vendor of this product
|
||||
* implementing the JMX specification.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.implementation.vendor</B>
|
||||
*/
|
||||
public static final String JMX_IMPL_VENDOR = "jmx.implementation.vendor";
|
||||
|
||||
/**
|
||||
* References the property that specifies the version of this product
|
||||
* implementing the JMX specification.
|
||||
* <p>
|
||||
* Property Name: <B>jmx.implementation.version</B>
|
||||
*/
|
||||
public static final String JMX_IMPL_VERSION = "jmx.implementation.version";
|
||||
|
||||
/**
|
||||
* References the property that specifies the SSL cipher suites to
|
||||
* be enabled by the HTTP/SSL connector.
|
||||
* <p>
|
||||
* Property Name: <B>jdmk.ssl.cipher.suite.</B>
|
||||
* <p>
|
||||
* The list of SSL cipher suites is specified in the format:
|
||||
* <p>
|
||||
* <DD><B>jdmk.ssl.cipher.suite.</B><n><B>=</B><cipher suite name></DD>
|
||||
* <p>
|
||||
* For example:
|
||||
* <p>
|
||||
* <DD>jdmk.ssl.cipher.suite.1=SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</DD>
|
||||
* <DD>jdmk.ssl.cipher.suite.2=SSL_RSA_EXPORT_WITH_RC4_40_MD5</DD>
|
||||
* <DD>. . .</DD>
|
||||
*/
|
||||
public static final String SSL_CIPHER_SUITE = "jdmk.ssl.cipher.suite.";
|
||||
}
|
||||
Reference in New Issue
Block a user