Class CoAPEndpoint

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.coap.CoAPEndpoint
All Implemented Interfaces:
AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.ComponentAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

@UriEndpoint(firstVersion="2.16.0", scheme="coap,coaps,coap+tcp,coaps+tcp", title="CoAP", syntax="coap:uri", category=IOT, headersClass=CoAPConstants.class) public class CoAPEndpoint extends org.apache.camel.support.DefaultEndpoint
Send and receive messages to/from COAP capable devices.
  • Field Summary

    Fields inherited from class org.apache.camel.support.service.BaseService

    BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.eclipse.californium.core.CoapClient
     
    org.apache.camel.Consumer
    createConsumer(org.apache.camel.Processor processor)
     
    org.eclipse.californium.scandium.DTLSConnector
    createDTLSConnector(InetSocketAddress address, boolean client)
     
    org.apache.camel.Producer
     
    static boolean
     
    static boolean
     
    Gets the alias used to query the KeyStore for the private key and certificate.
    org.apache.camel.coap.CamelCoapResource
     
    Gets the cipherSuites String.
    Gets the configuration options for server-side client-authentication requirements.
    Comma separated list of methods that the CoAP consumer will bind to.
    org.eclipse.californium.core.CoapServer
     
     
    Get the configured private key for use with Raw Public Key.
    org.eclipse.californium.scandium.dtls.pskstore.PskStore
    Get the PskStore to use for pre-shared key.
    Get the configured public key for use with Raw Public Key.
    org.apache.camel.support.jsse.SSLContextParameters
    Get the SSLContextParameters object for setting up TLS.
    org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStore
    Get the TrustedRpkStore to use to determine trust in raw public keys.
    The URI for the CoAP endpoint
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    void
    Sets the alias used to query the KeyStore for the private key and certificate.
    void
    setCipherSuites(String cipherSuites)
    Sets the cipherSuites String.
    void
    setClientAuthentication(String clientAuthentication)
    Sets the configuration options for server-side client-authentication requirements.
    void
    setCoapMethodRestrict(String coapMethodRestrict)
     
    void
    setNotify(boolean notify)
    Notify observers that the resource of this URI has changed, based on RFC 7641.
    void
    setObservable(boolean observable)
    Make CoAP resource observable for source endpoint, based on RFC 7641.
    void
    setObserve(boolean observe)
    Send an observe request from a source endpoint, based on RFC 7641.
    void
    Set the configured private key for use with Raw Public Key.
    void
    setPskStore(org.eclipse.californium.scandium.dtls.pskstore.PskStore pskStore)
    Set the PskStore to use for pre-shared key.
    void
    Set the configured public key for use with Raw Public Key.
    void
    setRecommendedCipherSuitesOnly(boolean recommendedCipherSuitesOnly)
    The CBC cipher suites are not recommended.
    void
    setSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
    Set the SSLContextParameters object for setting up TLS.
    void
    setTrustedRpkStore(org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStore trustedRpkStore)
    Set the TrustedRpkStore to use to determine trust in raw public keys.
    void
     

    Methods inherited from class org.apache.camel.support.DefaultEndpoint

    configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.camel.ComponentAware

    getComponent

    Methods inherited from interface org.apache.camel.Endpoint

    getEndpointBaseUri, isSingletonProducer

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Constructor Details

  • Method Details

    • setCoapMethodRestrict

      public void setCoapMethodRestrict(String coapMethodRestrict)
    • getCoapMethodRestrict

      public String getCoapMethodRestrict()
      Comma separated list of methods that the CoAP consumer will bind to. The default is to bind to all methods (DELETE, GET, POST, PUT).
    • createProducer

      public org.apache.camel.Producer createProducer() throws Exception
      Throws:
      Exception
    • createConsumer

      public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
      Throws:
      Exception
    • setUri

      public void setUri(URI u)
    • getUri

      public URI getUri()
      The URI for the CoAP endpoint
    • getCamelCoapResource

      public org.apache.camel.coap.CamelCoapResource getCamelCoapResource(String path) throws IOException, GeneralSecurityException
      Throws:
      IOException
      GeneralSecurityException
    • getPathSegmentsFromURI

      public List<String> getPathSegmentsFromURI()
    • getCoapServer

      public org.eclipse.californium.core.CoapServer getCoapServer() throws IOException, GeneralSecurityException
      Throws:
      IOException
      GeneralSecurityException
    • getAlias

      public String getAlias()
      Gets the alias used to query the KeyStore for the private key and certificate. This parameter is used when we are enabling TLS with certificates on the service side, and similarly on the client side when TLS is used with certificates and client authentication. If the parameter is not specified then the default behavior is to use the first alias in the keystore that contains a key entry. This configuration parameter does not apply to configuring TLS via a Raw Public Key or a Pre-Shared Key.
    • setAlias

      public void setAlias(String alias)
      Sets the alias used to query the KeyStore for the private key and certificate. This parameter is used when we are enabling TLS with certificates on the service side, and similarly on the client side when TLS is used with certificates and client authentication. If the parameter is not specified then the default behavior is to use the first alias in the keystore that contains a key entry. This configuration parameter does not apply to configuring TLS via a Raw Public Key or a Pre-Shared Key.
    • isObserve

      public boolean isObserve()
    • setObserve

      public void setObserve(boolean observe)
      Send an observe request from a source endpoint, based on RFC 7641.
    • isObservable

      public boolean isObservable()
    • setObservable

      public void setObservable(boolean observable)
      Make CoAP resource observable for source endpoint, based on RFC 7641.
    • isNotify

      public boolean isNotify()
    • setNotify

      public void setNotify(boolean notify)
      Notify observers that the resource of this URI has changed, based on RFC 7641. Use this flag on a destination endpoint, with an URI that matches an existing source endpoint URI.
    • getSslContextParameters

      public org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters()
      Get the SSLContextParameters object for setting up TLS. This is required for coaps+tcp, and for coaps when we are using certificates for TLS (as opposed to RPK or PKS).
    • setSslContextParameters

      public void setSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
      Set the SSLContextParameters object for setting up TLS. This is required for coaps+tcp, and for coaps when we are using certificates for TLS (as opposed to RPK or PKS).
    • getTrustedRpkStore

      public org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStore getTrustedRpkStore()
      Get the TrustedRpkStore to use to determine trust in raw public keys.
    • setTrustedRpkStore

      public void setTrustedRpkStore(org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStore trustedRpkStore)
      Set the TrustedRpkStore to use to determine trust in raw public keys.
    • getPskStore

      public org.eclipse.californium.scandium.dtls.pskstore.PskStore getPskStore()
      Get the PskStore to use for pre-shared key.
    • setPskStore

      public void setPskStore(org.eclipse.californium.scandium.dtls.pskstore.PskStore pskStore)
      Set the PskStore to use for pre-shared key.
    • getPrivateKey

      public PrivateKey getPrivateKey()
      Get the configured private key for use with Raw Public Key.
    • setPrivateKey

      public void setPrivateKey(PrivateKey privateKey)
      Set the configured private key for use with Raw Public Key.
    • getPublicKey

      public PublicKey getPublicKey()
      Get the configured public key for use with Raw Public Key.
    • setPublicKey

      public void setPublicKey(PublicKey publicKey)
      Set the configured public key for use with Raw Public Key.
    • getCipherSuites

      public String getCipherSuites()
      Gets the cipherSuites String. This is a comma separated String of ciphersuites to configure. If it is not specified, then it falls back to getting the ciphersuites from the sslContextParameters object.
    • setCipherSuites

      public void setCipherSuites(String cipherSuites)
      Sets the cipherSuites String. This is a comma separated String of ciphersuites to configure. If it is not specified, then it falls back to getting the ciphersuites from the sslContextParameters object.
    • getClientAuthentication

      public String getClientAuthentication()
      Gets the configuration options for server-side client-authentication requirements. The value is either null or one of NONE, WANT, REQUIRE. If this value is not specified, then it falls back to checking the sslContextParameters.getServerParameters().getClientAuthentication() value.
    • setClientAuthentication

      public void setClientAuthentication(String clientAuthentication)
      Sets the configuration options for server-side client-authentication requirements. The value must be one of NONE, WANT, REQUIRE. If this value is not specified, then it falls back to checking the sslContextParameters.getServerParameters().getClientAuthentication() value.
    • isRecommendedCipherSuitesOnly

      public boolean isRecommendedCipherSuitesOnly()
    • setRecommendedCipherSuitesOnly

      public void setRecommendedCipherSuitesOnly(boolean recommendedCipherSuitesOnly)
      The CBC cipher suites are not recommended. If you want to use them, you first need to set the recommendedCipherSuitesOnly option to false.
    • isClientAuthenticationRequired

      public boolean isClientAuthenticationRequired()
    • isClientAuthenticationWanted

      public boolean isClientAuthenticationWanted()
    • enableDTLS

      public static boolean enableDTLS(URI uri)
    • enableTCP

      public static boolean enableTCP(URI uri)
    • createDTLSConnector

      public org.eclipse.californium.scandium.DTLSConnector createDTLSConnector(InetSocketAddress address, boolean client) throws IOException
      Throws:
      IOException
    • createCoapClient

      public org.eclipse.californium.core.CoapClient createCoapClient(URI uri) throws IOException, GeneralSecurityException
      Throws:
      IOException
      GeneralSecurityException