2 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package oic.simulator.serviceprovider.resource;
19 import java.util.List;
21 import org.oic.simulator.ResourceAttribute;
22 import org.oic.simulator.ResourceAttribute.Range;
23 import org.oic.simulator.ResourceAttribute.Type;
24 import org.oic.simulator.serviceprovider.AutomationType;
27 * This class represents an attribute in the simulated resource.
29 public class LocalResourceAttribute {
31 // Native object reference
32 private ResourceAttribute resourceAttribute;
34 private Object attributeValue;
35 private List<String> attValues;
37 private int automationId;
39 private boolean automationInProgress;
41 private int automationUpdateInterval;
43 private AutomationType automationType;
45 public ResourceAttribute getResourceAttribute() {
46 return resourceAttribute;
49 public void setResourceAttribute(ResourceAttribute resourceAttribute) {
50 this.resourceAttribute = resourceAttribute;
53 public String getAttributeName() {
54 return resourceAttribute.getName();
57 public Object getAttributeValue() {
58 return attributeValue;
61 public void setAttributeValue(Object attributeValue) {
62 this.attributeValue = attributeValue;
65 public Object[] getAllowedValues() {
66 return resourceAttribute.getAllowedValues();
69 public Object getMinValue() {
70 return resourceAttribute.getRange().getMin();
73 public Object getMaxValue() {
74 return resourceAttribute.getRange().getMax();
77 public boolean isAutomationInProgress() {
78 return automationInProgress;
81 public void setAutomationInProgress(boolean automationInProgress) {
82 this.automationInProgress = automationInProgress;
85 public int getAutomationUpdateInterval() {
86 return automationUpdateInterval;
89 public void setAutomationUpdateInterval(int automationUpdateInterval) {
90 this.automationUpdateInterval = automationUpdateInterval;
93 public AutomationType getAutomationType() {
94 return automationType;
97 public void setAutomationType(AutomationType automationType) {
98 this.automationType = automationType;
101 public int getAutomationId() {
105 public void setAutomationId(int automationId) {
106 this.automationId = automationId;
109 public Type getAttValType() {
110 return resourceAttribute.getType();
113 public Type getAttValBaseType() {
114 return resourceAttribute.getBaseType();
117 public List<String> getAttValues() {
121 public void setAttValues(List<String> attValues) {
122 this.attValues = attValues;
125 public void printAttributeDetails() {
126 System.out.println("Attribute Name:" + resourceAttribute.getName());
127 System.out.println("Attribute Value:" + resourceAttribute.getValue());
128 System.out.println("Attribute Base Type:"
129 + resourceAttribute.getBaseType());
130 System.out.println("Attribute Type:" + resourceAttribute.getType());
131 System.out.print("Allowed Values:");
132 Object[] values = getAllowedValues();
133 for (Object obj : values) {
134 System.out.print(obj);
136 Range range = resourceAttribute.getRange();
138 System.out.println("Range:" + range.getMin() + " to "