Package org.openremote.manager.gateway
Class GatewayClientService
java.lang.Object
org.apache.camel.builder.BuilderSupport
org.apache.camel.builder.RouteBuilder
org.openremote.manager.gateway.GatewayClientService
- 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,org.openremote.model.ContainerService
public class GatewayClientService
extends org.apache.camel.builder.RouteBuilder
implements org.openremote.model.ContainerService
Handles outbound connections to central managers
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AssetProcessingServiceprotected AssetStorageServicestatic final Stringprotected ClientEventServiceprotected final Map<String, GatewayIOClient> protected GatewayTunnelFactoryprotected ManagerIdentityServicestatic final Stringprotected org.openremote.container.persistence.PersistenceServicestatic final intprotected Consumer<org.openremote.model.asset.AssetEvent> protected Consumer<org.openremote.model.attribute.AttributeEvent> protected org.openremote.container.timer.TimerServiceFields 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 TypeMethodDescriptionprotected org.openremote.model.asset.Asset<?> applySyncRules(org.openremote.model.asset.Asset<?> asset, Map<String, org.openremote.model.gateway.GatewayAssetSyncRule> assetSyncRules) If the assetSyncRules affect this AssetType: 1) Filter out the attributes that have been defined in GatewayAssetSyncRule..excludeAttributes 2) Find the metaItem exclusions, with the specific attibuteName having priority over the wildcard. protected voidapplySyncRuleToMeta(String attributeName, org.openremote.model.attribute.MetaMap meta, org.openremote.model.gateway.GatewayAssetSyncRule syncRule) voidprotected GatewayIOClientcreateGatewayClient(org.openremote.model.gateway.GatewayConnection connection) booleandeleteConnections(List<String> realms) protected voiddestroyGatewayClient(org.openremote.model.gateway.GatewayConnection connection, GatewayIOClient client) protected StringgetClientSessionKey(org.openremote.model.gateway.GatewayConnection connection) protected List<org.openremote.model.gateway.GatewayConnection> GATEWAY RESOURCE METHODSprotected org.openremote.model.asset.agent.ConnectionStatusgetConnectionStatus(String realm) protected org.openremote.model.event.shared.EventFilter<org.openremote.model.attribute.AttributeEvent> getOutboundAttributeEventFilter(org.openremote.model.gateway.GatewayConnection gatewayConnection) voidinit(org.openremote.model.Container container) protected <T> TmessageFromString(String message, String prefix, Class<T> clazz) protected StringmessageToString(String prefix, Object message) protected voidonCentralManagerMessage(org.openremote.model.gateway.GatewayConnection connection, String message) protected voidonGatewayClientConnectionStatusChanged(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.asset.agent.ConnectionStatus connectionStatus) protected voidprocessConnectionChange(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.PersistenceEvent.Cause cause) protected voidsendAssetEvent(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.asset.AssetEvent event) protected voidsendAttributeEvent(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.attribute.AttributeEvent event) protected voidsendCentralManagerMessage(String realm, String message) voidsetConnection(org.openremote.model.gateway.GatewayConnection connection) 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, xpathMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openremote.model.ContainerService
getPriority
-
Field Details
-
PRIORITY
public static final int PRIORITY- See Also:
-
CLIENT_EVENT_SESSION_PREFIX
-
OR_GATEWAY_TUNNEL_LOCALHOST_REWRITE
- See Also:
-
assetStorageService
-
assetProcessingService
-
persistenceService
protected org.openremote.container.persistence.PersistenceService persistenceService -
clientEventService
-
timerService
protected org.openremote.container.timer.TimerService timerService -
identityService
-
connectionRealmMap
-
clientRealmMap
-
gatewayTunnelFactory
-
clientAttributeTimestamps
-
realmAssetEventConsumer
-
realmAttributeEventConsumer
-
-
Constructor Details
-
GatewayClientService
public GatewayClientService()
-
-
Method Details
-
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
-
processConnectionChange
protected void processConnectionChange(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.PersistenceEvent.Cause cause) -
createGatewayClient
protected GatewayIOClient createGatewayClient(org.openremote.model.gateway.GatewayConnection connection) -
sendAssetEvent
protected void sendAssetEvent(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.asset.AssetEvent event) -
sendAttributeEvent
protected void sendAttributeEvent(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.attribute.AttributeEvent event) -
getOutboundAttributeEventFilter
protected org.openremote.model.event.shared.EventFilter<org.openremote.model.attribute.AttributeEvent> getOutboundAttributeEventFilter(org.openremote.model.gateway.GatewayConnection gatewayConnection) -
destroyGatewayClient
protected void destroyGatewayClient(org.openremote.model.gateway.GatewayConnection connection, GatewayIOClient client) -
onGatewayClientConnectionStatusChanged
protected void onGatewayClientConnectionStatusChanged(org.openremote.model.gateway.GatewayConnection connection, org.openremote.model.asset.agent.ConnectionStatus connectionStatus) -
onCentralManagerMessage
protected void onCentralManagerMessage(org.openremote.model.gateway.GatewayConnection connection, String message) -
sendCentralManagerMessage
-
getClientSessionKey
-
messageFromString
-
messageToString
-
getConnections
GATEWAY RESOURCE METHODS -
setConnection
public void setConnection(org.openremote.model.gateway.GatewayConnection connection) -
deleteConnections
-
getConnectionStatus
-
applySyncRules
protected org.openremote.model.asset.Asset<?> applySyncRules(org.openremote.model.asset.Asset<?> asset, Map<String, org.openremote.model.gateway.GatewayAssetSyncRule> assetSyncRules) If the assetSyncRules affect this AssetType: 1) Filter out the attributes that have been defined in GatewayAssetSyncRule..excludeAttributes 2) Find the metaItem exclusions, with the specific attibuteName having priority over the wildcard. If none are found, Use Optional.Empty 3) Put the attribute and the List of excluded metaItems in a Tuple (MutablePair) 4) Filter out any excluded metaItems by using Attribute.setMeta(Attribute.getMeta) 5) - Parameters:
asset- Asset to filterassetSyncRules- Asset Sync Rules as found in GatewayConnection- Returns:
- The asset as given, with attributes and metaItems stripped out as instructed by the assetSyncRules
-
applySyncRuleToMeta
protected void applySyncRuleToMeta(String attributeName, org.openremote.model.attribute.MetaMap meta, org.openremote.model.gateway.GatewayAssetSyncRule syncRule)
-