Java Code Examples for org.sonatype.nexus.repository.config.Configuration#attributes()

The following examples show how to use org.sonatype.nexus.repository.config.Configuration#attributes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AssetBlobCleanupTaskManager.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Subscribe
@AllowConcurrentEvents
public void on(final RepositoryStartedEvent event) {
  String format = event.getRepository().getFormat().getValue();

  Configuration repositoryConfiguration = event.getRepository().getConfiguration();
  NestedAttributesMap storageAttributes = repositoryConfiguration.attributes(STORAGE);
  String contentStore = (String) storageAttributes.get(DATA_STORE_NAME, CONTENT_DATASTORE_NAME);

  if (activeFormatStores.put(format, contentStore) && isStarted()) {
    scheduleAssetBlobCleanupTask(format, contentStore);
  }
}
 
Example 2
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertHttpClient(final T request, final Configuration configuration) {
  HttpClientAttributes httpClient = request.getHttpClient();
  if (nonNull(httpClient)) {
    NestedAttributesMap httpClientConfiguration = configuration.attributes("httpclient");
    httpClientConfiguration.set("blocked", httpClient.getBlocked());
    httpClientConfiguration.set("autoBlock", httpClient.getAutoBlock());
    HttpClientConnectionAttributes connection = httpClient.getConnection();
    NestedAttributesMap connectionConfiguration = httpClientConfiguration.child("connection");
    convertConnection(connection, connectionConfiguration);
    convertAuthentication(httpClient, httpClientConfiguration);
  }
}
 
Example 3
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertNegativeCache(final T request, final Configuration configuration) {
  NegativeCacheAttributes negativeCache = request.getNegativeCache();
  if (nonNull(negativeCache)) {
    NestedAttributesMap negativeCacheConfiguration = configuration.attributes("negativeCache");
    negativeCacheConfiguration.set("enabled", negativeCache.getEnabled());
    negativeCacheConfiguration.set("timeToLive", negativeCache.getTimeToLive());
  }
}
 
Example 4
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertProxy(final T request, final Configuration configuration) {
  ProxyAttributes proxy = request.getProxy();
  if (nonNull(proxy)) {
    NestedAttributesMap proxyConfiguration = configuration.attributes("proxy");
    proxyConfiguration.set("remoteUrl", proxy.getRemoteUrl());
    proxyConfiguration.set("contentMaxAge", proxy.getContentMaxAge());
    proxyConfiguration.set("metadataMaxAge", proxy.getMetadataMaxAge());
  }
}
 
Example 5
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertCleanup(final T request, final Configuration configuration) {
  CleanupPolicyAttributes cleanup = request.getCleanup();
  if (nonNull(cleanup)) {
    NestedAttributesMap cleanupConfiguration = configuration.attributes("cleanup");
    cleanupConfiguration.set("policyName", Sets.newHashSet(cleanup.getPolicyNames()));
  }
}
 
Example 6
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertStorage(final T request, final Configuration configuration) {
  StorageAttributes storage = request.getStorage();
  if (nonNull(storage)) {
    NestedAttributesMap storageConfiguration = configuration.attributes(STORAGE);
    storageConfiguration.set(BLOB_STORE_NAME, storage.getBlobStoreName());
    storageConfiguration.set(STRICT_CONTENT_TYPE_VALIDATION, storage.getStrictContentTypeValidation());
  }
}
 
Example 7
Source File: ConfigurationFacetImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public <T> T readSection(final Configuration configuration, final String section, final Class<T> type) {
  checkNotNull(configuration);
  checkNotNull(section);
  log.trace("Reading section: {}", section);
  AttributesMap attributes = configuration.attributes(section);
  return convert(attributes.backing(), type);
}