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
FieldsModifier and TypeFieldDescriptionprotected Map<String, RulesEngine.AssetLocationPredicates> protected AssetStorageServiceprotected ConcurrentMap<String, String> protected GatewayServiceprotected ManagerIdentityServicestatic final Stringprotected NotificationServicestatic intstatic intprotected ScheduledFuture<?> protected ScheduledExecutorServiceFields inherited from class org.apache.camel.builder.RouteBuilder
logFields inherited from interface org.openremote.model.ContainerService
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITYFields inherited from interface org.apache.camel.Ordered
HIGHEST, LOWEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.openremote.model.rules.geofence.GeofenceDefinition[]getAssetGeofences(String assetId) Called to return the active geofences for the specifiedAsset; 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.getName()Get the name of this adapterintvoidinit(org.openremote.model.Container container) protected static booleanisLinkedToORConsoleGeofenceAdapter(org.openremote.model.asset.impl.ConsoleAsset asset) protected org.openremote.model.rules.geofence.GeofenceDefinitionlocationPredicateToGeofenceDefinition(String assetId, org.openremote.model.query.filter.GeofencePredicate geofencePredicate) protected voidnotifyAssetGeofencesChanged(Set<String> assetIds) Send a silent push notification to the console to get it to refresh its geofencesprotected voidprocessConsoleAssetChange(org.openremote.model.PersistenceEvent<org.openremote.model.asset.impl.ConsoleAsset> persistenceEvent) voidprocessLocationPredicates(List<RulesEngine.AssetLocationPredicates> modifiedAssetLocationPredicates) 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.voidstart(org.openremote.model.Container container) voidstop(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, validatorMethods 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
-
Field Details
-
NAME
- See Also:
-
NOTIFY_ASSETS_DEBOUNCE_MILLIS
public static int NOTIFY_ASSETS_DEBOUNCE_MILLIS -
NOTIFY_ASSETS_BATCH_MILLIS
public static int NOTIFY_ASSETS_BATCH_MILLIS -
assetLocationPredicatesMap
-
notificationService
-
assetStorageService
-
gatewayService
-
identityService
-
scheduledExecutorService
-
consoleIdRealmMap
-
notifyAssetsScheduledFuture
-
notifyAssets
-
-
Constructor Details
-
ORConsoleGeofenceAssetAdapter
public ORConsoleGeofenceAssetAdapter()
-
-
Method Details
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceorg.openremote.model.ContainerService
-
init
- Specified by:
initin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
start
- Specified by:
startin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
configure
- Specified by:
configurein classorg.apache.camel.builder.RouteBuilder- Throws:
Exception
-
getName
Description copied from interface:GeofenceAssetAdapterGet the name of this adapter- Specified by:
getNamein interfaceGeofenceAssetAdapter
-
processLocationPredicates
public void processLocationPredicates(List<RulesEngine.AssetLocationPredicates> modifiedAssetLocationPredicates) Description copied from interface:GeofenceAssetAdapterIf 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 anRulesEngine.AssetLocationPredicates.getLocationPredicates()is empty then it means there are no longer any location predicates associated with that asset- Specified by:
processLocationPredicatesin interfaceGeofenceAssetAdapter
-
getAssetGeofences
Description copied from interface:GeofenceAssetAdapterCalled to return the active geofences for the specifiedAsset; 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:
getAssetGeofencesin interfaceGeofenceAssetAdapter
-
locationPredicateToGeofenceDefinition
protected org.openremote.model.rules.geofence.GeofenceDefinition locationPredicateToGeofenceDefinition(String assetId, org.openremote.model.query.filter.GeofencePredicate geofencePredicate) -
notifyAssetGeofencesChanged
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)
-