2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.controlloop.actor.so;
23 import java.lang.annotation.Annotation;
25 import java.util.Date;
26 import java.util.Locale;
29 import javax.ws.rs.core.EntityTag;
30 import javax.ws.rs.core.GenericType;
31 import javax.ws.rs.core.Link;
32 import javax.ws.rs.core.Link.Builder;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.MultivaluedMap;
35 import javax.ws.rs.core.NewCookie;
36 import javax.ws.rs.core.Response;
37 import lombok.AllArgsConstructor;
39 import org.onap.policy.common.utils.coder.Coder;
40 import org.onap.policy.common.utils.coder.CoderException;
43 * RestManager Response suitable for use with subclasses of HttpOperation. Only a couple
44 * of methods are implemented; the rest throw {@link UnsupportedOperationException}.
47 public class RestManagerResponse extends Response {
48 // TODO move to actorServices
51 private final int status;
53 private final String body;
54 private final Coder coder;
62 public <T> T readEntity(Class<T> entityType) {
63 if (entityType == String.class) {
64 return entityType.cast(body);
68 return coder.decode(body, entityType);
69 } catch (CoderException e) {
70 throw new IllegalArgumentException("cannot decode response", e);
75 public <T> T readEntity(GenericType<T> entityType) {
76 throw new UnsupportedOperationException();
80 public <T> T readEntity(Class<T> entityType, Annotation[] annotations) {
81 throw new UnsupportedOperationException();
85 public <T> T readEntity(GenericType<T> entityType, Annotation[] annotations) {
86 throw new UnsupportedOperationException();
90 public StatusType getStatusInfo() {
91 throw new UnsupportedOperationException();
95 public Object getEntity() {
96 throw new UnsupportedOperationException();
100 public boolean hasEntity() {
101 throw new UnsupportedOperationException();
105 public boolean bufferEntity() {
106 throw new UnsupportedOperationException();
110 public MediaType getMediaType() {
111 throw new UnsupportedOperationException();
115 public Locale getLanguage() {
116 throw new UnsupportedOperationException();
120 public int getLength() {
121 throw new UnsupportedOperationException();
125 public Set<String> getAllowedMethods() {
126 throw new UnsupportedOperationException();
130 public Map<String, NewCookie> getCookies() {
131 throw new UnsupportedOperationException();
135 public EntityTag getEntityTag() {
136 throw new UnsupportedOperationException();
140 public Date getDate() {
141 throw new UnsupportedOperationException();
145 public Date getLastModified() {
146 throw new UnsupportedOperationException();
150 public URI getLocation() {
151 throw new UnsupportedOperationException();
155 public Set<Link> getLinks() {
156 throw new UnsupportedOperationException();
160 public boolean hasLink(String relation) {
161 throw new UnsupportedOperationException();
165 public Link getLink(String relation) {
166 throw new UnsupportedOperationException();
170 public Builder getLinkBuilder(String relation) {
171 throw new UnsupportedOperationException();
175 public MultivaluedMap<String, Object> getMetadata() {
176 throw new UnsupportedOperationException();
180 public MultivaluedMap<String, String> getStringHeaders() {
181 throw new UnsupportedOperationException();
185 public String getHeaderString(String name) {
186 throw new UnsupportedOperationException();