Class ORConsoleGeofenceAssetAdapter

java.lang.Object
org.apache.camel.builder.BuilderSupport
org.apache.camel.builder.RouteBuilder
org.openremote.manager.rules.geofence.ORConsoleGeofenceAssetAdapter
All Implemented Interfaces:
org.apache.camel.builder.ModelRoutesBuilder, org.apache.camel.CamelContextAware, org.apache.camel.Ordered, org.apache.camel.RoutesBuilder, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.ResourceAware, GeofenceAssetAdapter, org.openremote.model.ContainerService

public class ORConsoleGeofenceAssetAdapter extends org.apache.camel.builder.RouteBuilder implements GeofenceAssetAdapter
This implementation is for handling geofences on console assets that support the OR Console Geofence Provider (i.e. Android and iOS Consoles):

This adapter utilises push notifications to notify assets when their geofences change; a data only (silent) push notification is sent to affected consoles/assets. Consoles can also manually request their geofences (e.g. on startup)

  • Field Summary

    Fields

    Fields inherited from class org.apache.camel.builder.RouteBuilder

    log

    Fields inherited from interface org.openremote.model.ContainerService

    DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITY

    Fields inherited from interface org.apache.camel.Ordered

    HIGHEST, LOWEST
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    org.openremote.model.rules.geofence.GeofenceDefinition[]
    Called to return the active geofences for the specified Asset; if this adapter supports the requested asset then it should return a non null value to prevent the request from being sent to other geofence adapters.
    Get the name of this adapter
    int
     
    void
    init(org.openremote.model.Container container)
     
    protected static boolean
    isLinkedToORConsoleGeofenceAdapter(org.openremote.model.asset.impl.ConsoleAsset asset)
     
    protected org.openremote.model.rules.geofence.GeofenceDefinition
    locationPredicateToGeofenceDefinition(String assetId, org.openremote.model.query.filter.GeofencePredicate geofencePredicate)
     
    protected void
    Send a silent push notification to the console to get it to refresh its geofences
    protected void
    processConsoleAssetChange(org.openremote.model.PersistenceEvent<org.openremote.model.asset.impl.ConsoleAsset> persistenceEvent)
     
    void
    If an adapter handles the location predicates for a particular asset then the adapter should remove that item from the list to prevent other adapters from also handling it.
    void
    start(org.openremote.model.Container container)
     
    void
    stop(org.openremote.model.Container container)
     

    Methods inherited from class org.apache.camel.builder.RouteBuilder

    addLifecycleInterceptor, addRoutes, addRoutesToCamelContext, addTemplatedRoutesToCamelContext, bindToRegistry, bindToRegistry, checkInitialized, configuration, configureRest, configureRests, configureRoute, configureRouteConfiguration, configureRoutes, configureRouteTemplate, configureTemplatedRoute, customize, customize, dataFormat, errorHandler, errorHandler, expression, from, from, from, fromF, fromV, fromV, getBeans, getOrder, getResource, getRestCollection, getRestConfiguration, getRests, getRouteCollection, getRoutes, getRouteTemplateCollection, getTemplatedRouteCollection, initializeCamelContext, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, loadRoutesBuilder, loadRoutesBuilder, onCompletion, onException, onException, populateBeans, populateOrUpdateRoutes, populateRests, populateRoutes, populateRouteTemplates, populateTemplatedRoutes, populateTransformers, populateValidators, prepareModel, property, propertyInject, removeLifecycleInterceptor, rest, rest, restConfiguration, routeTemplate, setErrorHandlerFactory, setResource, setRestCollection, setRouteTemplateCollection, setTemplatedRouteCollection, templatedRoute, tokenizer, toString, transformer, updateRoutesToCamelContext, validator

    Methods inherited from class org.apache.camel.builder.BuilderSupport

    body, bodyAs, constant, constant, constant, createErrorHandlerBuilder, csimple, csimple, datasonnet, datasonnet, datasonnet, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, exceptionMessage, exchangeProperty, expression, getCamelContext, getContext, getErrorHandlerFactory, hasErrorHandlerFactory, header, java, java, joor, joor, jq, jq, jsonpath, jsonpath, jtaTransactionErrorHandler, jtaTransactionErrorHandler, jtaTransactionErrorHandler, method, method, method, method, noErrorHandler, regexReplaceAll, regexReplaceAll, setCamelContext, simple, simple, simpleF, simpleF, springTransactionErrorHandler, springTransactionErrorHandler, springTransactionErrorHandler, systemProperty, systemProperty, variable, xpath, xpath, xpath, xpath

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • ORConsoleGeofenceAssetAdapter

      public ORConsoleGeofenceAssetAdapter()
  • Method Details

    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface org.openremote.model.ContainerService
    • init

      public void init(org.openremote.model.Container container) throws Exception
      Specified by:
      init in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • start

      public void start(org.openremote.model.Container container) throws Exception
      Specified by:
      start in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • stop

      public void stop(org.openremote.model.Container container) throws Exception
      Specified by:
      stop in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • configure

      public void configure() throws Exception
      Specified by:
      configure in class org.apache.camel.builder.RouteBuilder
      Throws:
      Exception
    • getName

      public String getName()
      Description copied from interface: GeofenceAssetAdapter
      Get the name of this adapter
      Specified by:
      getName in interface GeofenceAssetAdapter
    • processLocationPredicates

      public void processLocationPredicates(List<RulesEngine.AssetLocationPredicates> modifiedAssetLocationPredicates)
      Description copied from interface: GeofenceAssetAdapter
      If an adapter handles the location predicates for a particular asset then the adapter should remove that item from the list to prevent other adapters from also handling it. If an RulesEngine.AssetLocationPredicates.getLocationPredicates() is empty then it means there are no longer any location predicates associated with that asset
      Specified by:
      processLocationPredicates in interface GeofenceAssetAdapter
    • getAssetGeofences

      public org.openremote.model.rules.geofence.GeofenceDefinition[] getAssetGeofences(String assetId)
      Description copied from interface: GeofenceAssetAdapter
      Called to return the active geofences for the specified Asset; if this adapter supports the requested asset then it should return a non null value to prevent the request from being sent to other geofence adapters.
      Specified by:
      getAssetGeofences in interface GeofenceAssetAdapter
    • locationPredicateToGeofenceDefinition

      protected org.openremote.model.rules.geofence.GeofenceDefinition locationPredicateToGeofenceDefinition(String assetId, org.openremote.model.query.filter.GeofencePredicate geofencePredicate)
    • notifyAssetGeofencesChanged

      protected void notifyAssetGeofencesChanged(Set<String> assetIds)
      Send a silent push notification to the console to get it to refresh its geofences
    • processConsoleAssetChange

      protected void processConsoleAssetChange(org.openremote.model.PersistenceEvent<org.openremote.model.asset.impl.ConsoleAsset> persistenceEvent)
    • isLinkedToORConsoleGeofenceAdapter

      protected static boolean isLinkedToORConsoleGeofenceAdapter(org.openremote.model.asset.impl.ConsoleAsset asset)