@Connector(name="coap-client", friendlyName="CoAP Client", schemaVersion="1.0", minMuleVersion="3.8.0", schemaLocation="http://www.teslanet.nl/schema/mule/coap-client/1.0/mule-coap-client.xsd", keywords="coap") public class CoapClientConnector extends Object
http://tools.ietf.org/html/rfc7252
.
A CoAP client issues requests on resources that reside on a CoAP server.
On these resources GET, POST, PUT, DELETE and Observer requests can be issued from Mule
applications using this Connector.
The client CoAP endpoint has a number of configuration parameters that can be used to tune behavior of the connector.
Apart from host and port, these parameters have sensible defaults and need only to be set for specific needs.Constructor and Description |
---|
CoapClientConnector() |
Modifier and Type | Method and Description |
---|---|
org.mule.api.MuleEvent |
asyncDelete(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters,
String responseHandler)
Async-Delete messageprocessor asynchronously deletes a CoAP resource on a Server.
|
org.mule.api.MuleEvent |
asyncGet(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters,
String responseHandler)
Async-Get messageprocessor asynchronously retrieves the contents of a CoAP resource from a Server.
|
org.mule.api.MuleEvent |
asyncPost(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters,
String responseHandler)
Async-Put messageprocessor asynchronously delivers contents to a CoAP resource on a Server.
|
org.mule.api.MuleEvent |
asyncPut(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters,
String responseHandler)
Async-Put messageprocessor asynchronously changes the contents of a CoAP resource on a Server.
|
org.mule.api.MuleEvent |
delete(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters)
Delete messageprocessor deletes a CoAP resource on a Server.
|
Set<org.eclipse.californium.core.WebLink> |
discover(Boolean confirmable,
String host,
Integer port,
List<String> queryParameters)
Discover message-processor retrieves information about CoAP resources from a server.
|
org.mule.api.MuleEvent |
get(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters)
Get messageprocessor retrieves the contents of a CoAP resource from a Server.
|
CoAPClientConfig |
getConfig()
Gets the Connector configuration.
|
org.mule.api.MuleContext |
getMuleContext()
Gets the Mule context.
|
String |
getUri(String host,
Integer port,
String path,
String query)
Get a String object containing the uri of the given CoAP resource.
|
URI |
getURI(String host,
Integer port,
String path,
String query)
Get an URI object describing the given CoAP resource.
|
void |
handleResponse(org.mule.api.callback.SourceCallback callback,
String handlerName)
Handle-Response messagesource handles responses on asynchronous requests that reference this handler.
|
List<String> |
listObservations()
List-Observations messageprocessor retrieves the list of active dynamic observations on a CoAP resource.
|
void |
observe(org.mule.api.callback.SourceCallback callback,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters)
Observe messagesource observes a CoAP resource on a Server.
|
Boolean |
ping(String host,
Integer port)
The Ping messageprocessor checks whether a CoAP resource is reachable.
|
org.mule.api.MuleEvent |
post(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters)
Post messageprocessor delivers contents to a CoAP resource on a Server.
|
org.mule.api.MuleEvent |
put(org.mule.api.MuleEvent event,
Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters)
Put messageprocessor changes the contents of a CoAP resource on a Server.
|
void |
setConfig(CoAPClientConfig config)
Sets the Connector configuration.
|
void |
setMuleContext(org.mule.api.MuleContext context)
Sets the The Mule context.
|
void |
startConnector()
The startConnector method creates an CoAP endpoint using the configuration parameters.
|
void |
startObserve(Boolean confirmable,
String host,
Integer port,
String path,
List<String> queryParameters,
String responseHandler)
Start-observe messageprocessor dynamically initiates observation of a CoAP resource on a Server.
|
void |
stopConnector()
The stopConnector method terminates the CoAP endpoint.
|
void |
stopObserve(String host,
Integer port,
String path,
List<String> queryParameters)
Stop-observe messageprocessor ends a dynamically set observation of a CoAP resource on a Server.
|
void |
test()
Test connectivity
|
@TestConnectivity public void test() throws MalformedUriException, org.mule.api.ConnectionException
MalformedUriException
- cannot form valid uri with given parametersorg.mule.api.ConnectionException
- server could not be reached@Start public void startConnector() throws org.mule.api.ConnectionException
org.mule.api.ConnectionException
- The CoAP endpoint could not be created.@Stop public void stopConnector()
@Processor public Boolean ping(@Optional String host, @Optional Integer port) throws MalformedUriException
host
- The host to ping. Overrides the connector setting.port
- The port the host listens on. Overrides the connector setting.MalformedUriException
- cannot form valid uri with given parameters@Processor public Set<org.eclipse.californium.core.WebLink> discover(@Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, @Optional List<String> queryParameters) throws MalformedUriException
confirmable
- When true (default), requests are sent confirmable.host
- The host address of the server.port
- The port the server is listening on.queryParameters
- The optional query-parameters for discovery.MalformedUriException
- cannot form valid uri with given parameters@Processor public org.mule.api.MuleEvent get(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent asyncGet(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters, String responseHandler) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.responseHandler
- Name of the handler that will process the returned response.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent put(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent asyncPut(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters, String responseHandler) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.responseHandler
- Name of the handler that will process the returned response.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent post(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent asyncPost(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters, String responseHandler) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.responseHandler
- Name of the handler that will process the returned response.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent delete(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public org.mule.api.MuleEvent asyncDelete(org.mule.api.MuleEvent event, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters, String responseHandler) throws MalformedUriException, HandlerException
confirmable
- When true the server must confirm the request.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.responseHandler
- Name of the handler that will process the returned response.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public void startObserve(@Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters, String responseHandler) throws MalformedUriException, HandlerException
confirmable
- When true (default), requests are sent confirmable.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.responseHandler
- Name of the handler that will process the resource updates received from server.MalformedUriException
- cannot form valid uri with given parametersHandlerException
- response handler with given name not found@Processor public void stopObserve(@Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters) throws MalformedUriException
host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.MalformedUriException
- cannot form valid uri with given parameters@Processor public List<String> listObservations()
host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.Exception
- Is thrown when an unexpected error occurs@Source public void observe(org.mule.api.callback.SourceCallback callback, @Default(value="true") Boolean confirmable, @Optional String host, @Optional Integer port, String path, @Optional List<String> queryParameters) throws MalformedUriException
confirmable
- When true (default), requests are sent confirmable.host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.queryParameters
- List of query parameters.MalformedUriException
- no valid uri could be formed with given parametersException
- Is thrown when an unexpected error occurs@Source public void handleResponse(org.mule.api.callback.SourceCallback callback, String handlerName) throws HandlerException
handlerName
- The name of the hander. Used by asynchronous requests to reference the handler.HandlerException
Exception
- Is thrown when an unexpectedpublic URI getURI(String host, Integer port, String path, String query) throws MalformedUriException
host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.query
- String containing query parameters.MalformedUriException
- cannot form valid uri with given parameterspublic String getUri(String host, Integer port, String path, String query) throws MalformedUriException
host
- The host address of the server.port
- The port the server is listening on.path
- The path of the resource.query
- String containing query parameters.MalformedUriException
- cannot form valid uri with given parameterspublic org.mule.api.MuleContext getMuleContext()
public void setMuleContext(org.mule.api.MuleContext context)
context
- The Mule context.public CoAPClientConfig getConfig()
public void setConfig(CoAPClientConfig config)
config
- The Connector configuration.Copyright © 2010–2018. All rights reserved.