org.jboss.pnc.client.PncStatusClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-api Show documentation
Show all versions of rest-api Show documentation
Module with REST API bidings.
The newest version!
package org.jboss.pnc.client;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.WebApplicationException;
import org.jboss.pnc.dto.PncStatus;
import org.jboss.pnc.rest.api.endpoints.PncStatusEndpoint;
public class PncStatusClient extends ClientBase {
public PncStatusClient(Configuration configuration) {
super(configuration, PncStatusEndpoint.class);
}
public void setPncStatus(PncStatus pncStatus) throws RemoteResourceException,
RemoteResourceNotFoundException {
try {
getEndpoint().setPncStatus(pncStatus);
} catch (NotFoundException e) {
throw new RemoteResourceNotFoundException(e);
} catch (NotAuthorizedException e) {
if (configuration.getBearerTokenSupplier() != null) {
try {
bearerAuthentication.setTokenSupplier(configuration.getBearerTokenSupplier());
getEndpoint().setPncStatus(pncStatus);
} catch (WebApplicationException wae) {
throw new RemoteResourceException(readErrorResponse(wae), wae);
}
} else {
throw new RemoteResourceException(readErrorResponse(e), e);
}
} catch (WebApplicationException e) {
throw new RemoteResourceException(readErrorResponse(e), e);
}
}
public PncStatus getPncStatus() throws RemoteResourceException {
try {
return getEndpoint().getPncStatus();
} catch (NotFoundException e) {
throw new RemoteResourceNotFoundException(e);
} catch (NotAuthorizedException e) {
if (configuration.getBearerTokenSupplier() != null) {
try {
bearerAuthentication.setTokenSupplier(configuration.getBearerTokenSupplier());
return getEndpoint().getPncStatus();
} catch (WebApplicationException wae) {
throw new RemoteResourceException(readErrorResponse(wae), wae);
}
} else {
throw new RemoteResourceException(readErrorResponse(e), e);
}
} catch (WebApplicationException e) {
throw new RemoteResourceException(readErrorResponse(e), e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy