public abstract class AbstractRepository extends Object implements EditableRepository, RepositoryEventListener
Modifier and Type | Field and Description |
---|---|
private URI |
baseUri |
static com.cronutils.model.definition.CronDefinition |
CRON_DEFINITION |
private Map<Locale,String> |
descriptions |
private Set<URI> |
failoverLocations |
(package private) Map<Class<? extends RepositoryFeature<?>>,RepositoryFeature<?>> |
featureMap |
private String |
id |
private ArchivaIndexingContext |
indexingContext |
private String |
layout |
private List<RepositoryEventListener> |
listeners |
private URI |
location |
(package private) org.slf4j.Logger |
log |
private Map<Locale,String> |
names |
private Locale |
primaryLocale |
protected Path |
repositoryBase |
private boolean |
scanned |
(package private) String |
schedulingDefinition |
private RepositoryType |
type |
private Set<URI> |
uFailoverLocations |
Constructor and Description |
---|
AbstractRepository(Locale primaryLocale,
RepositoryType type,
String id,
String name,
Path repositoryBase) |
AbstractRepository(RepositoryType type,
String id,
String name,
Path repositoryBase) |
Modifier and Type | Method and Description |
---|---|
void |
addFailoverLocation(URI location)
Adds a failover location for the repository.
|
protected <T extends RepositoryFeature<T>> |
addFeature(RepositoryFeature<T> feature) |
void |
addListener(RepositoryEventListener listener) |
void |
clearFailoverLocations()
Clears the failover location set.
|
void |
clearListeners() |
void |
close()
Closes all resources that are opened by this repository.
|
abstract RepositoryCapabilities |
getCapabilities()
Returns the capabilities of the repository implementation.
|
String |
getDescription()
Returns a description of this repository.
|
String |
getDescription(Locale locale)
Returns the description for the given locale.
|
Set<URI> |
getFailoverLocations()
A repository may allow additional locations that can be used, if the primary location is not available.
|
<T extends RepositoryFeature<T>> |
getFeature(Class<T> clazz)
Extension method that allows to provide different features that are not supported by all
repository types.
|
String |
getId()
Return the identifier of the repository.
|
ArchivaIndexingContext |
getIndexingContext()
Returns a indexing context.
|
String |
getLayout()
Returns a layout definition.
|
Path |
getLocalPath()
Returns the local path that this repository uses, if it stores data locally.
|
URI |
getLocation()
Returns the location of this repository.
|
String |
getName()
This is the display name of the repository.
|
String |
getName(Locale locale)
Returns the name in the given locale.
|
Locale |
getPrimaryLocale()
Returns the primary locale used for setting the default values for
name and description.
|
String |
getSchedulingDefinition()
Returns the definition, when the repository jobs are executed.
|
RepositoryType |
getType()
This identifies the type of repository.
|
abstract boolean |
hasIndex()
Returns true, if this repository has a index available
|
boolean |
isScanned()
True, if this repository is scanned regularly.
|
<T> void |
raise(RepositoryEvent<T> event) |
void |
removeFailoverLocation(URI location)
Removes a failover location from the set.
|
void |
removeListener(RepositoryEventListener listener) |
void |
setBaseUri(URI baseUri)
Sets the base uri for relative location uris.
|
void |
setDescription(Locale locale,
String description)
Sets the description for the given locale
|
void |
setIndexingContext(ArchivaIndexingContext context)
Sets the indexing context reference.
|
void |
setLayout(String layout)
Sets the layout string.
|
void |
setLocation(URI location)
Sets the location of the repository.
|
void |
setName(Locale locale,
String name)
Sets the name for the given locale
|
protected void |
setPrimaryLocale(Locale locale) |
void |
setScanned(boolean scanned)
Sets the flag for scanning the repository.
|
void |
setSchedulingDefinition(String cronExpression)
Sets the scheduling definition, that defines the times, when the regular repository
jobs are started.
|
<T extends RepositoryFeature<T>> |
supportsFeature(Class<T> clazz)
Returns true, if the requested feature is supported by this repository.
|
org.slf4j.Logger log
private final RepositoryType type
private Map<Locale,String> descriptions
private Locale primaryLocale
private Set<URI> failoverLocations
private Set<URI> uFailoverLocations
private boolean scanned
String schedulingDefinition
public static final com.cronutils.model.definition.CronDefinition CRON_DEFINITION
private List<RepositoryEventListener> listeners
Map<Class<? extends RepositoryFeature<?>>,RepositoryFeature<?>> featureMap
protected Path repositoryBase
private ArchivaIndexingContext indexingContext
public AbstractRepository(RepositoryType type, String id, String name, Path repositoryBase)
public AbstractRepository(Locale primaryLocale, RepositoryType type, String id, String name, Path repositoryBase)
protected void setPrimaryLocale(Locale locale)
public String getId()
Repository
getId
in interface Repository
public String getName()
Repository
getName
in interface Repository
public String getName(Locale locale)
Repository
getName
in interface Repository
public String getDescription()
Repository
getDescription
in interface Repository
public String getDescription(Locale locale)
Repository
getDescription
in interface Repository
public RepositoryType getType()
Repository
getType
in interface Repository
public URI getLocation()
Repository
getLocation
in interface Repository
public Path getLocalPath()
Repository
getLocalPath
in interface Repository
public Set<URI> getFailoverLocations()
Repository
getFailoverLocations
in interface Repository
public boolean isScanned()
Repository
isScanned
in interface Repository
public String getSchedulingDefinition()
Repository
getSchedulingDefinition
in interface Repository
public abstract boolean hasIndex()
Repository
hasIndex
in interface Repository
public String getLayout()
Repository
getLayout
in interface Repository
public abstract RepositoryCapabilities getCapabilities()
Repository
getCapabilities
in interface Repository
public <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException
Repository
getFeature
in interface Repository
T
- This is the class of the featureclazz
- The feature class that is requestedUnsupportedFeatureException
- if the feature is not supported by this repository typepublic <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz)
Repository
supportsFeature
in interface Repository
T
- The requested feature classclazz
- The requested feature classpublic Locale getPrimaryLocale()
EditableRepository
getPrimaryLocale
in interface EditableRepository
public void setName(Locale locale, String name)
EditableRepository
setName
in interface EditableRepository
locale
- the locale for which the name is setname
- The name value in the language that matches the localepublic void setDescription(Locale locale, String description)
EditableRepository
setDescription
in interface EditableRepository
locale
- the locale for which the description is setdescription
- The description in the language that matches the locale.public void setLocation(URI location)
EditableRepository
setLocation
in interface EditableRepository
location
- the location URIpublic void addFailoverLocation(URI location)
EditableRepository
addFailoverLocation
in interface EditableRepository
location
- The location that should be used as failover.public void removeFailoverLocation(URI location)
EditableRepository
removeFailoverLocation
in interface EditableRepository
location
- the location uri to removepublic void clearFailoverLocations()
EditableRepository
clearFailoverLocations
in interface EditableRepository
public void setScanned(boolean scanned)
EditableRepository
setScanned
in interface EditableRepository
scanned
- if true, the repository is scanned regulary.public void setLayout(String layout)
EditableRepository
setLayout
in interface EditableRepository
public void setBaseUri(URI baseUri)
EditableRepository
setBaseUri
in interface EditableRepository
public void setSchedulingDefinition(String cronExpression)
EditableRepository
cronExpression
must be a valid
quartz cron definition.setSchedulingDefinition
in interface EditableRepository
cronExpression
- the cron expression.protected <T extends RepositoryFeature<T>> void addFeature(RepositoryFeature<T> feature)
public void setIndexingContext(ArchivaIndexingContext context)
EditableRepository
setIndexingContext
in interface EditableRepository
public ArchivaIndexingContext getIndexingContext()
Repository
getIndexingContext
in interface Repository
public void close()
Repository
close
in interface Repository
public <T> void raise(RepositoryEvent<T> event)
raise
in interface RepositoryEventListener
public void addListener(RepositoryEventListener listener)
addListener
in interface RepositoryEventHandler
public void removeListener(RepositoryEventListener listener)
removeListener
in interface RepositoryEventHandler
public void clearListeners()
clearListeners
in interface RepositoryEventHandler
Copyright © 2006–2018 The Apache Software Foundation. All rights reserved.