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.server;
19 import java.util.Vector;
21 import org.oic.simulator.InvalidArgsException;
22 import org.oic.simulator.SimulatorException;
25 * This class represents a collection type resource which provides a set of APIs
26 * that are specific to collection resource for adding/removing child resources
27 * and obtaining all child resources from the collection.
29 public final class SimulatorCollectionResource extends SimulatorResource {
32 * API to add child resource to collection.
35 * Child resource to be added to collection.
37 * @throws InvalidArgsException
38 * This exception will be thrown on invalid input.
39 * @throws SimulatorException
40 * This exception will be thrown on occurrence of error in
43 public void addChildResource(SimulatorResource resource)
44 throws InvalidArgsException, SimulatorException {
45 nativeAddChildResource(resource);
49 * API to remove child resource from collection.
52 * Child resource to be removed from collection.
54 * @throws InvalidArgsException
55 * This exception will be thrown on invalid input.
56 * @throws SimulatorException
57 * This exception will be thrown on occurrence of error in
60 public void removeChildResource(SimulatorResource resource)
61 throws InvalidArgsException, SimulatorException {
62 nativeRemoveChildResource(resource);
66 * API to remove child resource from collection.
69 * URI of child resource to be removed from collection.
71 * @throws InvalidArgsException
72 * This exception will be thrown on invalid input.
73 * @throws SimulatorException
74 * This exception will be thrown on occurrence of error in
77 public void removeChildResourceByUri(String uri)
78 throws InvalidArgsException, SimulatorException {
79 nativeRemoveChildResourceByUri(uri);
83 * API to get list of child resources.
85 * @return Vector of child resources {@link SimulatorResource}.
87 * @throws SimulatorException
88 * This exception will be thrown on occurrence of error in
91 public Vector<SimulatorResource> getChildResources()
92 throws SimulatorException {
93 return nativeGetChildResources();
96 private SimulatorCollectionResource(long nativeHandle) {
97 mNativeHandle = nativeHandle;
100 private native void nativeAddChildResource(SimulatorResource resource);
102 private native void nativeRemoveChildResource(SimulatorResource resource);
104 private native void nativeRemoveChildResourceByUri(String uri);
106 private native Vector<SimulatorResource> nativeGetChildResources();