Java Code Examples for org.sonatype.nexus.blobstore.api.BlobStore#isWritable()

The following examples show how to use org.sonatype.nexus.blobstore.api.BlobStore#isWritable() . 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: BlobStoreGroupDescriptor.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
private void validateOnlyEmptyOrNotWritableExistingMembersRemoved(final String name, final List<String> memberNames) {
  BlobStore blobStore = blobStoreManager.get(name);
  if (blobStore != null) {
    BlobStoreConfiguration currentConfiguration = blobStore.getBlobStoreConfiguration();
    if (currentConfiguration != null && currentConfiguration.getType().equals(BlobStoreGroup.TYPE)) {
      for (String existingMemberName : memberNames(currentConfiguration)) {
        if (!memberNames.contains(existingMemberName)) {
          BlobStore existingMember = blobStoreManager.get(existingMemberName);
          if (existingMember.isWritable() || !existingMember.isEmpty()) {
            throw new ValidationErrorsException(
                format("Blob Store '%s' cannot be removed from Blob Store Group '%s', " +
                    "use 'Admin - Remove a member from a blob store group' task instead",
                    existingMemberName, name));
          }
        }
      }
    }
  }
}
 
Example 2
Source File: BlobStoreGroup.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@VisibleForTesting
Optional<BlobStore> locate(final BlobId blobId) {
  String blobStoreName = locatedBlobs.get(blobId);
  if (blobStoreName != null) {
    log.trace("{} location was cached as {}", blobId, blobStoreName);
    return Optional.ofNullable(blobStoreManager.get(blobStoreName));
  }

  BlobStore blobStore = search(blobId);
  if (blobStore != null && blobStore.isWritable()) {
    String memberName = blobStore.getBlobStoreConfiguration().getName();
    log.trace("Caching {} in member {}", blobId, memberName);
    locatedBlobs.put(blobId, memberName);
  }

  return Optional.ofNullable(blobStore);
}
 
Example 3
Source File: BlobStoreManagerImpl.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean isPromotable(final String blobStoreName) {
  BlobStore blobStore = get(blobStoreName);
  return blobStore != null && blobStore.isGroupable() && blobStore.isWritable() &&
      !store.findParent(blobStore.getBlobStoreConfiguration().getName()).isPresent();
}