use of org.apache.pulsar.packages.management.core.exceptions.PackagesManagementException.NotFoundException in project pulsar by apache.
the class PackagesManagementImpl method checkPackageExistsAndThrowException.
private CompletableFuture<Void> checkPackageExistsAndThrowException(PackageName packageName) {
String path = packagePath(packageName);
CompletableFuture<Void> future = new CompletableFuture<>();
storage.existAsync(path).whenComplete((exist, throwable) -> {
if (throwable != null) {
future.completeExceptionally(throwable);
return;
}
if (!exist) {
future.complete(null);
} else {
future.completeExceptionally(new NotFoundException(String.format("Package '%s' already exists", packageName.toString())));
}
});
return future;
}
use of org.apache.pulsar.packages.management.core.exceptions.PackagesManagementException.NotFoundException in project pulsar by apache.
the class PackagesManagementImpl method checkMetadataNotExistsAndThrowException.
private CompletableFuture<Void> checkMetadataNotExistsAndThrowException(PackageName packageName) {
String path = metadataPath(packageName);
CompletableFuture<Void> future = new CompletableFuture<>();
storage.existAsync(path).whenComplete((exist, throwable) -> {
if (throwable != null) {
future.completeExceptionally(throwable);
return;
}
if (exist) {
future.complete(null);
} else {
future.completeExceptionally(new NotFoundException(String.format("Package '%s' metadata does not exist", packageName)));
}
});
return future;
}
use of org.apache.pulsar.packages.management.core.exceptions.PackagesManagementException.NotFoundException in project pulsar by apache.
the class PackagesManagementImpl method checkMetadataExistsAndThrowException.
private CompletableFuture<Void> checkMetadataExistsAndThrowException(PackageName packageName) {
String path = metadataPath(packageName);
CompletableFuture<Void> future = new CompletableFuture<>();
storage.existAsync(path).whenComplete((exist, throwable) -> {
if (throwable != null) {
future.completeExceptionally(throwable);
return;
}
if (!exist) {
future.complete(null);
} else {
future.completeExceptionally(new NotFoundException(String.format("Package '%s' metadata already exists", packageName)));
}
});
return future;
}
use of org.apache.pulsar.packages.management.core.exceptions.PackagesManagementException.NotFoundException in project pulsar by yahoo.
the class PackagesManagementImpl method checkPackageExistsAndThrowException.
private CompletableFuture<Void> checkPackageExistsAndThrowException(PackageName packageName) {
String path = packagePath(packageName);
CompletableFuture<Void> future = new CompletableFuture<>();
storage.existAsync(path).whenComplete((exist, throwable) -> {
if (throwable != null) {
future.completeExceptionally(throwable);
return;
}
if (!exist) {
future.complete(null);
} else {
future.completeExceptionally(new NotFoundException(String.format("Package '%s' already exists", packageName.toString())));
}
});
return future;
}
use of org.apache.pulsar.packages.management.core.exceptions.PackagesManagementException.NotFoundException in project pulsar by yahoo.
the class PackagesManagementImpl method checkMetadataExistsAndThrowException.
private CompletableFuture<Void> checkMetadataExistsAndThrowException(PackageName packageName) {
String path = metadataPath(packageName);
CompletableFuture<Void> future = new CompletableFuture<>();
storage.existAsync(path).whenComplete((exist, throwable) -> {
if (throwable != null) {
future.completeExceptionally(throwable);
return;
}
if (!exist) {
future.complete(null);
} else {
future.completeExceptionally(new NotFoundException(String.format("Package '%s' metadata already exists", packageName)));
}
});
return future;
}
Aggregations