[IoTivity Simulator] Handling resource interfaces.
[platform/upstream/iotivity.git] / service / simulator / java / sdk / src / org / oic / simulator / server / SimulatorCollectionResource.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.oic.simulator.server;
18
19 import java.util.Vector;
20
21 import org.oic.simulator.InvalidArgsException;
22 import org.oic.simulator.SimulatorException;
23
24 /**
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.
28  */
29 public final class SimulatorCollectionResource extends SimulatorResource {
30
31     private SimulatorCollectionResource(long nativeHandle) {
32         mNativeHandle = nativeHandle;
33     }
34
35     /**
36      * API to add child resource to collection.
37      *
38      * @param resource
39      *            Child resource to be added to collection.
40      *
41      * @throws InvalidArgsException
42      *             This exception will be thrown on invalid input.
43      * @throws SimulatorException
44      *             This exception will be thrown on occurrence of error in
45      *             native.
46      */
47     public native void addChildResource(SimulatorResource resource)
48             throws InvalidArgsException, SimulatorException;
49
50     /**
51      * API to remove child resource from collection.
52      *
53      * @param resource
54      *            Child resource to be removed from collection.
55      *
56      * @throws InvalidArgsException
57      *             This exception will be thrown on invalid input.
58      * @throws SimulatorException
59      *             This exception will be thrown on occurrence of error in
60      *             native.
61      */
62     public native void removeChildResource(SimulatorResource resource)
63             throws InvalidArgsException, SimulatorException;
64
65     /**
66      * API to remove child resource from collection.
67      *
68      * @param uri
69      *            URI of child resource to be removed from collection.
70      *
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
75      *             native.
76      */
77     public native void removeChildResourceByUri(String uri)
78             throws InvalidArgsException, SimulatorException;
79
80     /**
81      * API to get list of child resources.
82      *
83      * @return Vector of child resources {@link SimulatorResource}.
84      *
85      * @throws SimulatorException
86      *             This exception will be thrown on occurrence of error in
87      *             native.
88      */
89     public native Vector<SimulatorResource> getChildResource()
90             throws SimulatorException;
91 }