Java Code Examples for org.sonatype.nexus.blobstore.api.BlobStoreConfiguration#setType()
The following examples show how to use
org.sonatype.nexus.blobstore.api.BlobStoreConfiguration#setType() .
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: GoogleCloudBlobstoreApiResource.java From nexus-blobstore-google-cloud with Eclipse Public License 1.0 | 6 votes |
@POST @RequiresAuthentication @RequiresPermissions("nexus:blobstores:create") @Override public GoogleCloudBlobstoreApiModel create(@Valid final GoogleCloudBlobstoreApiModel model) throws Exception { if (blobStoreManager.get(model.getName()) != null) { throw new WebApplicationMessageException(Status.BAD_REQUEST, "A blob store with that name already exists"); } BlobStoreConfiguration config = blobStoreManager.newConfiguration(); config.setType(GoogleCloudBlobStore.TYPE); merge(config, model); BlobStore blobStore = blobStoreManager.create(config); return new GoogleCloudBlobstoreApiModel(blobStore.getBlobStoreConfiguration()); }
Example 2
Source File: GoogleCloudBlobStoreITSupport.java From nexus-blobstore-google-cloud with Eclipse Public License 1.0 | 6 votes |
public BlobStoreConfiguration newConfiguration(final String name, final String bucketName, @Nullable final File credentialFile) { BlobStoreConfiguration configuration = blobStoreManager.newConfiguration(); configuration.setName(name); configuration.setType("Google Cloud Storage"); NestedAttributesMap configMap = configuration.attributes("google cloud storage"); configMap.set("bucket", bucketName); configMap.set("location", "us-central1"); if (credentialFile != null) { configMap.set("credential_file", credentialFile.getAbsolutePath()); } NestedAttributesMap quotaMap = configuration.attributes(BlobStoreQuotaSupport.ROOT_KEY); quotaMap.set(BlobStoreQuotaSupport.TYPE_KEY, SpaceUsedQuota.ID); quotaMap.set(BlobStoreQuotaSupport.LIMIT_KEY, 512000L); return configuration; }
Example 3
Source File: BlobStoreRule.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
public BlobStore createFile(String name) throws Exception { BlobStoreConfiguration config = blobStoreManagerProvider.get().newConfiguration(); config.setName(name); config.setType(FileBlobStore.TYPE); config.attributes(FileBlobStore.CONFIG_KEY).set(PATH_KEY, name); BlobStore blobStore = blobStoreManagerProvider.get().create(config); blobStoreNames.add(name); return blobStore; }
Example 4
Source File: BlobStoreRule.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
public BlobStore createGroup(String name, String... members) throws Exception { BlobStoreConfiguration config = blobStoreManagerProvider.get().newConfiguration(); config.setName(name); config.setType(BlobStoreGroup.TYPE); config.attributes(BlobStoreGroup.CONFIG_KEY).set(BlobStoreGroup.MEMBERS_KEY, asList(members)); config.attributes(BlobStoreGroup.CONFIG_KEY).set(BlobStoreGroup.FILL_POLICY_KEY, WriteToFirstMemberFillPolicy.TYPE); BlobStore blobStore = blobStoreManagerProvider.get().create(config); blobStoreGroupNames.add(name); return blobStore; }
Example 5
Source File: FileBlobStoreApiModel.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override public BlobStoreConfiguration toBlobStoreConfiguration(final BlobStoreConfiguration configuration) { BlobStoreConfiguration newConfig = super.toBlobStoreConfiguration(configuration); newConfig.setType(FileBlobStore.TYPE); newConfig.attributes(FileBlobStore.CONFIG_KEY).set(FileBlobStore.PATH_KEY, path); return newConfig; }
Example 6
Source File: FileBlobStoreConfigurationBuilder.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
/** * Creates the configuration for the desired file blob store. */ public BlobStoreConfiguration build() { final BlobStoreConfiguration configuration = configurationSupplier.get(); configuration.setName(name); configuration.setType(FileBlobStore.TYPE); configuration.attributes(FileBlobStore.CONFIG_KEY).set(FileBlobStore.PATH_KEY, path); return configuration; }
Example 7
Source File: S3BlobStoreApiUpdateValidationTest.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
private void mockBlobStoreType(final String type) { final BlobStoreConfiguration blobStoreConfiguration = new MockBlobStoreConfiguration(); blobStoreConfiguration.setType(type); when(blobStoreManager.get(BLOB_STORE_NAME)).thenReturn(blobStore); when(blobStore.getBlobStoreConfiguration()).thenReturn(blobStoreConfiguration); }