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 org.oic.simulator;
20 * This Enum contains Status codes for Success and Errors.
22 public enum SimulatorResult {
23 /** STACK error codes - START */
24 SIMULATOR_OK, SIMULATOR_RESOURCE_CREATED, SIMULATOR_RESOURCE_DELETED, SIMULATOR_CONTINUE, SIMULATOR_RESOURCE_CHANGED, SIMULATOR_INVALID_URI, SIMULATOR_INVALID_QUERY, SIMULATOR_INVALID_IP, SIMULATOR_INVALID_PORT, SIMULATOR_INVALID_CALLBACK, SIMULATOR_INVALID_METHOD, SIMULATOR_INVALID_PARAM, SIMULATOR_INVALID_OBSERVE_PARAM, SIMULATOR_NO_MEMORY, SIMULATOR_COMM_ERROR, SIMULATOR_TIMEOUT, SIMULATOR_ADAPTER_NOT_ENABLED, SIMULATOR_NOTIMPL, SIMULATOR_NO_RESOURCE, SIMULATOR_RESOURCE_ERROR, SIMULATOR_SLOW_RESOURCE, SIMULATOR_DUPLICATE_REQUEST, SIMULATOR_NO_OBSERVERS, SIMULATOR_OBSERVER_NOT_FOUND, SIMULATOR_VIRTUAL_DO_NOT_HANDLE, SIMULATOR_INVALID_OPTION, SIMULATOR_MALFORMED_RESPONSE, SIMULATOR_PERSISTENT_BUFFER_REQUIRED, SIMULATOR_INVALID_REQUEST_HANDLE, SIMULATOR_INVALID_DEVICE_INFO, SIMULATOR_INVALID_JSON, SIMULATOR_UNAUTHORIZED_REQ, SIMULATOR_TOO_LARGE_REQ,
26 /** Error code from PDM */
27 SIMULATOR_PDM_IS_NOT_INITIALIZED, SIMULATOR_DUPLICATE_UUID, SIMULATOR_INCONSISTENT_DB,
29 /** Error code from OTM */
30 SIMULATOR_AUTHENTICATION_FAILURE,
32 SIMULATOR_PRESENCE_STOPPED, SIMULATOR_PRESENCE_TIMEOUT, SIMULATOR_PRESENCE_DO_NOT_HANDLE,
33 /** STACK error codes - END */
35 /** Simulator specific error codes - START */
36 SIMULATOR_INVALID_TYPE, SIMULATOR_NOT_SUPPORTED, SIMULATOR_OPERATION_NOT_ALLOWED, SIMULATOR_OPERATION_IN_PROGRESS,
38 SIMULATOR_INVALID_RESPONSE_CODE, SIMULATOR_UKNOWN_PROPERTY, SIMULATOR_TYPE_MISMATCH, SIMULATOR_BAD_VALUE, SIMULATOR_BAD_OBJECT, SIMULATOR_BAD_SCHEMA,
39 /** Simulator specific error codes - END */
44 * This method returns the {@link SimulatorResult} at the given
48 * Index of the constant.
49 * @return {@link SimulatorResult} constant at the given index.
51 public static SimulatorResult get(int ordinal) {
53 SimulatorResult result;
56 result = SimulatorResult.values()[0];
57 else if (ordinal == 1)
58 result = SimulatorResult.values()[1];
59 else if (ordinal == 2)
60 result = SimulatorResult.values()[2];
61 else if (ordinal == 3)
62 result = SimulatorResult.values()[3];
64 else if (ordinal == 20)
65 result = SimulatorResult.values()[4];
66 else if (ordinal == 21)
67 result = SimulatorResult.values()[5];
68 else if (ordinal == 22)
69 result = SimulatorResult.values()[6];
70 else if (ordinal == 23)
71 result = SimulatorResult.values()[7];
72 else if (ordinal == 24)
73 result = SimulatorResult.values()[8];
74 else if (ordinal == 25)
75 result = SimulatorResult.values()[9];
76 else if (ordinal == 26)
77 result = SimulatorResult.values()[10];
78 else if (ordinal == 27)
79 result = SimulatorResult.values()[11];
80 else if (ordinal == 28)
81 result = SimulatorResult.values()[12];
82 else if (ordinal == 29)
83 result = SimulatorResult.values()[13];
84 else if (ordinal == 30)
85 result = SimulatorResult.values()[14];
86 else if (ordinal == 31)
87 result = SimulatorResult.values()[15];
88 else if (ordinal == 32)
89 result = SimulatorResult.values()[16];
90 else if (ordinal == 33)
91 result = SimulatorResult.values()[17];
92 else if (ordinal == 34)
93 result = SimulatorResult.values()[18];
94 else if (ordinal == 35)
95 result = SimulatorResult.values()[19];
96 else if (ordinal == 36)
97 result = SimulatorResult.values()[20];
98 else if (ordinal == 37)
99 result = SimulatorResult.values()[21];
100 else if (ordinal == 38)
101 result = SimulatorResult.values()[22];
102 else if (ordinal == 39)
103 result = SimulatorResult.values()[23];
104 else if (ordinal == 40)
105 result = SimulatorResult.values()[24];
106 else if (ordinal == 41)
107 result = SimulatorResult.values()[25];
108 else if (ordinal == 42)
109 result = SimulatorResult.values()[26];
110 else if (ordinal == 43)
111 result = SimulatorResult.values()[27];
112 else if (ordinal == 44)
113 result = SimulatorResult.values()[28];
114 else if (ordinal == 45)
115 result = SimulatorResult.values()[29];
116 else if (ordinal == 46)
117 result = SimulatorResult.values()[30];
119 else if (ordinal == 128)
120 result = SimulatorResult.values()[31];
121 else if (ordinal == 129)
122 result = SimulatorResult.values()[32];
123 else if (ordinal == 130)
124 result = SimulatorResult.values()[33];
126 else if (ordinal == 131 || ordinal == 47)
127 result = SimulatorResult.values()[34];
128 else if (ordinal == 132 || ordinal == 48)
129 result = SimulatorResult.values()[35];
130 else if (ordinal == 133 || ordinal == 49)
131 result = SimulatorResult.values()[36];
132 else if (ordinal == 134 || ordinal == 50)
133 result = SimulatorResult.values()[37];
135 else if (ordinal == 135 || ordinal == 51)
136 result = SimulatorResult.values()[38];
137 else if (ordinal == 136 || ordinal == 52)
138 result = SimulatorResult.values()[39];
139 else if (ordinal == 137 || ordinal == 53)
140 result = SimulatorResult.values()[40];
141 else if (ordinal == 138 || ordinal == 54)
142 result = SimulatorResult.values()[41];
145 result = SimulatorResult.values()[42];