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.FileNotFoundException;
21 import java.io.FileOutputStream;
22 import java.io.IOException;
23 import java.io.ObjectInputStream;
24 import java.io.ObjectOutputStream;
25 import java.io.Serializable;
26 import java.util.List;
29 public class SerializedServiceProvider implements Serializable {
31 public static class SerializedAttribute implements Serializable {
33 public String getName() {
37 public void setName(String name) {
41 public Object getValue() {
45 public void setValue(Object value) {
49 public String getType() {
53 public void setType(String type) {
61 public void setMin(int min) {
69 public void setMax(int max) {
73 public Object getAllowedValues() {
74 return m_AllowedValues;
77 public void setAllowedValues(Object allowedValues) {
78 this.m_AllowedValues = allowedValues;
81 private String m_name = null;
82 private Object m_value = null;
83 private String m_type = null;
84 private int m_min = 0;
85 private int m_max = 0;
86 private Object m_AllowedValues = null;
89 public String getResourceName() {
90 return m_resourceName;
93 public void setResourceName(String resourceName) {
94 this.m_resourceName = resourceName;
97 public String getUri() {
101 public void setUri(String uri) {
105 public String getResourceType() {
106 return m_resourceType;
109 public void setResourceType(String resourceType) {
110 this.m_resourceType = resourceType;
113 public List<String> getInterfaceType() {
114 return m_interfaceType;
117 public void setInterfaceType(List<String> interfaceType) {
118 this.m_interfaceType = interfaceType;
121 public Map<String, SerializedAttribute> getResourceAttributesMap() {
122 return m_resourceAttributesMap;
125 public void setResourceAttributesMap(
126 Map<String, SerializedAttribute> resourceAttributesMap) {
127 this.m_resourceAttributesMap = resourceAttributesMap;
130 public void serialize(String filePath) throws FileNotFoundException,
132 FileOutputStream fileOut = null;
133 ObjectOutputStream out = null;
135 fileOut = new FileOutputStream(filePath);
136 out = new ObjectOutputStream(fileOut);
137 out.writeObject(this);
147 public static SerializedServiceProvider deSerialize(String filePath)
148 throws FileNotFoundException, IOException, ClassNotFoundException {
149 FileInputStream fileIn = null;
150 ObjectInputStream in = null;
151 SerializedServiceProvider r;
153 fileIn = new FileInputStream(filePath);
154 in = new ObjectInputStream(fileIn);
155 r = (SerializedServiceProvider) in.readObject();
166 private String m_resourceName;
167 private String m_uri;
168 private String m_resourceType;
169 private List<String> m_interfaceType;
170 private Map<String, SerializedAttribute> m_resourceAttributesMap;