import org.apache.archiva.redback.components.registry.RegistryException; | import org.apache.archiva.redback.components.registry.RegistryException; | ||||
import org.apache.archiva.redback.components.registry.RegistryListener; | import org.apache.archiva.redback.components.registry.RegistryListener; | ||||
import java.util.List; | |||||
import java.util.Locale; | |||||
/** | /** | ||||
* Configuration holder for the model read from the registry. | * Configuration holder for the model read from the registry. | ||||
*/ | */ | ||||
* @since 1.4-M1 | * @since 1.4-M1 | ||||
*/ | */ | ||||
void reload(); | void reload(); | ||||
public Locale getDefaultLocale(); | |||||
public List<Locale.LanguageRange> getLanguagePriorities(); | |||||
} | } | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Locale; | |||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Map.Entry; | import java.util.Map.Entry; | ||||
import java.util.Set; | import java.util.Set; | ||||
// Section used for default only configuration | // Section used for default only configuration | ||||
private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default"; | private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default"; | ||||
private Locale defaultLocale = Locale.getDefault(); | |||||
private List<Locale.LanguageRange> languagePriorities = new ArrayList<>( ); | |||||
@PostConstruct | |||||
private void init() { | |||||
languagePriorities = Locale.LanguageRange.parse( "en,fr,de" ); | |||||
} | |||||
@Override | @Override | ||||
public Configuration getConfiguration() | public Configuration getConfiguration() | ||||
{ | { | ||||
} | } | ||||
} | } | ||||
this.defaultLocale = Locale.forLanguageTag( config.getArchivaRuntimeConfiguration().getDefaultLanguage() ); | |||||
this.languagePriorities = Locale.LanguageRange.parse(config.getArchivaRuntimeConfiguration().getLanguageRange()); | |||||
return config; | return config; | ||||
} | } | ||||
this.initialize(); | this.initialize(); | ||||
} | } | ||||
@Override | |||||
public Locale getDefaultLocale( ) | |||||
{ | |||||
return defaultLocale; | |||||
} | |||||
@Override | |||||
public List<Locale.LanguageRange> getLanguagePriorities( ) | |||||
{ | |||||
return languagePriorities; | |||||
} | |||||
@Override | @Override | ||||
public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) | public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) | ||||
{ | { |
<name>indexDir</name> | <name>indexDir</name> | ||||
<version>1.0.0+</version> | <version>1.0.0+</version> | ||||
<type>String</type> | <type>String</type> | ||||
<defaultValue></defaultValue> | |||||
<description> | <description> | ||||
The directory for the indexes of this repository. | The directory for the indexes of this repository. | ||||
</description> | </description> | ||||
<name>description</name> | <name>description</name> | ||||
<version>1.0.0+</version> | <version>1.0.0+</version> | ||||
<type>String</type> | <type>String</type> | ||||
<defaultValue></defaultValue> | |||||
<description> | <description> | ||||
The description of this repository. | The description of this repository. | ||||
</description> | </description> | ||||
<type>String</type> | <type>String</type> | ||||
<required>false</required> | <required>false</required> | ||||
</field> | </field> | ||||
<field> | |||||
<name>defaultLanguage</name> | |||||
<type>String</type> | |||||
<version>3.0.0+</version> | |||||
<description>The default language used for setting internationalized strings.</description> | |||||
</field> | |||||
<field> | |||||
<name>languageRange</name> | |||||
<type>String</type> | |||||
<version>3.0.0+</version> | |||||
<description>Comma separated list of language patterns. Sorted by priority descending. Used for display of internationalized strings.</description> | |||||
</field> | |||||
</fields> | </fields> | ||||
</class> | </class> | ||||