Package org.apache.camel.component.plc4x
Class Plc4XEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.plc4x.Plc4XEndpoint
- 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.EndpointServiceLocation,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(scheme="plc4x",
firstVersion="3.20.0",
title="PLC4X",
syntax="plc4x:driver",
category=IOT)
public class Plc4XEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.spi.EndpointServiceLocation
Read and write to PLC devices
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.plc4x.java.api.PlcConnectionprotected org.apache.plc4x.java.DefaultPlcDriverManagerFields 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 -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.plc4x.java.api.messages.PlcReadRequestBuild aPlcReadRequestusing the tags specified in the endpoint.org.apache.plc4x.java.api.messages.PlcWriteRequestBuild aPlcWriteRequest.booleancanWrite()org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.PollingConsumerorg.apache.camel.ProducervoiddoStop()intorg.apache.plc4x.java.DefaultPlcDriverManagergetTags()getUri()booleanvoidReconnects if needed.voidsetAutoReconnect(boolean autoReconnect) voidvoidsetPeriod(int period) voidvoidsetTrigger(String trigger) voidSet up the connection.Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, 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, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.ComponentAware
getComponentMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isRemote, isSingletonProducerMethods inherited from interface org.apache.camel.spi.EndpointServiceLocation
getServiceMetadataMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
plcDriverManager
protected org.apache.plc4x.java.DefaultPlcDriverManager plcDriverManager -
connection
protected org.apache.plc4x.java.api.PlcConnection connection
-
-
Constructor Details
-
Plc4XEndpoint
-
-
Method Details
-
getServiceUrl
- Specified by:
getServiceUrlin interfaceorg.apache.camel.spi.EndpointServiceLocation
-
getServiceProtocol
- Specified by:
getServiceProtocolin interfaceorg.apache.camel.spi.EndpointServiceLocation
-
getPeriod
public int getPeriod() -
setPeriod
public void setPeriod(int period) -
getUri
-
getTrigger
-
setTrigger
-
setAutoReconnect
public void setAutoReconnect(boolean autoReconnect) -
isAutoReconnect
public boolean isAutoReconnect() -
setupConnection
public void setupConnection() throws org.apache.plc4x.java.api.exceptions.PlcConnectionExceptionSet up the connection.- Throws:
org.apache.plc4x.java.api.exceptions.PlcConnectionException- if no connection could be established and auto-reconnect is turned off
-
reconnectIfNeeded
public void reconnectIfNeeded() throws org.apache.plc4x.java.api.exceptions.PlcConnectionExceptionReconnects if needed. If connection is lost and auto-reconnect is turned off, endpoint will be shutdown.- Throws:
org.apache.plc4x.java.api.exceptions.PlcConnectionException- If reconnect failed and auto-reconnect is turned on
-
canWrite
public boolean canWrite()- Returns:
- true if connection supports writing, else false
-
createProducer
public org.apache.camel.Producer createProducer()- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createPollingConsumer
public org.apache.camel.PollingConsumer createPollingConsumer()- Specified by:
createPollingConsumerin interfaceorg.apache.camel.Endpoint- Overrides:
createPollingConsumerin classorg.apache.camel.support.DefaultEndpoint
-
buildPlcReadRequest
public org.apache.plc4x.java.api.messages.PlcReadRequest buildPlcReadRequest()Build aPlcReadRequestusing the tags specified in the endpoint. -
buildPlcWriteRequest
public org.apache.plc4x.java.api.messages.PlcWriteRequest buildPlcWriteRequest(Map<String, Map<String, Object>> tags) Build aPlcWriteRequest.- Parameters:
tags- tags to add to write request- Returns:
PlcWriteRequest
-
getPlcDriverManager
public org.apache.plc4x.java.DefaultPlcDriverManager getPlcDriverManager() -
getDriver
-
setDriver
-
getTags
-
setTags
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-