public String getString( String key, String defaultValue ) { String value = lookupRegistry.getString( key, defaultValue ); return value; }
private Registry readDefaultOnlyConfiguration() { registry.removeSubset(KEY_DEFAULT_ONLY); try { registry.addConfigurationFromResource("org/apache/archiva/configuration/default-archiva.xml", KEY_DEFAULT_ONLY); } catch (RegistryException e) { throw new ConfigurationRuntimeException( "Fatal error: Unable to find the built-in default configuration and load it into the registry", e); } return registry.getSubset(KEY_DEFAULT_ONLY); }
public boolean getBoolean( String key ) { return lookupRegistry.getBoolean( key ); }
private void addRegistryChangeListener(RegistryListener listener) { Registry section = registry.getSection(KEY + ".user"); if (section != null) { section.addChangeListener(listener); } section = registry.getSection(KEY + ".base"); if (section != null) { section.addChangeListener(listener); } }
public Collection<String> getKeys() { return this.registry.getSubset( PREFIX ).getFullKeys(); } }
int order = registry.getInt( prefix + "order", value.getOrder() ); value.setOrder( order ); List<String> sourceRepoIdList = registry.getList( prefix + "sourceRepoId" ); String sourceRepoId = value.getSourceRepoId(); if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty() ) List<String> targetRepoIdList = registry.getList( prefix + "targetRepoId" ); String targetRepoId = value.getTargetRepoId(); if (targetRepoIdList != null && !targetRepoIdList.isEmpty() ) List<String> proxyIdList = registry.getList( prefix + "proxyId" ); String proxyId = value.getProxyId(); if (proxyIdList != null && !proxyIdList.isEmpty() ) blackListPatterns.addAll( registry.getList( prefix + "blackListPatterns.blackListPattern" ) ); value.setBlackListPatterns( blackListPatterns ); java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/(); whiteListPatterns.addAll( registry.getList( prefix + "whiteListPatterns.whiteListPattern" ) ); value.setWhiteListPatterns( whiteListPatterns ); java.util.Map policies = registry.getProperties( prefix + "policies" ); value.setPolicies( policies ); java.util.Map properties = registry.getProperties( prefix + "properties" ); value.setProperties( properties ); boolean disabled = registry.getBoolean( prefix + "disabled", value.isDisabled() ); value.setDisabled( disabled );
List<String> idList = registry.getList( prefix + "id" ); String id = value.getId(); if (idList != null && !idList.isEmpty() ) List<String> protocolList = registry.getList( prefix + "protocol" ); String protocol = value.getProtocol(); if (protocolList != null && !protocolList.isEmpty() ) List<String> hostList = registry.getList( prefix + "host" ); String host = value.getHost(); if (hostList != null && !hostList.isEmpty() ) int port = registry.getInt( prefix + "port", value.getPort() ); value.setPort( port ); List<String> usernameList = registry.getList( prefix + "username" ); String username = value.getUsername(); if (usernameList != null && !usernameList.isEmpty() ) List<String> passwordList = registry.getList( prefix + "password" ); String password = value.getPassword(); if (passwordList != null && !passwordList.isEmpty() ) boolean useNtlm = registry.getBoolean( prefix + "useNtlm", value.isUseNtlm() ); value.setUseNtlm( useNtlm );
List<String> sourceRepoIdList = registry.getList( prefix + "sourceRepoId" ); String sourceRepoId = value.getSourceRepoId(); if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty() ) List<String> targetRepoIdList = registry.getList( prefix + "targetRepoId" ); String targetRepoId = value.getTargetRepoId(); if (targetRepoIdList != null && !targetRepoIdList.isEmpty() ) List<String> proxyIdList = registry.getList( prefix + "proxyId" ); String proxyId = value.getProxyId(); if (proxyIdList != null && !proxyIdList.isEmpty() ) blackListPatterns.addAll( registry.getList( prefix + "blackListPatterns.blackListPattern" ) ); value.setBlackListPatterns( blackListPatterns ); java.util.List whiteListPatterns = new java.util.ArrayList/*<String>*/(); whiteListPatterns.addAll( registry.getList( prefix + "whiteListPatterns.whiteListPattern" ) ); value.setWhiteListPatterns( whiteListPatterns ); java.util.Map policies = registry.getProperties( prefix + "policies" ); value.setPolicies( policies ); java.util.Map properties = registry.getProperties( prefix + "properties" ); value.setProperties( properties ); boolean disabled = registry.getBoolean( prefix + "disabled", value.isDisabled() ); value.setDisabled( disabled );
private RedbackRuntimeConfiguration readRedbackRuntimeConfiguration( String prefix, Registry registry ) { RedbackRuntimeConfiguration value = new RedbackRuntimeConfiguration(); boolean migratedFromRedbackConfiguration = registry.getBoolean( prefix + "migratedFromRedbackConfiguration", value.isMigratedFromRedbackConfiguration() ); value.setMigratedFromRedbackConfiguration( migratedFromRedbackConfiguration ); java.util.List userManagerImpls = new java.util.ArrayList/*<String>*/(); userManagerImpls.addAll( registry.getList( prefix + "userManagerImpls.userManagerImpl" ) ); value.setUserManagerImpls( userManagerImpls ); java.util.List rbacManagerImpls = new java.util.ArrayList/*<String>*/(); rbacManagerImpls.addAll( registry.getList( prefix + "rbacManagerImpls.rbacManagerImpl" ) ); value.setRbacManagerImpls( rbacManagerImpls ); LdapConfiguration ldapConfiguration = readLdapConfiguration( prefix + "ldapConfiguration.", registry ); value.setLdapConfiguration( ldapConfiguration ); java.util.List ldapGroupMappings = new java.util.ArrayList/*<LdapGroupMapping>*/(); List ldapGroupMappingsSubsets = registry.getSubsetList( prefix + "ldapGroupMappings.ldapGroupMapping" ); for ( Iterator i = ldapGroupMappingsSubsets.iterator(); i.hasNext(); ) { LdapGroupMapping v = readLdapGroupMapping( "", (Registry) i.next() ); ldapGroupMappings.add( v ); } value.setLdapGroupMappings( ldapGroupMappings ); java.util.Map configurationProperties = registry.getProperties( prefix + "configurationProperties" ); value.setConfigurationProperties( configurationProperties ); boolean useUsersCache = registry.getBoolean( prefix + "useUsersCache", value.isUseUsersCache() ); value.setUseUsersCache( useUsersCache ); CacheConfiguration usersCacheConfiguration = readCacheConfiguration( prefix + "usersCacheConfiguration.", registry ); value.setUsersCacheConfiguration( usersCacheConfiguration ); return value; }
Registry subset = registry.getSubset( KEY ); if ( subset.getString( "version" ) == null ) if ( subset.getSubset( "repositoryScanning" ).isEmpty() ) registry.removeSubset( KEY + ".repositories" );
private NetworkConfiguration readNetworkConfiguration( String prefix, Registry registry ) { NetworkConfiguration value = new NetworkConfiguration(); int maxTotal = registry.getInt( prefix + "maxTotal", value.getMaxTotal() ); value.setMaxTotal( maxTotal ); int maxTotalPerHost = registry.getInt( prefix + "maxTotalPerHost", value.getMaxTotalPerHost() ); value.setMaxTotalPerHost( maxTotalPerHost ); boolean usePooling = registry.getBoolean( prefix + "usePooling", value.isUsePooling() ); value.setUsePooling( usePooling ); return value; }
@SuppressWarnings("unchecked") public List<String> getList( String key ) { return lookupRegistry.getList( key ); }
private RepositoryScanningConfiguration readRepositoryScanningConfiguration( String prefix, Registry registry ) { RepositoryScanningConfiguration value = new RepositoryScanningConfiguration(); java.util.List fileTypes = new java.util.ArrayList/*<FileType>*/(); List fileTypesSubsets = registry.getSubsetList( prefix + "fileTypes.fileType" ); for ( Iterator i = fileTypesSubsets.iterator(); i.hasNext(); ) { FileType v = readFileType( "", (Registry) i.next() ); fileTypes.add( v ); } value.setFileTypes( fileTypes ); java.util.List knownContentConsumers = new java.util.ArrayList/*<String>*/(); knownContentConsumers.addAll( registry.getList( prefix + "knownContentConsumers.knownContentConsumer" ) ); value.setKnownContentConsumers( knownContentConsumers ); java.util.List invalidContentConsumers = new java.util.ArrayList/*<String>*/(); invalidContentConsumers.addAll( registry.getList( prefix + "invalidContentConsumers.invalidContentConsumer" ) ); value.setInvalidContentConsumers( invalidContentConsumers ); return value; }
public synchronized void save(Configuration configuration) throws IndeterminateConfigurationException, RegistryException { Registry section = registry.getSection(KEY + ".user"); Registry baseSection = registry.getSection(KEY + ".base"); if (section == null) { section = baseSection; Collection<String> keys = baseSection.getKeys(); boolean foundList = false; for (Iterator<String> i = keys.iterator(); i.hasNext() && !foundList; ) { section.removeSubset("managedRepositories"); section.removeSubset("remoteRepositories"); section.removeSubset("proxyConnectors"); section.removeSubset("networkProxies"); section.removeSubset("legacyArtifactPaths"); section.removeSubset("repositoryGroups"); section.removeSubset("repositoryScanning.knownContentConsumers"); section.removeSubset("repositoryScanning.invalidContentConsumers"); section.removeSubset("archivaRuntimeConfiguration.defaultCheckPaths");
registry.addConfigurationFromResource( DEFAULT_CONFIG_RESOURCE, PREFIX ); registry.addConfigurationFromResource( DEFAULT_CONFIG_RESOURCE, PREFIX ); lookupRegistry = registry.getSubset( PREFIX ); log.debug( "User configuration {}", lookupRegistry.dump() );
boolean showFindArtifacts = registry.getBoolean( prefix + "showFindArtifacts", value.isShowFindArtifacts() ); value.setShowFindArtifacts( showFindArtifacts ); boolean appletFindEnabled = registry.getBoolean( prefix + "appletFindEnabled", value.isAppletFindEnabled() ); value.setAppletFindEnabled( appletFindEnabled ); boolean disableEasterEggs = registry.getBoolean( prefix + "disableEasterEggs", value.isDisableEasterEggs() ); value.setDisableEasterEggs( disableEasterEggs ); List<String> applicationUrlList = registry.getList( prefix + "applicationUrl" ); String applicationUrl = value.getApplicationUrl(); if (applicationUrlList != null && !applicationUrlList.isEmpty() ) boolean disableRegistration = registry.getBoolean( prefix + "disableRegistration", value.isDisableRegistration() ); value.setDisableRegistration( disableRegistration );
List<String> idList = registry.getList( prefix + "id" ); String id = value.getId(); if (idList != null && !idList.isEmpty() ) List<String> mergedIndexPathList = registry.getList( prefix + "mergedIndexPath" ); String mergedIndexPath = value.getMergedIndexPath(); if (mergedIndexPathList != null && !mergedIndexPathList.isEmpty() ) int mergedIndexTtl = registry.getInt( prefix + "mergedIndexTtl", value.getMergedIndexTtl() ); value.setMergedIndexTtl( mergedIndexTtl ); List<String> cronExpressionList = registry.getList( prefix + "cronExpression" ); String cronExpression = value.getCronExpression(); if (cronExpressionList != null && !cronExpressionList.isEmpty() ) repositories.addAll( registry.getList( prefix + "repositories.repository" ) ); value.setRepositories( repositories );
public int getInt( String key, int defaultValue ) { return lookupRegistry.getInt( key, defaultValue ); }
public static Result submit() { User user = User.getCurrentUser(); if (user == null) return unauthorized("You must log in"); modelForm = modelForm.bindFromRequest(); if (modelForm.hasErrors()) { return badRequest(views.html.Registry.form.render(modelForm)); } // At this point you have a logged User obj which is not null, // you have modelForm without errors (checked previously) // so you need to only add the user to form and save it. Registry registry = modelForm.get(); registry.creationUser = user; registry.save(); flash("success", "Twój log został zapisany w bazie."); return redirect(routes.Index.index()); }