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

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.plc4x.java.api.PlcConnection
     
    protected org.apache.plc4x.java.DefaultPlcDriverManager
     

    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
    Plc4XEndpoint(String endpointUri, org.apache.camel.Component component)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.plc4x.java.api.messages.PlcReadRequest
    Build a PlcReadRequest using the tags specified in the endpoint.
    org.apache.plc4x.java.api.messages.PlcWriteRequest
    Build a PlcWriteRequest.
    boolean
     
    org.apache.camel.Consumer
    createConsumer(org.apache.camel.Processor processor)
     
    org.apache.camel.PollingConsumer
     
    org.apache.camel.Producer
     
    void
     
     
    int
     
    org.apache.plc4x.java.DefaultPlcDriverManager
     
     
     
     
     
     
    boolean
     
    void
    Reconnects if needed.
    void
    setAutoReconnect(boolean autoReconnect)
     
    void
    setDriver(String driver)
     
    void
    setPeriod(int period)
     
    void
     
    void
    setTrigger(String trigger)
     
    void
    Set 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, toString

    Methods 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, 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, isRemote, isSingletonProducer

    Methods inherited from interface org.apache.camel.spi.EndpointServiceLocation

    getServiceMetadata

    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
  • Field Details

    • plcDriverManager

      protected org.apache.plc4x.java.DefaultPlcDriverManager plcDriverManager
    • connection

      protected org.apache.plc4x.java.api.PlcConnection connection
  • Constructor Details

    • Plc4XEndpoint

      public Plc4XEndpoint(String endpointUri, org.apache.camel.Component component)
  • Method Details

    • getServiceUrl

      public String getServiceUrl()
      Specified by:
      getServiceUrl in interface org.apache.camel.spi.EndpointServiceLocation
    • getServiceProtocol

      public String getServiceProtocol()
      Specified by:
      getServiceProtocol in interface org.apache.camel.spi.EndpointServiceLocation
    • getPeriod

      public int getPeriod()
    • setPeriod

      public void setPeriod(int period)
    • getUri

      public String getUri()
    • getTrigger

      public String getTrigger()
    • setTrigger

      public void setTrigger(String trigger)
    • setAutoReconnect

      public void setAutoReconnect(boolean autoReconnect)
    • isAutoReconnect

      public boolean isAutoReconnect()
    • setupConnection

      public void setupConnection() throws org.apache.plc4x.java.api.exceptions.PlcConnectionException
      Set 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.PlcConnectionException
      Reconnects 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:
      createProducer in interface org.apache.camel.Endpoint
    • createConsumer

      public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
      Specified by:
      createConsumer in interface org.apache.camel.Endpoint
      Throws:
      Exception
    • createPollingConsumer

      public org.apache.camel.PollingConsumer createPollingConsumer()
      Specified by:
      createPollingConsumer in interface org.apache.camel.Endpoint
      Overrides:
      createPollingConsumer in class org.apache.camel.support.DefaultEndpoint
    • buildPlcReadRequest

      public org.apache.plc4x.java.api.messages.PlcReadRequest buildPlcReadRequest()
      Build a PlcReadRequest using the tags specified in the endpoint.
    • buildPlcWriteRequest

      public org.apache.plc4x.java.api.messages.PlcWriteRequest buildPlcWriteRequest(Map<String,Map<String,Object>> tags)
      Build a PlcWriteRequest.

      Parameters:
      tags - tags to add to write request
      Returns:
      PlcWriteRequest
    • getPlcDriverManager

      public org.apache.plc4x.java.DefaultPlcDriverManager getPlcDriverManager()
    • getDriver

      public String getDriver()
    • setDriver

      public void setDriver(String driver)
    • getTags

      public Map<String,String> getTags()
    • setTags

      public void setTags(Map<String,String> tags)
    • doStop

      public void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception