2 * //******************************************************************
\r
4 * // Copyright 2015 Intel Corporation.
\r
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
8 * // Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * // you may not use this file except in compliance with the License.
\r
10 * // You may obtain a copy of the License at
\r
12 * // http://www.apache.org/licenses/LICENSE-2.0
\r
14 * // Unless required by applicable law or agreed to in writing, software
\r
15 * // distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * // See the License for the specific language governing permissions and
\r
18 * // limitations under the License.
\r
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
23 package org.iotivity.base;
\r
25 import java.util.List;
\r
28 * OcResourceResponse provides APIs to set the response details
\r
30 public class OcResourceResponse {
\r
33 System.loadLibrary("oc");
\r
34 System.loadLibrary("ocstack-jni");
\r
37 public OcResourceResponse() {
\r
43 private OcResourceResponse(long nativeHandle) {
\r
44 this.mNativeHandle = nativeHandle;
\r
48 * This API sets the error code for this response
\r
50 * @param eCode error code to set
\r
52 public native void setErrorCode(int eCode);
\r
55 * Gets new resource uri
\r
57 * @return new resource uri
\r
59 public native String getNewResourceUri();
\r
62 * Sets new resource uri
\r
64 * @param newResourceUri new resource uri
\r
66 public native void setNewResourceUri(String newResourceUri);
\r
69 * This API allows to set headerOptions in the response
\r
71 * @param headerOptionList List of HeaderOption entries
\r
73 public void setHeaderOptions(List<OcHeaderOption> headerOptionList) {
\r
74 this.setHeaderOptions(headerOptionList.toArray(
\r
75 new OcHeaderOption[headerOptionList.size()])
\r
79 private native void setHeaderOptions(OcHeaderOption[] headerOptionList);
\r
82 * This API allows to set request handle
\r
84 * @param ocRequestHandle request handle
\r
86 public native void setRequestHandle(OcRequestHandle ocRequestHandle);
\r
89 * This API allows to set the resource handle
\r
91 * @param ocResourceHandle resource handle
\r
93 public native void setResourceHandle(OcResourceHandle ocResourceHandle);
\r
96 * This API allows to set the EntityHandler response result
\r
98 * @param responseResult OcEntityHandlerResult type to set the result value
\r
100 public void setResponseResult(EntityHandlerResult responseResult) {
\r
101 this.setResponseResult(responseResult.getValue());
\r
104 private native void setResponseResult(int responseResult);
\r
107 * API to set the entire resource attribute representation
\r
109 * @param ocRepresentation the name value pairs representing the resource's attributes
\r
110 * @param interfaceStr specifies the interface
\r
112 public native void setResourceRepresentation(OcRepresentation ocRepresentation,
\r
113 String interfaceStr);
\r
116 * API to set the entire resource attribute representation
\r
118 * @param representation object containing the name value pairs representing the
\r
119 * resource's attributes
\r
121 public void setResourceRepresentation(OcRepresentation representation) {
\r
122 this.setResourceRepresentation1(representation);
\r
125 private native void setResourceRepresentation1(OcRepresentation representation);
\r
128 protected void finalize() throws Throwable {
\r
134 private native void create();
\r
136 private native void dispose();
\r
138 private long mNativeHandle;
\r