Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceContainer / include / JavaBundleResource.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 JAVABUNDLERESOURCE_H_
22 #define JAVABUNDLERESOURCE_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             virtual RCSResourceAttributes& getAttributes();
46
47             virtual void setAttribute(std::string key, RCSResourceAttributes::Value&&);
48
49             virtual RCSResourceAttributes::Value getAttribute(const std::string& key);
50             virtual void initAttributes();
51         private:
52             // needs to be a GlobalRef
53             jobject bundleResource;
54             jobjectArray attributes;
55             jclass bundleResourceClass;
56             jmethodID attributeSetter;
57             jmethodID attributeGetter;
58             string m_bundleId;
59         };
60     }
61 }
62
63 #endif