Class ArtifactTypeMappingStore
java.lang.Object
com.sodius.oslc.server.process.types.ArtifactTypeMappingStore
Manages persistence of
ArtifactTypeMapping instances.- Since:
- 3.7.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe resource type mapped to a native artifact type for linking (with possibly some policies).static interfaceEncapsulates the methods to resolve the default artifact type mappings and containers. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArtifactTypeMappingStore(ArtifactTypeMappingStore.ContainerDefaultsProvider containerDefaultsProvider) -
Method Summary
Modifier and TypeMethodDescriptiongetArtifactTypeMapping(String containerId, String artifactTypeId) Gets the custom artifact type mapping of a container and an artifact type.Gets the container defaults provider.getContainerMappings(String containerId) Gets the custom artifact type mappings of a single container.getContainersMappings(Set<String> containerIds) Gets the custom artifact type mappings of a given set of containers.static ArtifactTypeMappingStoreReturns the current store instance.abstract voidremoveArtifactTypeMapping(String containerId, String artifactTypeId) Removes a custom mapping.abstract voidremoveArtifactTypeMappings(String containerId) Removes all custom mappings of a container.abstract voidsaveArtifactTypeMapping(String containerId, String artifactTypeId, ArtifactTypeMappingStore.ArtifactTypeMappingValue mapping) Stores a custom artifact type mapping of a container and artifact type.static voidReplaces the current store instance with the given one.
-
Constructor Details
-
ArtifactTypeMappingStore
protected ArtifactTypeMappingStore(ArtifactTypeMappingStore.ContainerDefaultsProvider containerDefaultsProvider)
-
-
Method Details
-
getInstance
Returns the current store instance.- Returns:
- the current instance.
- See Also:
-
setInstance
Replaces the current store instance with the given one.- Parameters:
store- the new store.
-
getContainerDefaultsProvider
Gets the container defaults provider.- Returns:
- the container defaults provider.
- Since:
- 4.2.0
-
getArtifactTypeMapping
public abstract Optional<ArtifactTypeMappingStore.ArtifactTypeMappingValue> getArtifactTypeMapping(String containerId, String artifactTypeId) throws ArtifactTypeMappingStoreException Gets the custom artifact type mapping of a container and an artifact type.- Parameters:
containerId- the container id.artifactTypeId- the artifact type id.- Returns:
- an empty optional if no custom mapping exist for the given container and artifact type; its contained reference otherwise.
- Throws:
ArtifactTypeMappingStoreException- if an error occurs while querying the store.- Since:
- 4.2.0
-
getContainersMappings
public abstract Map<String,Map<String, getContainersMappingsArtifactTypeMappingStore.ArtifactTypeMappingValue>> (Set<String> containerIds) throws ArtifactTypeMappingStoreException Gets the custom artifact type mappings of a given set of containers.Implementations must provide the stored mapping for each artifact type, in the underlying application, per requested (and stored) container.
- Parameters:
containerIds- the container ids to retrieve custom mappings for.- Returns:
- the custom stored mappings per artifact type id per container id.
- Throws:
ArtifactTypeMappingStoreException- if an error occurs while querying the store.- Since:
- 4.2.0
-
getContainerMappings
public Map<String,ArtifactTypeMappingStore.ArtifactTypeMappingValue> getContainerMappings(String containerId) throws ArtifactTypeMappingStoreException Gets the custom artifact type mappings of a single container.An empty map is returned when the container id is not found in the result of
getContainersMappings(Set), or when its mapped value is itself empty. These two cases are indistinguishable from this method's return value alone.- Parameters:
containerId- the container id to retrieve custom mappings for.- Returns:
- the custom stored mappings per artifact type id for the given container, or an empty map if none are found.
- Throws:
ArtifactTypeMappingStoreException- if an error occurs while querying the store.- Since:
- 4.2.0
-
saveArtifactTypeMapping
public abstract void saveArtifactTypeMapping(String containerId, String artifactTypeId, ArtifactTypeMappingStore.ArtifactTypeMappingValue mapping) throws ArtifactTypeMappingStoreException Stores a custom artifact type mapping of a container and artifact type.- Parameters:
containerId- the container id.artifactTypeId- the artifact type id.mapping- the custom mapping to save- Throws:
ArtifactTypeMappingStoreException- if an error occurs while saving the store.
-
removeArtifactTypeMapping
public abstract void removeArtifactTypeMapping(String containerId, String artifactTypeId) throws ArtifactTypeMappingStoreException Removes a custom mapping.- Parameters:
containerId- the container id.artifactTypeId- the artifact type id.- Throws:
ArtifactTypeMappingStoreException- if an error occurs while removing from the store.- Since:
- 4.2.0
-
removeArtifactTypeMappings
public abstract void removeArtifactTypeMappings(String containerId) throws ArtifactTypeMappingStoreException Removes all custom mappings of a container.- Parameters:
containerId- the container id.- Throws:
ArtifactTypeMappingStoreException- if an error occurs while removing from the store.- Since:
- 4.2.0
-