if (getProtocolProviderPackages() != null && getProtocolProviderPackages().contains("weblogic")) { ImmutableMap.Builder<String, String> environment = ImmutableMap.builder(); if ((username != null) && (password != null)) { environment.put(PROTOCOL_PROVIDER_PACKAGES, getProtocolProviderPackages()); environment.put(SECURITY_PRINCIPAL, username); environment.put(SECURITY_CREDENTIALS, password);
/** * Helper method for connecting to a Server. You need to close the resulting * connection. */ public static JMXConnector getServerConnection(Server server) throws Exception { JMXServiceURL url = new JMXServiceURL(server.getUrl()); if (server.getProtocolProviderPackages() != null && server.getProtocolProviderPackages().contains("weblogic")) return JMXConnectorFactory.connect(url, getWebLogicEnvironment(server)); else return JMXConnectorFactory.connect(url, getEnvironment(server)); }
/** * Generates the proper username/password environment for JMX connections. */ public static Map<String, String> getWebLogicEnvironment(Server server) { Map<String, String> environment = new HashMap<String, String>(); String username = server.getUsername(); String password = server.getPassword(); if ((username != null) && (password != null)) { environment.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, server.getProtocolProviderPackages()); environment.put(Context.SECURITY_PRINCIPAL, username); environment.put(Context.SECURITY_CREDENTIALS, password); } return environment; }
if (getProtocolProviderPackages() != null && getProtocolProviderPackages().contains("weblogic")) { ImmutableMap.Builder<String, String> environment = ImmutableMap.builder(); if ((username != null) && (password != null)) { environment.put(PROTOCOL_PROVIDER_PACKAGES, getProtocolProviderPackages()); environment.put(SECURITY_PRINCIPAL, username); environment.put(SECURITY_CREDENTIALS, password);