Package org.apache.camel.coap
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.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.DefaultEndpointSend and receive messages to/from COAP capable devices.
-
-
Constructor Summary
Constructors Constructor Description CoAPEndpoint(String uri, CoAPComponent component)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.eclipse.californium.scandium.DTLSConnectorcreateDTLSConnector(InetSocketAddress address, boolean client)org.apache.camel.ProducercreateProducer()static booleanenableDTLS(URI uri)static booleanenableTCP(URI uri)StringgetAlias()Gets the alias used to query the KeyStore for the private key and certificate.StringgetCipherSuites()Gets the cipherSuites String.StringgetClientAuthentication()Gets the configuration options for server-side client-authentication requirements.StringgetCoapMethodRestrict()Comma separated list of methods that the CoAP consumer will bind to.org.eclipse.californium.core.CoapServergetCoapServer()PrivateKeygetPrivateKey()Get the configured private key for use with Raw Public Key.org.eclipse.californium.scandium.dtls.pskstore.PskStoregetPskStore()Get the PskStore to use for pre-shared key.PublicKeygetPublicKey()Get the configured public key for use with Raw Public Key.org.apache.camel.support.jsse.SSLContextParametersgetSslContextParameters()Get the SSLContextParameters object for setting up TLS.org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStoregetTrustedRpkStore()Get the TrustedRpkStore to use to determine trust in raw public keys.URIgetUri()The URI for the CoAP endpointbooleanisClientAuthenticationRequired()booleanisClientAuthenticationWanted()booleanisRecommendedCipherSuitesOnly()voidsetAlias(String alias)Sets the alias used to query the KeyStore for the private key and certificate.voidsetCipherSuites(String cipherSuites)Sets the cipherSuites String.voidsetClientAuthentication(String clientAuthentication)Sets the configuration options for server-side client-authentication requirements.voidsetCoapMethodRestrict(String coapMethodRestrict)voidsetPrivateKey(PrivateKey privateKey)Set the configured private key for use with Raw Public Key.voidsetPskStore(org.eclipse.californium.scandium.dtls.pskstore.PskStore pskStore)Set the PskStore to use for pre-shared key.voidsetPublicKey(PublicKey publicKey)Set the configured public key for use with Raw Public Key.voidsetRecommendedCipherSuitesOnly(boolean recommendedCipherSuitesOnly)The CBC cipher suites are not recommended.voidsetSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)Set the SSLContextParameters object for setting up TLS.voidsetTrustedRpkStore(org.eclipse.californium.scandium.dtls.rpkstore.TrustedRpkStore trustedRpkStore)Set the TrustedRpkStore to use to determine trust in raw public keys.voidsetUri(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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
CoAPEndpoint
public CoAPEndpoint(String uri, CoAPComponent component)
-
-
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).
-
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
-
getCoapServer
public org.eclipse.californium.core.CoapServer getCoapServer() throws IOException, GeneralSecurityException- Throws:
IOExceptionGeneralSecurityException
-
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)
-
createDTLSConnector
public org.eclipse.californium.scandium.DTLSConnector createDTLSConnector(InetSocketAddress address, boolean client) throws IOException
- Throws:
IOException
-
-