Eclipse plug-in for service provider.
[platform/upstream/iotivity.git] / service / simulator / java / sdk / ServiceProvider / src / org / iotivity / simulator / SimulatorResourceServer.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.iotivity.simulator;
18
19 import java.util.Vector;
20
21 public class SimulatorResourceServer {
22
23     private String resourceName;
24     private String resourceURI;
25     private String resourceType;
26     private String interfaceType;
27
28     private long   nativeHandle;
29
30     private SimulatorResourceServer(long nativeHandle) {
31         this.nativeHandle = nativeHandle;
32     }
33
34     public void setName(String resourceName) {
35         this.resourceName = resourceName;
36     }
37
38     private void setURI(String resourceURI) {
39         this.resourceURI = resourceURI;
40     }
41
42     private void setResourceType(String resourceType) {
43         this.resourceType = resourceType;
44     }
45
46     private void setInterfaceType(String interfaceType) {
47         this.interfaceType = interfaceType;
48     }
49
50     public String getName() {
51         return resourceName;
52     }
53
54     public String getURI() {
55         return resourceURI;
56     }
57
58     public String getResourceType() {
59         return resourceType;
60     }
61
62     public String getInterfaceType() {
63         return interfaceType;
64     }
65
66     @Override
67     protected void finalize() throws Throwable {
68         dispose();
69     }
70
71     public native SimulatorResourceModel getModel();
72
73     public native void updateAttributeFromAllowedValues(String attrName,
74             int index);
75
76     public native void setRange(String attrName, int min, int max);
77
78     public native void addAttributeInteger(String key, int value);
79
80     public native void addAttributeDouble(String key, double value);
81
82     public native void addAttributeBoolean(String key, Boolean value);
83
84     public native void addAttributeStringN(String key, String value);
85
86     public native void updateAttributeInteger(String key, int value);
87
88     public native void updateAttributeDouble(String key, double value);
89
90     public native void updateAttributeBoolean(String key, Boolean value);
91
92     public native void updateAttributeStringN(String key, String value);
93
94     public native void setAllowedValuesInteger(String key, int[] allowedValues);
95
96     public native void setAllowedValuesDouble(String key, double[] allowedValues);
97
98     public native void setAllowedValuesStringN(String key,
99             String[] allowedValues);
100
101     public native int startResourceAutomation();
102
103     public native int startAttributeAutomation(String attrName);
104
105     public native void startAutomation(int automationId);
106
107     public native void removeAttribute(String key);
108
109     private native void dispose();
110 }