de.mklinger.qetcher.liferay.client.impl.DefunctQetcherClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qetcher-adapter-liferay-71 Show documentation
Show all versions of qetcher-adapter-liferay-71 Show documentation
Qetcher Liferay 7.1.x Adapter
The newest version!
package de.mklinger.qetcher.liferay.client.impl;
import java.io.File;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import de.mklinger.qetcher.client.InputConversionFile;
import de.mklinger.qetcher.client.InputJob;
import de.mklinger.qetcher.client.QetcherClient;
import de.mklinger.qetcher.client.model.v1.AvailableConversion;
import de.mklinger.qetcher.client.model.v1.AvailableNode;
import de.mklinger.qetcher.client.model.v1.ConversionFile;
import de.mklinger.qetcher.client.model.v1.Job;
/**
* @author Marc Klinger - mklinger[at]mklinger[dot]de
*/
@SuppressWarnings("unchecked")
public class DefunctQetcherClient implements QetcherClient {
private final CompletableFuture> exceptionFuture;
public DefunctQetcherClient(final String exceptionMessage) {
this(new DefunctQetcherClientException(exceptionMessage));
}
public DefunctQetcherClient(final RuntimeException exception) {
this.exceptionFuture = new CompletableFuture<>();
this.exceptionFuture.completeExceptionally(exception);
}
@Override
public CompletableFuture uploadFile(final InputConversionFile inputFile) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture getFile(final String fileId) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture> getFiles() {
return (CompletableFuture>) exceptionFuture;
}
@Override
public CompletableFuture deleteFile(final String fileId) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture downloadAsFile(final String fileId, final Path file, final OpenOption... openOptions) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture createJob(final InputJob inputJob) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture getJob(final String jobId) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture> getJobs() {
return (CompletableFuture>) exceptionFuture;
}
@Override
public CompletableFuture deleteJob(final String jobId) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture> getAvailableConversions() {
return (CompletableFuture>) exceptionFuture;
}
@Override
public CompletableFuture> getAvailableNodes() {
return (CompletableFuture>) exceptionFuture;
}
@Override
public CompletableFuture getFile(final ConversionFile file) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture deleteFile(final ConversionFile file) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture downloadAsFile(final String fileId, final Path file) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture downloadAsFile(final String fileId, final File file) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture downloadAsTempFile(final String fileId) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture downloadAsTempFile(final String fileId, final Path dir) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture getJob(final Job job) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture deleteJob(final Job job) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture getJobDone(final Job job) {
return (CompletableFuture) exceptionFuture;
}
@Override
public CompletableFuture getJobDone(final String jobId) {
return (CompletableFuture) exceptionFuture;
}
@Override
public void close() {
}
private static class DefunctQetcherClientException extends RuntimeException {
private static final long serialVersionUID = 1L;
public DefunctQetcherClientException(final String message) {
super(message);
}
}
}