Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / resource-container / src / AndroidBundleResource.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef ANDROIDBUNDLERESOURCE_H_
22 #define ANDROIDBUNDLERESOURCE_H_
23
24 #include <map>
25 #include <vector>
26 #include <string>
27 #include <jni.h>
28 #include "BundleResource.h"
29 #include "ResourceContainerImpl.h"
30
31 using namespace std;
32
33 namespace OIC
34 {
35     namespace Service
36     {
37         class JavaBundleResource: public BundleResource
38         {
39         public:
40             JavaBundleResource();
41             JavaBundleResource(JNIEnv *env, jobject obj, jobject bundleResource, string bundleId,
42                     jobjectArray attributes);
43             virtual ~JavaBundleResource();
44
45             void handleSetAttributeRequest(const std::string& key,
46                     RCSResourceAttributes::Value&&);
47
48             RCSResourceAttributes::Value handleGetAttributeRequest(const std::string& key);
49
50             virtual void handleSetAttributesRequest(RCSResourceAttributes &attrs);
51
52             virtual RCSResourceAttributes& handleGetAttributesRequest();
53
54             virtual void initAttributes();
55         private:
56             // needs to be a GlobalRef
57             jobject m_bundleResource;
58             jobjectArray m_attributes;
59             jclass m_bundleResourceClass;
60             jmethodID m_attributeSetRequestHandler;
61             jmethodID m_attributeGetRequestHandler;
62             string m_bundleId;
63         };
64     }
65 }
66
67 #endif