Class AbstractPersistenceRecipe
- java.lang.Object
-
- de.iip_ecosphere.platform.support.aas.basyx.AbstractPersistenceRecipe
-
- All Implemented Interfaces:
de.iip_ecosphere.platform.support.aas.PersistenceRecipe
- Direct Known Subclasses:
AasxPersistenceRecipe,JsonPersistenceRecipe,XmlPersistenceRecipe
public abstract class AbstractPersistenceRecipe extends java.lang.Object implements de.iip_ecosphere.platform.support.aas.PersistenceRecipeBasic supporting functions for persistency.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<de.iip_ecosphere.platform.support.FileFormat>formats
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPersistenceRecipe(de.iip_ecosphere.platform.support.FileFormat... formats)Creates a persistence recipe instance with given file formats.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static <T> voidaddAsset(de.iip_ecosphere.platform.support.aas.Aas aas, java.util.Collection<T> assetList, java.lang.Class<T> assetCls)Adds the asset fromaastoassetListif feasible.protected static org.eclipse.basyx.aas.metamodel.map.AssetAdministrationShellensureLocal(org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell aas)Returns that the result is a local AAS, e.g., a connected AAS is turned transparently into a local copy.protected static org.eclipse.basyx.submodel.metamodel.map.SubmodelensureLocal(org.eclipse.basyx.submodel.metamodel.api.ISubmodel submodel)Returns that the result is a local submodel, e.g., a connected submodel is turned transparently into a local copy.java.util.Collection<de.iip_ecosphere.platform.support.FileFormat>getSupportedFormats()protected static booleanisValidForWriting(org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset asset)Returns whether the givenassetis valid for writing.protected voidtransform(java.util.List<? extends org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell> aas, java.util.List<? extends org.eclipse.basyx.submodel.metamodel.api.ISubmodel> submodels, java.util.List<? extends org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset> assets, java.util.List<de.iip_ecosphere.platform.support.aas.Aas> result)Transforms a list of relatedaasandsubmodelsto a list ofAasinstances of the abstraction.
-
-
-
Method Detail
-
getSupportedFormats
public java.util.Collection<de.iip_ecosphere.platform.support.FileFormat> getSupportedFormats()
- Specified by:
getSupportedFormatsin interfacede.iip_ecosphere.platform.support.aas.PersistenceRecipe
-
transform
protected void transform(java.util.List<? extends org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell> aas, java.util.List<? extends org.eclipse.basyx.submodel.metamodel.api.ISubmodel> submodels, java.util.List<? extends org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset> assets, java.util.List<de.iip_ecosphere.platform.support.aas.Aas> result) throws java.io.IOExceptionTransforms a list of relatedaasandsubmodelsto a list ofAasinstances of the abstraction.- Parameters:
aas- the AAS to transformsubmodels- the sub-models to transform/link toaasassets- the assets to transform/link toaasresult- the resultingAasinstances (to be modified as a side effect)- Throws:
java.io.IOException- in case that something goes wrong
-
addAsset
protected static <T> void addAsset(de.iip_ecosphere.platform.support.aas.Aas aas, java.util.Collection<T> assetList, java.lang.Class<T> assetCls)Adds the asset fromaastoassetListif feasible.- Type Parameters:
T- the type of the asset- Parameters:
aas- the AAS to take the asset fromassetList- the asset list to be modified as a side effectassetCls- the asset class- Throws:
java.lang.IllegalArgumentException- if the wrong asset instance comes in- See Also:
isValidForWriting(IAsset)
-
isValidForWriting
protected static boolean isValidForWriting(org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset asset)
Returns whether the givenassetis valid for writing.- Parameters:
asset- the asset to check- Returns:
trueif valid,falseelse
-
ensureLocal
protected static org.eclipse.basyx.aas.metamodel.map.AssetAdministrationShell ensureLocal(org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell aas)
Returns that the result is a local AAS, e.g., a connected AAS is turned transparently into a local copy.- Parameters:
aas- the AAS to check- Returns:
- the local AAS (null if
aasis neither a local nor a connected AAS)
-
ensureLocal
protected static org.eclipse.basyx.submodel.metamodel.map.Submodel ensureLocal(org.eclipse.basyx.submodel.metamodel.api.ISubmodel submodel)
Returns that the result is a local submodel, e.g., a connected submodel is turned transparently into a local copy.- Parameters:
submodel- the submodel to check- Returns:
- the local submodel (null if
submodelis neither a local nor a connected submodel)
-
-