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.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;
27 public class SerializedClientController implements Serializable {
29 public List<String> getResourceTypes() {
30 return m_resourceTypes;
33 public void setResourceTypes(List<String> resourceTypes) {
34 this.m_resourceTypes = resourceTypes;
37 public List<String> getFavorites() {
41 public void setFavorites(List<String> favorites) {
42 this.m_favorites = favorites;
45 public void serialize(String filePath) throws Exception {
47 FileOutputStream fileOut = new FileOutputStream(filePath);
48 ObjectOutputStream out = new ObjectOutputStream(fileOut);
49 out.writeObject(this);
52 } catch (IOException i) {
53 throw new Exception("Failed to Serialize data : IOException");
57 public static SerializedClientController deSerialize(String filePath)
59 SerializedClientController r = null;
61 FileInputStream fileIn = new FileInputStream(filePath);
62 ObjectInputStream in = new ObjectInputStream(fileIn);
63 r = (SerializedClientController) in.readObject();
66 } catch (IOException i) {
67 throw new Exception("Failed to DeSerialize data : IOException");
68 } catch (ClassNotFoundException c) {
69 throw new Exception("Failed to DeSerialize data : ClassNotFound");
74 private List<String> m_resourceTypes;
75 private List<String> m_favorites;