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.clientcontroller.remoteresource;
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;
28 public class SerializedClientController implements Serializable {
30 public List<String> getResourceTypes() {
31 return m_resourceTypes;
34 public void setResourceTypes(List<String> resourceTypes) {
35 this.m_resourceTypes = resourceTypes;
38 public List<String> getFavorites() {
42 public void setFavorites(List<String> favorites) {
43 this.m_favorites = favorites;
46 public void serialize(String filePath) throws FileNotFoundException,
48 FileOutputStream fileOut = null;
49 ObjectOutputStream out = null;
51 fileOut = new FileOutputStream(filePath);
52 out = new ObjectOutputStream(fileOut);
53 out.writeObject(this);
63 public static SerializedClientController deSerialize(String filePath)
64 throws FileNotFoundException, IOException, ClassNotFoundException {
65 FileInputStream fileIn = null;
66 ObjectInputStream in = null;
67 SerializedClientController r = null;
69 fileIn = new FileInputStream(filePath);
70 in = new ObjectInputStream(fileIn);
71 r = (SerializedClientController) in.readObject();
83 private List<String> m_resourceTypes;
84 private List<String> m_favorites;