Class Tools
java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx.Tools
public class Tools extends Object
Some utilities, such as for parameter checking. Public for testing.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields Modifier and Type Field Description private static Map<de.iip_ecosphere.platform.support.aas.AssetKind,org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind>ASSETKINDS2BASYXprivate static Map<org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind,de.iip_ecosphere.platform.support.aas.AssetKind>BASYX2ASSETKINDSprivate static Map<org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef,de.iip_ecosphere.platform.support.aas.Type>BASYX2TYPESprivate static Map<de.iip_ecosphere.platform.support.aas.Type,org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef>TYPES2BASYX -
Constructor Summary
Constructors Constructor Description Tools() -
Method Summary
Modifier and Type Method Description static StringcheckId(String idShort)Checks a given short id for not being empty.static StringcheckUrn(String urn)Checks a given URN for not being empty.(package private) static voiddisposeTomcatWorkingDir(File baseDir, int port)Tries to dispose a Tomcat working directory.static <E extends Enum<E>>
EgetOption(String[] options, E dflt, Class<E> cls)Tests the values inpptionsagainst the constants inclsand returns a matching constant ordflt.(package private) static StringidToUrlPath(String id)Turns an id into a URL path.private static voidmapKind(de.iip_ecosphere.platform.support.aas.AssetKind kind, org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind basyxKind)Maps an implementation-independent asset kind into a BaSyx asset kind.private static voidmapType(de.iip_ecosphere.platform.support.aas.Type type, org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef basyxType)Maps an implementation-independent type into a BaSyx property-value type.static org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKindtranslate(de.iip_ecosphere.platform.support.aas.AssetKind kind)Translates a implementation-independent asset kind to an implementation-specific asset kind.static org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDeftranslate(de.iip_ecosphere.platform.support.aas.Type type)Translates a implementation-independent type to an implementation-specific type.static de.iip_ecosphere.platform.support.aas.AssetKindtranslate(org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind kind)Translates a implementation-specific asset kind to an implementation-independent asset kind.static de.iip_ecosphere.platform.support.aas.Typetranslate(org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef type)Translates a implementation-specific type to an implementation-independent type.static org.eclipse.basyx.submodel.metamodel.api.identifier.IIdentifiertranslateIdentifier(String id, String dfltCustom)Translates an identifier.
-
Field Details
-
TYPES2BASYX
private static final Map<de.iip_ecosphere.platform.support.aas.Type,org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef> TYPES2BASYX -
BASYX2TYPES
private static final Map<org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef,de.iip_ecosphere.platform.support.aas.Type> BASYX2TYPES -
ASSETKINDS2BASYX
private static final Map<de.iip_ecosphere.platform.support.aas.AssetKind,org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind> ASSETKINDS2BASYX -
BASYX2ASSETKINDS
private static final Map<org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind,de.iip_ecosphere.platform.support.aas.AssetKind> BASYX2ASSETKINDS
-
-
Constructor Details
-
Tools
public Tools()
-
-
Method Details
-
mapType
private static void mapType(de.iip_ecosphere.platform.support.aas.Type type, org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef basyxType)Maps an implementation-independent type into a BaSyx property-value type.- Parameters:
type- the implementation-independent typebasyxType- the corresponding BaSyx property-value type
-
mapKind
private static void mapKind(de.iip_ecosphere.platform.support.aas.AssetKind kind, org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind basyxKind)Maps an implementation-independent asset kind into a BaSyx asset kind.- Parameters:
kind- the implementation-independent asset kindbasyxKind- the corresponding BaSyx asset kind
-
checkUrn
Checks a given URN for not being empty.- Parameters:
urn- the URN- Returns:
urn- Throws:
IllegalArgumentException- if the urn is empty or null
-
checkId
Checks a given short id for not being empty.- Parameters:
idShort- the short id- Returns:
idShort- Throws:
IllegalArgumentException- if the id is empty or null
-
translate
public static org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef translate(de.iip_ecosphere.platform.support.aas.Type type)Translates a implementation-independent type to an implementation-specific type.- Parameters:
type- the implementation-independent type- Returns:
- the implementation-specific type
-
translate
public static de.iip_ecosphere.platform.support.aas.Type translate(org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.valuetypedef.PropertyValueTypeDef type)Translates a implementation-specific type to an implementation-independent type.- Parameters:
type- the implementation-specific type- Returns:
- the implementation-independent type
-
translate
public static org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind translate(de.iip_ecosphere.platform.support.aas.AssetKind kind)Translates a implementation-independent asset kind to an implementation-specific asset kind.- Parameters:
kind- the implementation-independent asset kind- Returns:
- the implementation-specific asset kind
-
translate
public static de.iip_ecosphere.platform.support.aas.AssetKind translate(org.eclipse.basyx.aas.metamodel.api.parts.asset.AssetKind kind)Translates a implementation-specific asset kind to an implementation-independent asset kind.- Parameters:
kind- the implementation-specific asset kind- Returns:
- the implementation-independent asset kind
-
idToUrlPath
Turns an id into a URL path.- Parameters:
id- the id- Returns:
- the URL path
-
translateIdentifier
public static org.eclipse.basyx.submodel.metamodel.api.identifier.IIdentifier translateIdentifier(String id, String dfltCustom)Translates an identifier.- Parameters:
id- the id showing some form of type, e.g., prefix "urn:", may be empty or null leading to a custom identifier based ondfltCustomdfltCustom- the default value if id cannot be used- Returns:
- the identifier
-
getOption
Tests the values inpptionsagainst the constants inclsand returns a matching constant ordflt.- Type Parameters:
E- the enum type- Parameters:
options- the options to checkdflt- the default valuecls- the enum class providing the constants- Returns:
- the matching option or
dflt
-
disposeTomcatWorkingDir
Tries to dispose a Tomcat working directory.- Parameters:
baseDir- the basic directory where the working directory is located in, may be null for default, i.e., program home directoryport- the port number of the disposed Tomcat instance
-