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()
RepositorygetId in interface Repositorypublic String getName()
RepositorygetName in interface Repositorypublic String getName(Locale locale)
RepositorygetName in interface Repositorypublic String getDescription()
RepositorygetDescription in interface Repositorypublic String getDescription(Locale locale)
RepositorygetDescription in interface Repositorypublic RepositoryType getType()
RepositorygetType in interface Repositorypublic URI getLocation()
RepositorygetLocation in interface Repositorypublic Path getLocalPath()
RepositorygetLocalPath in interface Repositorypublic Set<URI> getFailoverLocations()
RepositorygetFailoverLocations in interface Repositorypublic boolean isScanned()
RepositoryisScanned in interface Repositorypublic String getSchedulingDefinition()
RepositorygetSchedulingDefinition in interface Repositorypublic abstract boolean hasIndex()
RepositoryhasIndex in interface Repositorypublic String getLayout()
RepositorygetLayout in interface Repositorypublic abstract RepositoryCapabilities getCapabilities()
RepositorygetCapabilities in interface Repositorypublic <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException
RepositorygetFeature in interface RepositoryT - 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)
RepositorysupportsFeature in interface RepositoryT - The requested feature classclazz - The requested feature classpublic Locale getPrimaryLocale()
EditableRepositorygetPrimaryLocale in interface EditableRepositorypublic void setName(Locale locale, String name)
EditableRepositorysetName in interface EditableRepositorylocale - the locale for which the name is setname - The name value in the language that matches the localepublic void setDescription(Locale locale, String description)
EditableRepositorysetDescription in interface EditableRepositorylocale - the locale for which the description is setdescription - The description in the language that matches the locale.public void setLocation(URI location)
EditableRepositorysetLocation in interface EditableRepositorylocation - the location URIpublic void addFailoverLocation(URI location)
EditableRepositoryaddFailoverLocation in interface EditableRepositorylocation - The location that should be used as failover.public void removeFailoverLocation(URI location)
EditableRepositoryremoveFailoverLocation in interface EditableRepositorylocation - the location uri to removepublic void clearFailoverLocations()
EditableRepositoryclearFailoverLocations in interface EditableRepositorypublic void setScanned(boolean scanned)
EditableRepositorysetScanned in interface EditableRepositoryscanned - if true, the repository is scanned regulary.public void setLayout(String layout)
EditableRepositorysetLayout in interface EditableRepositorypublic void setBaseUri(URI baseUri)
EditableRepositorysetBaseUri in interface EditableRepositorypublic void setSchedulingDefinition(String cronExpression)
EditableRepositorycronExpression must be a valid
quartz cron definition.setSchedulingDefinition in interface EditableRepositorycronExpression - the cron expression.protected <T extends RepositoryFeature<T>> void addFeature(RepositoryFeature<T> feature)
public void setIndexingContext(ArchivaIndexingContext context)
EditableRepositorysetIndexingContext in interface EditableRepositorypublic ArchivaIndexingContext getIndexingContext()
RepositorygetIndexingContext in interface Repositorypublic void close()
Repositoryclose in interface Repositorypublic <T> void raise(RepositoryEvent<T> event)
raise in interface RepositoryEventListenerpublic void addListener(RepositoryEventListener listener)
addListener in interface RepositoryEventHandlerpublic void removeListener(RepositoryEventListener listener)
removeListener in interface RepositoryEventHandlerpublic void clearListeners()
clearListeners in interface RepositoryEventHandlerCopyright © 2006–2018 The Apache Software Foundation. All rights reserved.