public class SelfContainedContentRepository extends Object implements ContentRepository, org.jboss.msc.service.Service<ContentRepository>
ContentProvider
ContentRepository.Factory
DELETED_CONTENT, MARKED_CONTENT, OBSOLETE_CONTENT_TIMEOUT, SERVICE_NAME
Constructor and Description |
---|
SelfContainedContentRepository() |
Modifier and Type | Method and Description |
---|---|
byte[] |
addContent(InputStream stream)
Add the given content to the repository along with a reference tracked by
name . |
void |
addContentReference(ContentReference reference)
Adds a reference to the content.
|
static void |
addService(org.jboss.msc.service.ServiceTarget serviceTarget)
Install the service.
|
Map<String,Set<String>> |
cleanObsoleteContent()
Clean content that is not referenced from the repository.
|
org.jboss.vfs.VirtualFile |
getContent(byte[] hash)
Get the content as a virtual file.
|
org.jboss.msc.inject.Injector<ContentProvider> |
getContentProviderInjector() |
ContentRepository |
getValue() |
boolean |
hasContent(byte[] hash)
Gets whether content with the given hash is stored in the repository.
|
void |
removeContent(ContentReference reference)
Remove the given content from the repository.
|
void |
start(org.jboss.msc.service.StartContext startContext) |
void |
stop(org.jboss.msc.service.StopContext stopContext) |
boolean |
syncContent(ContentReference reference)
Synchronize content with the given reference.
|
public static void addService(org.jboss.msc.service.ServiceTarget serviceTarget)
public org.jboss.msc.inject.Injector<ContentProvider> getContentProviderInjector()
public byte[] addContent(InputStream stream) throws IOException
ContentRepository
name
.addContent
in interface ContentRepository
stream
- stream from which the content can be read. Cannot be null
null
IOException
- if there is a problem reading the streampublic void addContentReference(ContentReference reference)
ContentRepository
addContentReference
in interface ContentRepository
reference
- a reference to the content to be referenced. This is also used in
ContentRepository.removeContent(ContentReference reference)
public org.jboss.vfs.VirtualFile getContent(byte[] hash)
ContentRepository
getContent
in interface ContentRepository
hash
- the hash. Cannot be null
public boolean hasContent(byte[] hash)
ContentRepository
hasContent
in interface ContentRepository
hash
- the hash. Cannot be null
true
if the repository has content with the given hash.public boolean syncContent(ContentReference reference)
ContentRepository
syncContent
in interface ContentRepository
reference
- the reference to be synchronized. Cannot be null
true
if the repository has content with the given referencepublic void removeContent(ContentReference reference)
ContentRepository
removeContent
in interface ContentRepository
reference
- a reference to the content to be unreferenced. This is also used in
ContentRepository.addContentReference(ContentReference reference)
public Map<String,Set<String>> cleanObsoleteContent()
ContentRepository
cleanObsoleteContent
in interface ContentRepository
public void start(org.jboss.msc.service.StartContext startContext) throws org.jboss.msc.service.StartException
start
in interface org.jboss.msc.service.Service<ContentRepository>
org.jboss.msc.service.StartException
public void stop(org.jboss.msc.service.StopContext stopContext)
stop
in interface org.jboss.msc.service.Service<ContentRepository>
public ContentRepository getValue() throws IllegalStateException, IllegalArgumentException
getValue
in interface org.jboss.msc.value.Value<ContentRepository>
IllegalStateException
IllegalArgumentException
Copyright © 2023 JBoss by Red Hat. All rights reserved.