Search in sources :

Example 1 with CoapServer

use of org.eclipse.californium.core.CoapServer in project camel by apache.

the class CoAPComponent method getServer.

public synchronized CoapServer getServer(int port) {
    CoapServer server = servers.get(port);
    if (server == null && port == -1) {
        server = defaultServer;
    }
    if (server == null && port == -1) {
        server = servers.get(5684);
    }
    if (server == null) {
        NetworkConfig config = new NetworkConfig();
        //FIXME- configure the network stuff
        server = new CoapServer(config, port);
        servers.put(port, server);
        if (this.isStarted()) {
            server.start();
        }
    }
    return server;
}
Also used : NetworkConfig(org.eclipse.californium.core.network.config.NetworkConfig) CoapServer(org.eclipse.californium.core.CoapServer)

Example 2 with CoapServer

use of org.eclipse.californium.core.CoapServer in project camel by apache.

the class CoAPComponent method doStart.

@Override
protected void doStart() throws Exception {
    super.doStart();
    RestConfiguration config = getCamelContext().getRestConfiguration("coap", true);
    // configure additional options on coap configuration
    if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
        setProperties(this, config.getComponentProperties());
    }
    defaultServer = getServer(config.getPort());
    for (CoapServer s : servers.values()) {
        s.start();
    }
}
Also used : CoapServer(org.eclipse.californium.core.CoapServer) RestConfiguration(org.apache.camel.spi.RestConfiguration)

Aggregations

CoapServer (org.eclipse.californium.core.CoapServer)2 RestConfiguration (org.apache.camel.spi.RestConfiguration)1 NetworkConfig (org.eclipse.californium.core.network.config.NetworkConfig)1