Class AssetSpringApp
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckPath(jakarta.servlet.http.HttpServletRequest request) Checks a path for being equipped with requested prefix.org.springframework.security.web.SecurityFilterChainfilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Defines the security filter chain.com.fasterxml.jackson.databind.ObjectMapperReturns 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 voidStarts the application.org.springframework.security.web.SecurityFilterChainsecurityFilterChain(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, waitMethods 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
-
opProvider
-
-
Constructor Details
-
AssetSpringApp
public AssetSpringApp()
-
-
Method Details
-
main
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:
truehas prefix,falseelse
-
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 namerequestData- 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 namerequestData- 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 namerequestData- the request datafunc- the function, may be null- Returns:
- the function execution result
-