java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.apps.asset.AssetSpringApp
All Implemented Interfaces:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@SpringBootApplication @Configuration @ComponentScan(basePackages={"org.eclipse.digitaltwin.basyx","de.iip_ecosphere.platform.support.aas.basyx2.apps.security"}, excludeFilters=) @RestController("AssetApp") @EnableWebSecurity public class AssetSpringApp extends Object implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Spring application representing asset operations. Operations must be registered in the operations provider defined via dependency injection in the application context.
Author:
Holger Eichelberger, SSE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    checkPath(jakarta.servlet.http.HttpServletRequest request)
    Checks a path for being equipped with requested prefix.
    org.springframework.security.web.SecurityFilterChain
    filterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    Defines the security filter chain.
    com.fasterxml.jackson.databind.ObjectMapper
    Returns the configured object mapper for serialization/deserialization.
    org.springframework.http.ResponseEntity<org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[]>
    invokeOperation(String category, String opName, org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[] requestData)
    Generically executes functions defined by the operations provider.
    (package private) static org.springframework.http.ResponseEntity<org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[]>
    invokeOperation(String opName, org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[] requestData, Function<Object[],Object> func)
    Executes a given function.
    org.springframework.http.ResponseEntity<org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[]>
    invokeService(String opName, org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[] requestData)
    Generically executes service functions defined by the operations provider.
    static void
    main(String[] args)
    Starts the application.
    org.springframework.security.web.SecurityFilterChain
    securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity)
    Defines the security filter chain.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer

    addArgumentResolvers, addCorsMappings, addErrorResponseInterceptors, addFormatters, addInterceptors, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
  • Field Details

  • Constructor Details

    • AssetSpringApp

      public AssetSpringApp()
  • Method Details

    • main

      public static void main(String[] args)
      Starts the application.
      Parameters:
      args - the command line arguments
    • getMapper

      @Bean public com.fasterxml.jackson.databind.ObjectMapper getMapper()
      Returns the configured object mapper for serialization/deserialization.
      Returns:
      the object mapper
    • securityFilterChain

      @Profile("!test") @Bean public org.springframework.security.web.SecurityFilterChain securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity) throws Exception
      Defines the security filter chain.
      Parameters:
      httpSecurity - the security object
      Returns:
      the modified/defined filter chain
      Throws:
      Exception - if defining fails
    • checkPath

      private boolean checkPath(jakarta.servlet.http.HttpServletRequest request)
      Checks a path for being equipped with requested prefix.
      Parameters:
      request - the request
      Returns:
      true has prefix, false else
    • filterChain

      @Profile("test") @Bean public org.springframework.security.web.SecurityFilterChain filterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
      Defines the security filter chain.
      Parameters:
      http - the security instance
      Returns:
      the filterchain
      Throws:
      Exception - if something fails
    • invokeService

      @PostMapping("/operations/service/{opName}") public org.springframework.http.ResponseEntity<org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[]> invokeService(@PathVariable("opName") String opName, @RequestBody org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[] requestData)
      Generically executes service functions defined by the operations provider.
      Parameters:
      opName - the operation name
      requestData - the request data
      Returns:
      the operation execution result
    • invokeOperation

      @PostMapping("/operations/{category}/{opName}") public org.springframework.http.ResponseEntity<org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[]> invokeOperation(@PathVariable("category") String category, @PathVariable("opName") String opName, @RequestBody org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[] requestData)
      Generically executes functions defined by the operations provider.
      Parameters:
      opName - the operation name
      requestData - the request data
      Returns:
      the operation execution result
    • invokeOperation

      static org.springframework.http.ResponseEntity<org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[]> invokeOperation(String opName, org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable[] requestData, Function<Object[],Object> func)
      Executes a given function.
      Parameters:
      opName - the operation name
      requestData - the request data
      func - the function, may be null
      Returns:
      the function execution result