Class VabOperationsProvider
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,java.lang.Object>
-
- de.iip_ecosphere.platform.support.aas.basyx.VabOperationsProvider
-
- All Implemented Interfaces:
de.iip_ecosphere.platform.support.aas.OperationsProvider,java.io.Serializable,java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
public class VabOperationsProvider extends java.util.HashMap<java.lang.String,java.lang.Object> implements de.iip_ecosphere.platform.support.aas.OperationsProviderImplements a simple VAB operations provider following a simple status/operations/service structure as the VABMapProvider. The idea is to attach the relevant operations of an implementing object to this provider, whereby the implementing object is actually providing the functionality and this provider just acts as an intermediary. For this purpose, you can register function objects for operations and supplier/consumer objects of the implementing object in the provider. The provider then offers the respective access under- "status"/propertyName
- "operations"/"service"/operationName
constant. The respective invocables must follow this naming schema for access. An instance of this class can be used as a kind of implicit builder, i.e., operations to define properties and operations return the instance the operation is called on. Ultimately, callcreateModelProvider()which turns this instance into a model provider to be utilized to create a server.- Author:
- Holger Eichelberger, SSE
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classVabOperationsProvider.EntryAn entry as last element of a potentially hierarchically nested access path.private static classVabOperationsProvider.KindThe main kinds of entries.private static classVabOperationsProvider.PropertyRepresents a property consisting of a consumer and a supplier function.private classVabOperationsProvider.VABElementHandlerDefines the implementation to handle VAB elements, i.e., the mappings to the defined operations and functions.(package private) static classVabOperationsProvider.VabHttpOperationsBuilderThe protocol server builder for this provider.(package private) static classVabOperationsProvider.VabTcpOperationsBuilderThe protocol server builder for this provider.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.function.Function<java.lang.Object[],java.lang.Object>>operationFunctionsprivate java.util.Map<java.lang.String,java.util.Map<java.lang.String,VabOperationsProvider.Entry>>operationsstatic java.lang.StringOPERATIONSThe path prefix for operations.static java.lang.StringPREFIX_OPERATIONSA convenient combination ofOPERATIONS+SEPARATOR.static java.lang.StringPREFIX_SERVICEstatic java.lang.StringPREFIX_STATUSprivate java.util.Map<java.lang.String,VabOperationsProvider.Property>propertiesstatic java.lang.StringSEPARATORThe path separator.private static longserialVersionUIDprivate java.util.Map<java.lang.String,VabOperationsProvider.Entry>servicestatic java.lang.StringSERVICEThe operations category sub-path for operations.private java.util.Map<java.lang.String,VabOperationsProvider.Entry>statusstatic java.lang.StringSTATUSThe path prefix for status/properties.
-
Constructor Summary
Constructors Constructor Description VabOperationsProvider()Creates a VAB operations provider instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.basyx.vab.modelprovider.generic.VABModelProvidercreateModelProvider()Ultimately creates the model provider.VabOperationsProviderdefineOperation(java.lang.String category, java.lang.String name, java.util.function.Function<java.lang.Object[],java.lang.Object> function)VabOperationsProviderdefineProperty(java.lang.String name, java.util.function.Supplier<java.lang.Object> get, java.util.function.Consumer<java.lang.Object> set)VabOperationsProviderdefineServiceFunction(java.lang.String name, java.util.function.Function<java.lang.Object[],java.lang.Object> function)java.util.function.Supplier<java.lang.Object>getGetter(java.lang.String name)java.util.function.Function<java.lang.Object[],java.lang.Object>getOperation(java.lang.String category, java.lang.String name)protected java.lang.StringgetOperationsPath()Returns the base path name for operations.java.util.function.Function<java.lang.Object[],java.lang.Object>getServiceFunction(java.lang.String name)protected java.lang.StringgetServicePath()Returns the base (sub-)path name for services.java.util.function.Consumer<java.lang.Object>getSetter(java.lang.String name)protected java.lang.StringgetStatusPath()Returns the base path name for status/properties.private java.lang.StringmakeUnique(java.util.Map<java.lang.String,?> map, java.lang.String baseName)Makes a name unique within its kind, i.e., the given map.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Field Detail
-
SEPARATOR
public static final java.lang.String SEPARATOR
The path separator.- See Also:
- Constant Field Values
-
STATUS
public static final java.lang.String STATUS
The path prefix for status/properties.- See Also:
- Constant Field Values
-
PREFIX_STATUS
public static final java.lang.String PREFIX_STATUS
- See Also:
- Constant Field Values
-
OPERATIONS
public static final java.lang.String OPERATIONS
The path prefix for operations.- See Also:
- Constant Field Values
-
PREFIX_OPERATIONS
public static final java.lang.String PREFIX_OPERATIONS
A convenient combination ofOPERATIONS+SEPARATOR.- See Also:
- Constant Field Values
-
SERVICE
public static final java.lang.String SERVICE
The operations category sub-path for operations.- See Also:
- Constant Field Values
-
PREFIX_SERVICE
public static final java.lang.String PREFIX_SERVICE
- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
status
private java.util.Map<java.lang.String,VabOperationsProvider.Entry> status
-
operations
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,VabOperationsProvider.Entry>> operations
-
service
private java.util.Map<java.lang.String,VabOperationsProvider.Entry> service
-
properties
private java.util.Map<java.lang.String,VabOperationsProvider.Property> properties
-
operationFunctions
private java.util.Map<java.lang.String,java.util.function.Function<java.lang.Object[],java.lang.Object>> operationFunctions
-
-
Method Detail
-
getStatusPath
protected java.lang.String getStatusPath()
Returns the base path name for status/properties. Allows for overriding the default settings.- Returns:
- the path name, by default
STATUS
-
getOperationsPath
protected java.lang.String getOperationsPath()
Returns the base path name for operations. Allows for overriding the default settings.- Returns:
- the path name, by default
OPERATIONS
-
getServicePath
protected java.lang.String getServicePath()
Returns the base (sub-)path name for services. Allows for overriding the default settings.- Returns:
- the path name, by default
SERVICE(interpreted as sub-path ofgetOperationsPath().
-
createModelProvider
public org.eclipse.basyx.vab.modelprovider.generic.VABModelProvider createModelProvider()
Ultimately creates the model provider.- Returns:
- the model provider
-
makeUnique
private java.lang.String makeUnique(java.util.Map<java.lang.String,?> map, java.lang.String baseName)Makes a name unique within its kind, i.e., the given map.- Parameters:
map- the mapbaseName- the (base) name to be made unique- Returns:
- the unique name
-
defineOperation
public VabOperationsProvider defineOperation(java.lang.String category, java.lang.String name, java.util.function.Function<java.lang.Object[],java.lang.Object> function)
- Specified by:
defineOperationin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
getOperation
public java.util.function.Function<java.lang.Object[],java.lang.Object> getOperation(java.lang.String category, java.lang.String name)- Specified by:
getOperationin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
getServiceFunction
public java.util.function.Function<java.lang.Object[],java.lang.Object> getServiceFunction(java.lang.String name)
- Specified by:
getServiceFunctionin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
defineServiceFunction
public VabOperationsProvider defineServiceFunction(java.lang.String name, java.util.function.Function<java.lang.Object[],java.lang.Object> function)
- Specified by:
defineServiceFunctionin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
defineProperty
public VabOperationsProvider defineProperty(java.lang.String name, java.util.function.Supplier<java.lang.Object> get, java.util.function.Consumer<java.lang.Object> set)
- Specified by:
definePropertyin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
getGetter
public java.util.function.Supplier<java.lang.Object> getGetter(java.lang.String name)
- Specified by:
getGetterin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
getSetter
public java.util.function.Consumer<java.lang.Object> getSetter(java.lang.String name)
- Specified by:
getSetterin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider
-
-