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.model;
19 import java.io.FileInputStream;
20 import java.io.FileOutputStream;
21 import java.io.IOException;
22 import java.io.ObjectInputStream;
23 import java.io.ObjectOutputStream;
24 import java.io.Serializable;
25 import java.util.List;
28 public class SerializedServiceProvider implements Serializable {
30 public class SerializedAttribute implements Serializable {
32 public String getName() {
36 public void setName(String name) {
40 public Object getValue() {
44 public void setValue(Object value) {
48 public String getType() {
52 public void setType(String type) {
60 public void setMin(int min) {
68 public void setMax(int max) {
72 public Object getAllowedValues() {
73 return m_AllowedValues;
76 public void setAllowedValues(Object allowedValues) {
77 this.m_AllowedValues = allowedValues;
80 private String m_name = null;
81 private Object m_value = null;
82 private String m_type = null;
83 private int m_min = 0;
84 private int m_max = 0;
85 private Object m_AllowedValues = null;
88 public String getResourceName() {
89 return m_resourceName;
92 public void setResourceName(String resourceName) {
93 this.m_resourceName = resourceName;
96 public String getUri() {
100 public void setUri(String uri) {
104 public String getResourceType() {
105 return m_resourceType;
108 public void setResourceType(String resourceType) {
109 this.m_resourceType = resourceType;
112 public List<String> getInterfaceType() {
113 return m_interfaceType;
116 public void setInterfaceType(List<String> interfaceType) {
117 this.m_interfaceType = interfaceType;
120 public Map<String, SerializedAttribute> getResourceAttributesMap() {
121 return m_resourceAttributesMap;
124 public void setResourceAttributesMap(
125 Map<String, SerializedAttribute> resourceAttributesMap) {
126 this.m_resourceAttributesMap = resourceAttributesMap;
129 public void serialize(String filePath) throws IOException {
130 FileOutputStream fileOut = new FileOutputStream(filePath);
131 ObjectOutputStream out = new ObjectOutputStream(fileOut);
132 out.writeObject(this);
137 public static SerializedServiceProvider deSerialize(String filePath)
139 SerializedServiceProvider r = null;
140 FileInputStream fileIn = new FileInputStream(filePath);
141 ObjectInputStream in = new ObjectInputStream(fileIn);
142 r = (SerializedServiceProvider) in.readObject();
148 private String m_resourceName;
149 private String m_uri;
150 private String m_resourceType;
151 private List<String> m_interfaceType;
152 private Map<String, SerializedAttribute> m_resourceAttributesMap;