src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java
author hb
Tue, 29 Aug 2017 13:34:15 +0530
branchjmx-rest-api
changeset 55985 0c5a02edfdef
child 55994 9721e36abeb0
permissions -rw-r--r--
REST Adapter Initial commit 1. Unit tested and working GET/POST interfaces 2. Unit tested and working JSON parser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55985
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     1
/*
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     2
 * To change this license header, choose License Headers in Project Properties.
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     3
 * To change this template file, choose Tools | Templates
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     4
 * and open the template in the editor.
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     5
 */
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     6
package javax.management.remote.rest;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     7
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     8
import com.sun.net.httpserver.HttpServer;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
     9
import com.sun.net.httpserver.HttpsConfigurator;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    10
import com.sun.net.httpserver.HttpsServer;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    11
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    12
import javax.management.MBeanServer;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    13
import javax.net.ssl.KeyManagerFactory;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    14
import javax.net.ssl.SSLContext;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    15
import javax.net.ssl.TrustManagerFactory;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    16
import java.io.BufferedInputStream;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    17
import java.io.FileInputStream;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    18
import java.io.IOException;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    19
import java.lang.management.ManagementFactory;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    20
import java.net.InetSocketAddress;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    21
import java.security.KeyStore;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    22
import java.util.*;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    23
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    24
/**
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    25
 * @author harsha
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    26
 */
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    27
public class PlatformRestAdapter {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    28
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    29
    private static final Set<String> contextList = new HashSet<>();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    30
    /*
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    31
     * Initializes HTTPServer with settings from config file
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    32
     * acts as container for platform rest adapter
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    33
     */
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    34
    private static HttpServer httpServer = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    35
    private static JmxRestAdapter instance = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    36
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    37
    private PlatformRestAdapter() {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    38
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    39
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    40
    public static synchronized void init(String portStr, Properties props) throws IOException {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    41
        if (instance == null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    42
            final int port;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    43
            try {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    44
                port = Integer.parseInt(portStr);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    45
            } catch (NumberFormatException x) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    46
                throw new IllegalArgumentException("Invalid string for port");
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    47
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    48
            if (port < 0) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    49
                throw new IllegalArgumentException("Invalid string for port");
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    50
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    51
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    52
            boolean useSSL = Boolean.parseBoolean((String) props.get("com.sun.management.jmxremote.ssl"));
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    53
            if (useSSL) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    54
                final String sslConfigFileName
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    55
                        = props.getProperty(PropertyNames.SSL_CONFIG_FILE_NAME);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    56
                SSLContext ctx = getSSlContext(sslConfigFileName);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    57
                if (ctx != null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    58
                    HttpsServer server = HttpsServer.create(new InetSocketAddress(port), 0);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    59
                    server.setHttpsConfigurator(new HttpsConfigurator(ctx));
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    60
                    httpServer = server;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    61
                } else {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    62
                    httpServer = HttpServer.create(new InetSocketAddress(port), 0);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    63
                }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    64
            } else {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    65
                httpServer = HttpServer.create(new InetSocketAddress(port), 0);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    66
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    67
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    68
            // Initialize rest adapter
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    69
            Map<String, Object> env = new HashMap<>();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    70
            // Do we use authentication?
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    71
            final String useAuthenticationStr
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    72
                    = props.getProperty(PropertyNames.USE_AUTHENTICATION,
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    73
                            DefaultValues.USE_AUTHENTICATION);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    74
            final boolean useAuthentication
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    75
                    = Boolean.valueOf(useAuthenticationStr);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    76
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    77
            String loginConfigName;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    78
            String passwordFileName;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    79
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    80
            if (useAuthentication) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    81
                env.put("jmx.remote.x.authentication", Boolean.TRUE);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    82
                // Get non-default login configuration
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    83
                loginConfigName
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    84
                        = props.getProperty(PropertyNames.LOGIN_CONFIG_NAME);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    85
                env.put("jmx.remote.x.login.config", loginConfigName);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    86
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    87
                if (loginConfigName == null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    88
                    // Get password file
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    89
                    passwordFileName
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    90
                            = props.getProperty(PropertyNames.PASSWORD_FILE_NAME);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    91
                    env.put("jmx.remote.x.password.file", passwordFileName);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    92
                }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    93
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    94
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    95
            instance = new JmxRestAdapterImpl(httpServer, "default", env, ManagementFactory.getPlatformMBeanServer());
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    96
            httpServer.start();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    97
        }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    98
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
    99
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   100
    public static void stop() {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   101
        if (instance != null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   102
            instance.stop();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   103
            instance = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   104
        }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   105
        if (httpServer != null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   106
            httpServer.stop(0);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   107
            httpServer = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   108
        }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   109
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   110
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   111
    private static SSLContext getSSlContext(String sslConfigFileName) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   112
        final String keyStore, keyStorePassword, trustStore, trustStorePassword;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   113
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   114
        try {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   115
            if (sslConfigFileName == null || sslConfigFileName.isEmpty()) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   116
                keyStore = System.getProperty(PropertyNames.SSL_KEYSTORE_FILE);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   117
                keyStorePassword = System.getProperty(PropertyNames.SSL_KEYSTORE_PASSWORD);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   118
                trustStore = System.getProperty(PropertyNames.SSL_TRUSTSTORE_FILE);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   119
                trustStorePassword = System.getProperty(PropertyNames.SSL_TRUSTSTORE_PASSWORD);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   120
            } else {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   121
                Properties p = new Properties();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   122
                BufferedInputStream bin = new BufferedInputStream(new FileInputStream(sslConfigFileName));
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   123
                p.load(bin);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   124
                keyStore = p.getProperty(PropertyNames.SSL_KEYSTORE_FILE);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   125
                keyStorePassword = p.getProperty(PropertyNames.SSL_KEYSTORE_PASSWORD);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   126
                trustStore = p.getProperty(PropertyNames.SSL_TRUSTSTORE_FILE);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   127
                trustStorePassword = p.getProperty(PropertyNames.SSL_TRUSTSTORE_PASSWORD);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   128
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   129
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   130
            char[] keyStorePasswd = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   131
            if (keyStorePassword.length() != 0) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   132
                keyStorePasswd = keyStorePassword.toCharArray();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   133
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   134
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   135
            char[] trustStorePasswd = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   136
            if (trustStorePassword.length() != 0) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   137
                trustStorePasswd = trustStorePassword.toCharArray();
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   138
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   139
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   140
            KeyStore ks = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   141
            if (keyStore != null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   142
                ks = KeyStore.getInstance(KeyStore.getDefaultType());
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   143
                FileInputStream ksfis = new FileInputStream(keyStore);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   144
                ks.load(ksfis, keyStorePasswd);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   145
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   146
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   147
            KeyManagerFactory kmf = KeyManagerFactory.getInstance(
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   148
                    KeyManagerFactory.getDefaultAlgorithm());
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   149
            kmf.init(ks, keyStorePasswd);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   150
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   151
            KeyStore ts = null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   152
            if (trustStore != null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   153
                ts = KeyStore.getInstance(KeyStore.getDefaultType());
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   154
                FileInputStream tsfis = new FileInputStream(trustStore);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   155
                ts.load(tsfis, trustStorePasswd);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   156
            }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   157
            TrustManagerFactory tmf = TrustManagerFactory.getInstance(
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   158
                    TrustManagerFactory.getDefaultAlgorithm());
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   159
            tmf.init(ts);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   160
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   161
            SSLContext ctx = SSLContext.getInstance("SSL");
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   162
            ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   163
            return ctx;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   164
        } catch (Exception ex) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   165
        }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   166
        return null;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   167
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   168
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   169
    public static JmxRestAdapter getInstance() {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   170
        if (instance == null) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   171
            throw new IllegalStateException("PlatformRestAdapter not initialized");
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   172
        }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   173
        return instance;
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   174
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   175
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   176
    public static synchronized JmxRestAdapter newRestAdapter(String context, Map<String, ?> env, MBeanServer mbeanServer) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   177
        if (!contextList.contains(context)) {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   178
            contextList.add(context);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   179
            return new JmxRestAdapterImpl(httpServer, context, env, mbeanServer);
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   180
        }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   181
        throw new IllegalArgumentException(context + " is already taken");
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   182
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   183
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   184
    /**
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   185
     * Default values for JMX configuration properties.
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   186
     */
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   187
    public static interface DefaultValues {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   188
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   189
        public static final String PORT = "0";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   190
        public static final String CONFIG_FILE_NAME = "management.properties";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   191
        public static final String USE_SSL = "true";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   192
        public static final String USE_LOCAL_ONLY = "true";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   193
        public static final String USE_REGISTRY_SSL = "false";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   194
        public static final String USE_AUTHENTICATION = "true";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   195
        public static final String PASSWORD_FILE_NAME = "jmxremote.password";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   196
        public static final String ACCESS_FILE_NAME = "jmxremote.access";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   197
        public static final String SSL_NEED_CLIENT_AUTH = "false";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   198
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   199
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   200
    /**
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   201
     * Names of JMX configuration properties.
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   202
     */
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   203
    public static interface PropertyNames {
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   204
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   205
        public static final String PORT
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   206
                = "com.sun.management.jmxremote.rest.port";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   207
        public static final String HOST
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   208
                = "com.sun.management.jmxremote.host";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   209
        public static final String USE_SSL
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   210
                = "com.sun.management.jmxremote.ssl";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   211
        public static final String USE_AUTHENTICATION
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   212
                = "com.sun.management.jmxremote.authenticate";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   213
        public static final String PASSWORD_FILE_NAME
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   214
                = "com.sun.management.jmxremote.password.file";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   215
        public static final String LOGIN_CONFIG_NAME
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   216
                = "com.sun.management.jmxremote.login.config";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   217
        public static final String SSL_NEED_CLIENT_AUTH
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   218
                = "com.sun.management.jmxremote.ssl.need.client.auth";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   219
        public static final String SSL_CONFIG_FILE_NAME
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   220
                = "com.sun.management.jmxremote.ssl.config.file";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   221
        public static final String SSL_KEYSTORE_FILE
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   222
                = "javax.net.ssl.keyStore";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   223
        public static final String SSL_TRUSTSTORE_FILE
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   224
                = "javax.net.ssl.trustStore";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   225
        public static final String SSL_KEYSTORE_PASSWORD
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   226
                = "javax.net.ssl.keyStorePassword";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   227
        public static final String SSL_TRUSTSTORE_PASSWORD
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   228
                = "javax.net.ssl.trustStorePassword";
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   229
    }
0c5a02edfdef REST Adapter Initial commit
hb
parents:
diff changeset
   230
}