Package cz.vutbr.fit.layout.impl
Class DefaultArtifactRepository
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.DefaultArtifactRepository
-
- All Implemented Interfaces:
ArtifactRepository
public class DefaultArtifactRepository extends Object implements ArtifactRepository
Default simple in-memory implementation of an ArtifactRepository.- Author:
- burgetr
-
-
Constructor Summary
Constructors Constructor Description DefaultArtifactRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArtifact(Artifact artifact)Adds an artifact to the repository.voidclear()Removes all artifacts from the repository.org.eclipse.rdf4j.model.IRIcreateArtifactIri(Artifact artifact)Generates a unique IRI for a new artifact based on the strategy of the given repository.voiddisconnect()Disconnects the repository.ArtifactgetArtifact(org.eclipse.rdf4j.model.IRI artifactIri)Obtains an artifact from the repository.Collection<Artifact>getArtifactInfo()Obtains the basic information about the artifacts.Collection<org.eclipse.rdf4j.model.IRI>getArtifactIRIs()Obtains a list of all artifact IRIs in the repository.IRIDecodergetIriDecoder()Gets an IRI encoder / decoder usable with this repository.booleanisReadOnly()Checks if the repository should be treated as read-only.voidremoveArtifact(org.eclipse.rdf4j.model.IRI artifactIri)Removes an artifact and all its derived artifacts from the repository.voidreplaceArtifact(org.eclipse.rdf4j.model.IRI artifactIri, Artifact artifact)Sets an IRI to a artifact and stores it into the repository while replacing the eventual existing artifact with that IRI.
-
-
-
Method Detail
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:ArtifactRepositoryChecks if the repository should be treated as read-only. If true is returned, all modification operations such as adding or removing artifacts should fail with a StorageException.- Specified by:
isReadOnlyin interfaceArtifactRepository- Returns:
truewhen the repository is read-only,falseotherwise.
-
getArtifactIRIs
public Collection<org.eclipse.rdf4j.model.IRI> getArtifactIRIs()
Description copied from interface:ArtifactRepositoryObtains a list of all artifact IRIs in the repository.- Specified by:
getArtifactIRIsin interfaceArtifactRepository- Returns:
- The list of all artifacts.
-
getArtifactInfo
public Collection<Artifact> getArtifactInfo()
Description copied from interface:ArtifactRepositoryObtains the basic information about the artifacts. Note that the resulting objects are not necessarily the complete artifacts. UseArtifactRepository.getArtifact(IRI)to load the complete artifacts of the appropriate types.- Specified by:
getArtifactInfoin interfaceArtifactRepository- Returns:
- A collection of objects that represent the available artifacts.
-
getArtifact
public Artifact getArtifact(org.eclipse.rdf4j.model.IRI artifactIri)
Description copied from interface:ArtifactRepositoryObtains an artifact from the repository.- Specified by:
getArtifactin interfaceArtifactRepository- Parameters:
artifactIri- the artifact IRI- Returns:
- the artifact or
nullwhen there is no such artifact available
-
addArtifact
public void addArtifact(Artifact artifact)
Description copied from interface:ArtifactRepositoryAdds an artifact to the repository. If the artifact IRI isnulla new IRI is generated usingArtifactRepository.createArtifactIri(Artifact).- Specified by:
addArtifactin interfaceArtifactRepository- Parameters:
artifact- the artifact to add
-
createArtifactIri
public org.eclipse.rdf4j.model.IRI createArtifactIri(Artifact artifact)
Description copied from interface:ArtifactRepositoryGenerates a unique IRI for a new artifact based on the strategy of the given repository.- Specified by:
createArtifactIriin interfaceArtifactRepository- Parameters:
artifact- the artifact to generate to IRI for- Returns:
- The generated IRI
-
replaceArtifact
public void replaceArtifact(org.eclipse.rdf4j.model.IRI artifactIri, Artifact artifact)Description copied from interface:ArtifactRepositorySets an IRI to a artifact and stores it into the repository while replacing the eventual existing artifact with that IRI.- Specified by:
replaceArtifactin interfaceArtifactRepository- Parameters:
artifactIri- the target IRIartifact- the artifact to store
-
removeArtifact
public void removeArtifact(org.eclipse.rdf4j.model.IRI artifactIri)
Description copied from interface:ArtifactRepositoryRemoves an artifact and all its derived artifacts from the repository.- Specified by:
removeArtifactin interfaceArtifactRepository- Parameters:
artifactIri- the artifact IRI
-
clear
public void clear()
Description copied from interface:ArtifactRepositoryRemoves all artifacts from the repository.- Specified by:
clearin interfaceArtifactRepository
-
getIriDecoder
public IRIDecoder getIriDecoder()
Description copied from interface:ArtifactRepositoryGets an IRI encoder / decoder usable with this repository.- Specified by:
getIriDecoderin interfaceArtifactRepository- Returns:
-
disconnect
public void disconnect()
Description copied from interface:ArtifactRepositoryDisconnects the repository.- Specified by:
disconnectin interfaceArtifactRepository
-
-