Class AssetModelService

java.lang.Object
org.apache.camel.builder.BuilderSupport
org.apache.camel.builder.RouteBuilder
org.openremote.manager.asset.AssetModelService
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.AssetModelProvider, org.openremote.model.ContainerService

public class AssetModelService extends org.apache.camel.builder.RouteBuilder implements org.openremote.model.ContainerService, org.openremote.model.AssetModelProvider
A service for abstracting ValueUtil and handling local model requests vs GatewayAsset model requests. It also manages the AssetModelResource and provides support for model requests via the client event bus.

Also implements an AssetModelProvider that loads descriptors from the file system; specifically in PersistenceService.OR_STORAGE_DIR/DIRECTORY_NAME; file structure should be a JSON representation of AssetTypeInfo.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    static final String
     
    protected Map<String,org.openremote.model.asset.AssetTypeInfo>
     
    protected GatewayService
     
     
    protected static com.fasterxml.jackson.databind.ObjectMapper
     
    protected static Logger
     
    protected org.openremote.container.persistence.PersistenceService
     
    protected Path
     

    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.asset.AssetDescriptor<?>[]
     
    org.openremote.model.asset.AssetDescriptor<?>[]
    getAssetDescriptors(String parentId, String parentType)
     
    org.openremote.model.asset.AssetTypeInfo
    getAssetInfo(String parentId, String assetType)
     
    org.openremote.model.asset.AssetTypeInfo[]
    getAssetInfos(String parentId, String parentType)
     
    Map<String,Collection<org.openremote.model.value.AttributeDescriptor<?>>>
     
    Map<String,Collection<org.openremote.model.value.MetaItemDescriptor<?>>>
     
    Map<String,org.openremote.model.value.MetaItemDescriptor<?>>
     
    int
     
    Map<String,Collection<org.openremote.model.value.ValueDescriptor<?>>>
     
    Map<String,org.openremote.model.value.ValueDescriptor<?>>
     
    void
    init(org.openremote.model.Container container)
     
    protected void
     
    boolean
     
    protected <T> Stream<T>
    loadDescriptors(Class<T> descriptorClazz, Path descriptorPath)
     
    protected <T> T
    parse(String jsonString, Class<T> type)
     
    void
    start(org.openremote.model.Container container)
     
    void
    stop(org.openremote.model.Container container)
     
    boolean
     

    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

    Methods inherited from interface org.openremote.model.AssetModelProvider

    onAssetModelFinished
  • Field Details

    • JSON

      protected static com.fasterxml.jackson.databind.ObjectMapper JSON
    • LOG

      protected static Logger LOG
    • DIRECTORY_NAME

      public static final String DIRECTORY_NAME
      See Also:
    • identityService

      protected ManagerIdentityService identityService
    • clientEventService

      protected ClientEventService clientEventService
    • gatewayService

      protected GatewayService gatewayService
    • persistenceService

      protected org.openremote.container.persistence.PersistenceService persistenceService
    • dynamicAssetTypeInfos

      protected Map<String,org.openremote.model.asset.AssetTypeInfo> dynamicAssetTypeInfos
    • storageDir

      protected Path storageDir
  • Constructor Details

    • AssetModelService

      public AssetModelService()
  • Method Details

    • getPriority

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

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

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

      protected void initDynamicModel()
    • 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
    • useAutoScan

      public boolean useAutoScan()
      Specified by:
      useAutoScan in interface org.openremote.model.AssetModelProvider
    • getAssetDescriptors

      public org.openremote.model.asset.AssetDescriptor<?>[] getAssetDescriptors()
      Specified by:
      getAssetDescriptors in interface org.openremote.model.AssetModelProvider
    • getAttributeDescriptors

      public Map<String,Collection<org.openremote.model.value.AttributeDescriptor<?>>> getAttributeDescriptors()
      Specified by:
      getAttributeDescriptors in interface org.openremote.model.AssetModelProvider
    • getMetaItemDescriptors

      public Map<String,Collection<org.openremote.model.value.MetaItemDescriptor<?>>> getMetaItemDescriptors()
      Specified by:
      getMetaItemDescriptors in interface org.openremote.model.AssetModelProvider
    • getValueDescriptors

      public Map<String,Collection<org.openremote.model.value.ValueDescriptor<?>>> getValueDescriptors()
      Specified by:
      getValueDescriptors in interface org.openremote.model.AssetModelProvider
    • isDynamic

      public boolean isDynamic()
      Specified by:
      isDynamic in interface org.openremote.model.AssetModelProvider
    • getAssetInfos

      public org.openremote.model.asset.AssetTypeInfo[] getAssetInfos(String parentId, String parentType)
    • getAssetInfo

      public org.openremote.model.asset.AssetTypeInfo getAssetInfo(String parentId, String assetType)
    • getAssetDescriptors

      public org.openremote.model.asset.AssetDescriptor<?>[] getAssetDescriptors(String parentId, String parentType)
    • getValueDescriptors

      public Map<String,org.openremote.model.value.ValueDescriptor<?>> getValueDescriptors(String parentId)
    • getMetaItemDescriptors

      public Map<String,org.openremote.model.value.MetaItemDescriptor<?>> getMetaItemDescriptors(String parentId)
    • parse

      protected <T> T parse(String jsonString, Class<T> type) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • loadDescriptors

      protected <T> Stream<T> loadDescriptors(Class<T> descriptorClazz, Path descriptorPath)