Class CoAPEndpoint

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, 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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)  
      org.eclipse.californium.scandium.DTLSConnector createDTLSConnector​(InetSocketAddress address, boolean client)  
      org.apache.camel.Producer createProducer()  
      static boolean enableDTLS​(URI uri)  
      static boolean enableTCP​(URI uri)  
      String getAlias()
      Gets the alias used to query the KeyStore for the private key and certificate.
      String getCipherSuites()
      Gets the cipherSuites String.
      String getClientAuthentication()
      Gets the configuration options for server-side client-authentication requirements.
      String getCoapMethodRestrict()
      Comma separated list of methods that the CoAP consumer will bind to.
      org.eclipse.californium.core.CoapServer getCoapServer()  
      PrivateKey getPrivateKey()
      Get the configured private key for use with Raw Public Key.
      org.eclipse.californium.scandium.dtls.pskstore.PskStore getPskStore()
      Get the PskStore to use for pre-shared key.
      PublicKey getPublicKey()
      Get the configured public key for use with Raw Public Key.
      org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters()
      Get the SSLContextParameters object for setting up TLS.
      org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStore getTrustedRpkStore()
      Get the TrustedRpkStore to use to determine trust in raw public keys.
      URI getUri()
      The URI for the CoAP endpoint
      boolean isClientAuthenticationRequired()  
      boolean isClientAuthenticationWanted()  
      boolean isRecommendedCipherSuitesOnly()  
      void setAlias​(String alias)
      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 setPrivateKey​(PrivateKey privateKey)
      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 setPublicKey​(PublicKey publicKey)
      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 setUri​(URI u)  
      • Methods inherited from class org.apache.camel.support.DefaultEndpoint

        configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, doStart, doStop, 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, 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 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
    • Method Detail

      • 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
      • 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.
      • 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)