Example usage for javax.management.remote JMXServiceURL getPort

List of usage examples for javax.management.remote JMXServiceURL getPort

Introduction

In this page you can find the example usage for javax.management.remote JMXServiceURL getPort.

Prototype

public int getPort() 

Source Link

Document

The port of the Service URL.

Usage

From source file:net.sbbi.upnp.jmx.upnp.UPNPConnectorServer.java

public UPNPConnectorServer(MBeanServer server, JMXServiceURL serviceURL, Map env) throws IOException {
    super(server);
    this.serviceURL = serviceURL;
    this.env = env;
    // TODO implement an JMXConnector for security (such as basic http auth)? problems with the UPNP protocol itself
    sktAddress = new InetSocketAddress(InetAddress.getByName(serviceURL.getHost()), serviceURL.getPort());
    builder = (UPNPMBeanBuilder) env.get(UPNP_MBEANS_BUILDER);
    if (builder == null) {
        builder = new UPNPMBeanBuilderImpl();
    }//from w w  w. j  a v a  2 s  . c o m
    exposeUPNPAsMBeans = (Boolean) env.get(EXPOSE_UPNP_DEVICES_AS_MBEANS);
    if (exposeUPNPAsMBeans == null)
        exposeUPNPAsMBeans = Boolean.FALSE;
    exposeMBeansAsUPNP = (Boolean) env.get(EXPOSE_MBEANS_AS_UPNP_DEVICES);
    if (exposeMBeansAsUPNP == null)
        exposeMBeansAsUPNP = Boolean.TRUE;
    handleSSDPMessages = (Boolean) env.get(HANDLE_SSDP_MESSAGES);
    if (handleSSDPMessages == null)
        handleSSDPMessages = Boolean.FALSE;
    exposeExistingMBeansAsUPNP = (Boolean) env.get(EXPOSE_EXISTING_MBEANS_AS_UPNP_DEVICES);
    if (exposeExistingMBeansAsUPNP == null)
        exposeExistingMBeansAsUPNP = Boolean.FALSE;

    if (!exposeMBeansAsUPNP.booleanValue() && !exposeUPNPAsMBeans.booleanValue()
            && !exposeExistingMBeansAsUPNP.booleanValue()) {
        throw new IOException("Useless UPNPConnectorServer since nothing will be deployed, unregister it");
    }
}