2 * //******************************************************************
4 * // Copyright 2015 Intel Corporation.
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * // Licensed under the Apache License, Version 2.0 (the "License");
9 * // you may not use this file except in compliance with the License.
10 * // You may obtain a copy of the License at
12 * // http://www.apache.org/licenses/LICENSE-2.0
14 * // Unless required by applicable law or agreed to in writing, software
15 * // distributed under the License is distributed on an "AS IS" BASIS,
16 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * // See the License for the specific language governing permissions and
18 * // limitations under the License.
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 package org.iotivity.base;
25 import org.iotivity.ca.CaInterface;
27 import java.util.EnumSet;
28 import java.util.Iterator;
29 import java.util.List;
32 * Contains the main entrance/functionality of the product. To set a custom configuration, the
33 * implementer must make a call to OcPlatform.Configure before the first usage of a function in this
36 public final class OcPlatform {
39 System.loadLibrary("oc_logger");
40 System.loadLibrary("octbstack");
41 System.loadLibrary("connectivity_abstraction");
42 System.loadLibrary("oc");
43 System.loadLibrary("ocstack-jni");
49 public static final String DEFAULT_INTERFACE = "oic.if.baseline";
52 * Used in discovering (GET) links to other resources of a collection
54 public static final String LINK_INTERFACE = "oic.if.ll";
57 * Used in GET, PUT, POST, DELETE methods on links to other resources of a collection
59 public static final String BATCH_INTERFACE = "oic.if.b";
62 * Used in GET, PUT, POST methods on links to other remote resources of a group
64 public static final String GROUP_INTERFACE = "oic.mi.grp";
66 public static final String WELL_KNOWN_QUERY = "224.0.1.187:5683/oic/res";
67 public static final String MULTICAST_PREFIX = "224.0.1.187:5683";
68 public static final String MULTICAST_IP = "224.0.1.187";
69 public static final int MULTICAST_PORT = 5683;
70 public static final int DEFAULT_PRESENCE_TTL = 60;
71 public static final String DEVICE_URI = "/oic/d";
72 public static final String PRESENCE_URI = "/oic/ad";
74 private static volatile boolean sIsPlatformInitialized = false;
76 private OcPlatform() {
80 * API for setting the configuration of the OcPlatform.
81 * Note: Any calls made to this AFTER the first call to OcPlatform.Configure will have no affect
83 * @param platformConfig platform configuration
85 public synchronized static void Configure(PlatformConfig platformConfig) {
86 if (!sIsPlatformInitialized) {
87 CaInterface.initialize(platformConfig.getContext());
90 platformConfig.getServiceType().getValue(),
91 platformConfig.getModeType().getValue(),
92 platformConfig.getIpAddress(),
93 platformConfig.getPort(),
94 platformConfig.getQualityOfService().getValue(),
95 platformConfig.getSvrDbPath()
98 sIsPlatformInitialized = true;
102 private static native void configure(int serviceType,
106 int qualityOfService,
110 * API for notifying base that resource's attributes have changed.
112 * @param ocResourceHandle resource handle of the resource
113 * @throws OcException
115 public static void notifyAllObservers(
116 OcResourceHandle ocResourceHandle) throws OcException {
117 OcPlatform.initCheck();
118 OcPlatform.notifyAllObservers0(ocResourceHandle);
121 private static native void notifyAllObservers0(
122 OcResourceHandle ocResourceHandle) throws OcException;
125 * API for notifying base that resource's attributes have changed.
127 * @param ocResourceHandle resource handle of the resource
128 * @param qualityOfService the quality of communication
129 * @throws OcException
131 public static void notifyAllObservers(
132 OcResourceHandle ocResourceHandle,
133 QualityOfService qualityOfService) throws OcException {
134 OcPlatform.initCheck();
135 OcPlatform.notifyAllObservers1(ocResourceHandle, qualityOfService.getValue());
138 private static native void notifyAllObservers1(
139 OcResourceHandle ocResourceHandle,
140 int qualityOfService) throws OcException;
143 * API for notifying only specific clients that resource's attributes have changed.
145 * @param ocResourceHandle resource handle of the resource
146 * @param ocObservationIdList These set of ids are ones which which will be notified upon
148 * @param ocResourceResponse OcResourceResponse object used by app to fill the response for
149 * this resource change
150 * @throws OcException
152 public static void notifyListOfObservers(
153 OcResourceHandle ocResourceHandle,
154 List<Byte> ocObservationIdList,
155 OcResourceResponse ocResourceResponse) throws OcException {
156 OcPlatform.initCheck();
158 byte[] idArr = new byte[ocObservationIdList.size()];
159 Iterator<Byte> it = ocObservationIdList.iterator();
161 while (it.hasNext()) {
162 idArr[i++] = (byte) it.next();
165 OcPlatform.notifyListOfObservers2(
171 private static native void notifyListOfObservers2(
172 OcResourceHandle ocResourceHandle,
173 byte[] ocObservationIdArray,
174 OcResourceResponse ocResourceResponse) throws OcException;
177 * API for notifying only specific clients that resource's attributes have changed.
179 * @param ocResourceHandle resource handle of the resource
180 * @param ocObservationIdList These set of ids are ones which which will be notified upon
182 * @param ocResourceResponse OcResourceResponse object used by app to fill the response for
183 * this resource change
184 * @param qualityOfService the quality of communication
185 * @throws OcException
187 public static void notifyListOfObservers(
188 OcResourceHandle ocResourceHandle,
189 List<Byte> ocObservationIdList,
190 OcResourceResponse ocResourceResponse,
191 QualityOfService qualityOfService) throws OcException {
192 OcPlatform.initCheck();
194 byte[] idArr = new byte[ocObservationIdList.size()];
195 Iterator<Byte> it = ocObservationIdList.iterator();
197 while (it.hasNext()) {
198 idArr[i++] = (byte) it.next();
201 OcPlatform.notifyListOfObservers3(
205 qualityOfService.getValue()
209 private static native void notifyListOfObservers3(
210 OcResourceHandle ocResourceHandle,
211 byte[] ocObservationIdArray,
212 OcResourceResponse ocResourceResponse,
213 int qualityOfService) throws OcException;
216 * API for Service and Resource Discovery. NOTE: This API applies to client side only
218 * @param host Host IP Address of a service to direct resource discovery query.
219 * If empty, performs multicast resource discovery query
220 * @param resourceUri name of the resource. If null or empty, performs search for all
222 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
224 * @param onResourceFoundListener Handles events, success states and failure states.
225 * @throws OcException
227 public static void findResource(
230 OcConnectivityType connectivityType,
231 OnResourceFoundListener onResourceFoundListener) throws OcException {
232 OcPlatform.initCheck();
233 OcPlatform.findResource0(
236 connectivityType.getValue(),
237 onResourceFoundListener
241 private static native void findResource0(
244 int connectivityType,
245 OnResourceFoundListener onResourceFoundListener) throws OcException;
248 * API for Service and Resource Discovery. NOTE: This API applies to client side only
250 * @param host Host IP Address of a service to direct resource discovery query.
251 * If empty, performs multicast resource discovery query
252 * @param resourceUri name of the resource. If null or empty, performs search for all
254 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
256 * @param onResourceFoundListener Handles events, success states and failure states.
257 * @param qualityOfService the quality of communication
258 * @throws OcException
260 public static void findResource(
263 OcConnectivityType connectivityType,
264 OnResourceFoundListener onResourceFoundListener,
265 QualityOfService qualityOfService) throws OcException {
266 OcPlatform.initCheck();
267 OcPlatform.findResource1(host,
269 connectivityType.getValue(),
270 onResourceFoundListener,
271 qualityOfService.getValue()
275 private static native void findResource1(
278 int connectivityType,
279 OnResourceFoundListener onResourceFoundListener,
280 int qualityOfService) throws OcException;
283 * API for Device Discovery
285 * @param host Host IP Address. If null or empty, Multicast is performed.
286 * @param deviceUri Uri containing address to the virtual device
287 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
289 * @param onDeviceFoundListener Handles events, success states and failure states.
290 * @throws OcException
292 public static void getDeviceInfo(
295 OcConnectivityType connectivityType,
296 OnDeviceFoundListener onDeviceFoundListener) throws OcException {
297 OcPlatform.initCheck();
298 OcPlatform.getDeviceInfo0(
301 connectivityType.getValue(),
302 onDeviceFoundListener
306 private static native void getDeviceInfo0(
309 int connectivityType,
310 OnDeviceFoundListener onDeviceFoundListener) throws OcException;
313 * API for Device Discovery
315 * @param host Host IP Address. If null or empty, Multicast is performed.
316 * @param deviceUri Uri containing address to the virtual device
317 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
319 * @param onDeviceFoundListener Handles events, success states and failure states.
320 * @param qualityOfService the quality of communication
321 * @throws OcException
323 public static void getDeviceInfo(
326 OcConnectivityType connectivityType,
327 OnDeviceFoundListener onDeviceFoundListener,
328 QualityOfService qualityOfService) throws OcException {
329 OcPlatform.initCheck();
330 OcPlatform.getDeviceInfo1(
333 connectivityType.getValue(),
334 onDeviceFoundListener,
335 qualityOfService.getValue()
339 private static native void getDeviceInfo1(
342 int connectivityType,
343 OnDeviceFoundListener onDeviceFoundListener,
344 int qualityOfService) throws OcException;
347 * API for Platform Discovery
349 * @param host Host IP Address. If null or empty, Multicast is performed.
350 * @param platformUri Uri containing address to the platform
351 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
353 * @param onPlatformFoundListener Handles events, success states and failure states.
354 * @throws OcException
357 public static void getPlatformInfo(
360 OcConnectivityType connectivityType,
361 OnPlatformFoundListener onPlatformFoundListener) throws OcException {
362 OcPlatform.initCheck();
363 OcPlatform.getPlatformInfo0(
366 connectivityType.getValue(),
367 onPlatformFoundListener
371 private static native void getPlatformInfo0(
374 int connectivityType,
375 OnPlatformFoundListener onPlatformInfoFoundListener) throws OcException;
378 * API for Platform Discovery
380 * @param host Host IP Address. If null or empty, Multicast is performed.
381 * @param platformUri Uri containing address to the platform
382 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
384 * @param onPlatformFoundListener Handles events, success states and failure states.
385 * @param qualityOfService the quality of communication
386 * @throws OcException
389 public static void getPlatformInfo(
392 OcConnectivityType connectivityType,
393 OnPlatformFoundListener onPlatformFoundListener,
394 QualityOfService qualityOfService) throws OcException {
395 OcPlatform.initCheck();
396 OcPlatform.getPlatformInfo1(
399 connectivityType.getValue(),
400 onPlatformFoundListener,
401 qualityOfService.getValue()
405 private static native void getPlatformInfo1(
408 int connectivityType,
409 OnPlatformFoundListener onPlatformFoundListener,
410 int qualityOfService) throws OcException;
413 * This API registers a resource with the server NOTE: This API applies to server side only.
415 * @param ocResource The instance of OcResource with all data filled
416 * @return resource handle
417 * @throws OcException
419 public static OcResourceHandle registerResource(
420 OcResource ocResource) throws OcException {
421 OcPlatform.initCheck();
422 return OcPlatform.registerResource0(ocResource);
425 private static native OcResourceHandle registerResource0(
426 OcResource ocResource) throws OcException;
429 * This API registers a resource with the server NOTE: This API applies to server side only.
431 * @param resourceUri The URI of the resource. Example: "a/light"
432 * @param resourceTypeName The resource type. Example: "light"
433 * @param resourceInterface The resource interface (whether it is collection etc).
434 * @param entityHandler entity handler.
435 * @param resourcePropertySet indicates the property of the resource
436 * @return resource handle
437 * @throws OcException
439 public static OcResourceHandle registerResource(
441 String resourceTypeName,
442 String resourceInterface,
443 EntityHandler entityHandler,
444 EnumSet<ResourceProperty> resourcePropertySet) throws OcException {
445 OcPlatform.initCheck();
449 for (ResourceProperty prop : ResourceProperty.values()) {
450 if (resourcePropertySet.contains(prop))
451 resProperty |= prop.getValue();
454 return OcPlatform.registerResource1(resourceUri,
461 private static native OcResourceHandle registerResource1(
463 String resourceTypeName,
464 String resourceInterface,
465 EntityHandler entityHandler,
466 int resourceProperty) throws OcException;
469 * Register Device Info
471 * @param ocDeviceInfo object containing all the device specific information
472 * @throws OcException
474 public static void registerDeviceInfo(
475 OcDeviceInfo ocDeviceInfo) throws OcException {
476 OcPlatform.initCheck();
477 OcPlatform.registerDeviceInfo0(
478 ocDeviceInfo.getDeviceName()
482 private static native void registerDeviceInfo0(
484 ) throws OcException;
487 * Register Platform Info
489 * @param ocPlatformInfo object containing all the platform specific information
490 * @throws OcException
492 public static void registerPlatformInfo(
493 OcPlatformInfo ocPlatformInfo) throws OcException {
494 OcPlatform.initCheck();
495 OcPlatform.registerPlatformInfo0(
496 ocPlatformInfo.getPlatformID(),
497 ocPlatformInfo.getManufacturerName(),
498 ocPlatformInfo.getManufacturerUrl(),
499 ocPlatformInfo.getModelNumber(),
500 ocPlatformInfo.getDateOfManufacture(),
501 ocPlatformInfo.getPlatformVersion(),
502 ocPlatformInfo.getOperatingSystemVersion(),
503 ocPlatformInfo.getHardwareVersion(),
504 ocPlatformInfo.getFirmwareVersion(),
505 ocPlatformInfo.getSupportUrl(),
506 ocPlatformInfo.getSystemTime()
510 private static native void registerPlatformInfo0(
511 String platformId, String manufacturerName, String manufacturerUrl,
512 String modelNumber, String dateOfManufacture, String platformVersion,
513 String operatingSystemVersion, String hardwareVersion, String firmwareVersion,
514 String supportUrl, String systemTime
515 ) throws OcException;
518 * This API unregisters a resource with the server NOTE: This API applies to server side only.
520 * @param ocResourceHandle This is the resource handle which we which to unregister from the
522 * @throws OcException
524 public static void unregisterResource(
525 OcResourceHandle ocResourceHandle) throws OcException {
526 OcPlatform.initCheck();
527 OcPlatform.unregisterResource0(ocResourceHandle);
530 private static native void unregisterResource0(
531 OcResourceHandle ocResourceHandle) throws OcException;
535 * Add a resource to a collection resource
537 * @param ocResourceCollectionHandle handle to the collection resource
538 * @param ocResourceHandle handle to resource to be added to the collection resource
539 * @throws OcException
541 public static void bindResource(
542 OcResourceHandle ocResourceCollectionHandle,
543 OcResourceHandle ocResourceHandle) throws OcException {
544 OcPlatform.initCheck();
545 OcPlatform.bindResource0(ocResourceCollectionHandle, ocResourceHandle);
548 private static native void bindResource0(
549 OcResourceHandle ocResourceCollectionHandle,
550 OcResourceHandle ocResourceHandle) throws OcException;
553 * Add multiple resources to a collection resource.
555 * @param ocResourceCollectionHandle handle to the collection resource
556 * @param ocResourceHandleList reference to list of resource handles to be added to the
557 * collection resource
558 * @throws OcException
560 public static void bindResources(
561 OcResourceHandle ocResourceCollectionHandle,
562 List<OcResourceHandle> ocResourceHandleList) throws OcException {
563 OcPlatform.initCheck();
564 OcPlatform.bindResources0(
565 ocResourceCollectionHandle,
566 ocResourceHandleList.toArray(
567 new OcResourceHandle[ocResourceHandleList.size()])
571 private static native void bindResources0(
572 OcResourceHandle ocResourceCollectionHandle,
573 OcResourceHandle[] ocResourceHandleArray) throws OcException;
576 * Unbind a resource from a collection resource.
578 * @param ocResourceCollectionHandle handle to the collection resource
579 * @param ocResourceHandle resource handle to be unbound from the collection resource
580 * @throws OcException
582 public static void unbindResource(
583 OcResourceHandle ocResourceCollectionHandle,
584 OcResourceHandle ocResourceHandle) throws OcException {
585 OcPlatform.initCheck();
586 OcPlatform.unbindResource0(ocResourceCollectionHandle, ocResourceHandle);
589 private static native void unbindResource0(
590 OcResourceHandle ocResourceCollectionHandle,
591 OcResourceHandle ocResourceHandle) throws OcException;
594 * Unbind resources from a collection resource.
596 * @param ocResourceCollectionHandle Handle to the collection resource
597 * @param ocResourceHandleList List of resource handles to be unbound from the collection
599 * @throws OcException
601 public static void unbindResources(
602 OcResourceHandle ocResourceCollectionHandle,
603 List<OcResourceHandle> ocResourceHandleList) throws OcException {
604 OcPlatform.initCheck();
605 OcPlatform.unbindResources0(
606 ocResourceCollectionHandle,
607 ocResourceHandleList.toArray(
608 new OcResourceHandle[ocResourceHandleList.size()])
612 private static native void unbindResources0(
613 OcResourceHandle ocResourceCollectionHandle,
614 OcResourceHandle[] ocResourceHandleArray) throws OcException;
617 * Binds a type to a particular resource
619 * @param ocResourceHandle handle to the resource
620 * @param resourceTypeName new typename to bind to the resource
621 * @throws OcException
623 public static void bindTypeToResource(
624 OcResourceHandle ocResourceHandle,
625 String resourceTypeName) throws OcException {
626 OcPlatform.initCheck();
627 OcPlatform.bindTypeToResource0(ocResourceHandle, resourceTypeName);
630 private static native void bindTypeToResource0(
631 OcResourceHandle ocResourceHandle,
632 String resourceTypeName) throws OcException;
635 * Binds an interface to a particular resource
637 * @param ocResourceHandle handle to the resource
638 * @param resourceInterfaceName new interface to bind to the resource
639 * @throws OcException
641 public static void bindInterfaceToResource(
642 OcResourceHandle ocResourceHandle,
643 String resourceInterfaceName) throws OcException {
644 OcPlatform.initCheck();
645 OcPlatform.bindInterfaceToResource0(ocResourceHandle, resourceInterfaceName);
648 private static native void bindInterfaceToResource0(
649 OcResourceHandle ocResourceHandle,
650 String resourceInterfaceName) throws OcException;
653 * Start Presence announcements.
655 * @param ttl time to live in seconds
656 * @throws OcException
658 public static void startPresence(int ttl) throws OcException {
659 OcPlatform.initCheck();
660 OcPlatform.startPresence0(ttl);
663 private static native void startPresence0(int ttl) throws OcException;
666 * Stop Presence announcements.
668 * @throws OcException
670 public static void stopPresence() throws OcException {
671 OcPlatform.initCheck();
672 OcPlatform.stopPresence0();
675 private static native void stopPresence0() throws OcException;
678 * Subscribes to a server's presence change events. By making this subscription, every time a
679 * server adds/removes/alters a resource, starts or is intentionally stopped
681 * @param host The IP address/addressable name of the server to subscribe to
682 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
684 * @param onPresenceListener listener that will receive notifications/subscription events
685 * @return a handle object that can be used to identify this subscription request. It can be
686 * used to unsubscribe from these events in the future
687 * @throws OcException
689 public static OcPresenceHandle subscribePresence(
691 OcConnectivityType connectivityType,
692 OnPresenceListener onPresenceListener) throws OcException {
693 OcPlatform.initCheck();
694 return OcPlatform.subscribePresence0(
696 connectivityType.getValue(),
701 private static native OcPresenceHandle subscribePresence0(
703 int connectivityType,
704 OnPresenceListener onPresenceListener) throws OcException;
707 * Subscribes to a server's presence change events. By making this subscription, every time a
708 * server adds/removes/alters a resource, starts or is intentionally stopped
710 * @param host The IP address/addressable name of the server to subscribe to
711 * @param resourceType a resource type specified as a filter for subscription events.
712 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
714 * @param onPresenceListener listener that will receive notifications/subscription events
715 * @return a handle object that can be used to identify this subscription request. It can be
716 * used to unsubscribe from these events in the future
717 * @throws OcException
719 public static OcPresenceHandle subscribePresence(
722 OcConnectivityType connectivityType,
723 OnPresenceListener onPresenceListener) throws OcException {
724 OcPlatform.initCheck();
725 return OcPlatform.subscribePresence1(
728 connectivityType.getValue(),
732 private static native OcPresenceHandle subscribePresence1(
735 int connectivityType,
736 OnPresenceListener onPresenceListener) throws OcException;
739 * Unsubscribes from a previously subscribed server's presence events. Note that you may for
740 * a short time still receive events from the server since it may take time for the
741 * unsubscribe to take effect.
743 * @param ocPresenceHandle the handle object provided by the subscribePresence call that
744 * identifies this subscription
745 * @throws OcException
747 public static void unsubscribePresence(
748 OcPresenceHandle ocPresenceHandle) throws OcException {
749 OcPlatform.initCheck();
750 OcPlatform.unsubscribePresence0(ocPresenceHandle);
753 private static native void unsubscribePresence0(
754 OcPresenceHandle ocPresenceHandle) throws OcException;
757 * Creates a resource proxy object so that get/put/observe functionality can be used without
758 * discovering the object in advance. Note that the consumer of this method needs to provide
759 * all of the details required to correctly contact and observe the object. If the consumer
760 * lacks any of this information, they should discover the resource object normally.
761 * Additionally, you can only create this object if OcPlatform was initialized to be a Client
764 * @param host a string containing a resolvable host address of the server holding
766 * @param uri the rest of the resource's URI that will permit messages to be
769 * @param connectivityType a type of connectivity indicating the interface. Example: IPV4,
771 * @param isObservable a boolean containing whether the resource supports observation
772 * @param resourceTypeList a collection of resource types implemented by the resource
773 * @param interfaceList a collection of interfaces that the resource supports/implements
774 * @return new resource object
775 * @throws OcException
777 public static OcResource constructResourceObject(
780 OcConnectivityType connectivityType,
781 boolean isObservable,
782 List<String> resourceTypeList,
783 List<String> interfaceList) throws OcException {
784 OcPlatform.initCheck();
785 return OcPlatform.constructResourceObject0(
788 connectivityType.getValue(),
790 resourceTypeList.toArray(new String[resourceTypeList.size()]),
791 interfaceList.toArray(new String[interfaceList.size()])
795 private static native OcResource constructResourceObject0(
798 int connectivityType,
799 boolean isObservable,
800 String[] resourceTypes,
801 String[] interfaces) throws OcException;
804 * Allows application entity handler to send response to an incoming request.
806 * @param ocResourceResponse resource response
807 * @throws OcException
809 public static void sendResponse(OcResourceResponse ocResourceResponse)
811 OcPlatform.initCheck();
812 OcPlatform.sendResponse0(ocResourceResponse);
815 private static native void sendResponse0(OcResourceResponse ocResourceResponse)
819 * An OnResourceFoundListener can be registered via the OcPlatform.findResource call.
820 * Event listeners are notified asynchronously
822 public interface OnResourceFoundListener {
823 public void onResourceFound(OcResource resource);
827 * An OnDeviceFoundListener can be registered via the OcPlatform.getDeviceInfo call.
828 * Event listeners are notified asynchronously
830 public interface OnDeviceFoundListener {
831 public void onDeviceFound(OcRepresentation ocRepresentation);
835 * An OnPlatformFoundListener can be registered via the OcPlatform.getPlatformInfo call.
836 * Event listeners are notified asynchronously
838 public interface OnPlatformFoundListener {
839 public void onPlatformFound(OcRepresentation ocRepresentation);
843 * An OnPresenceListener can be registered via the OcPlatform.subscribePresence call.
844 * Event listeners are notified asynchronously
846 public interface OnPresenceListener {
847 public void onPresence(OcPresenceStatus ocPresenceStatus, int nonce, String hostAddress);
851 * An EntityHandler can be registered via the OcPlatform.registerResource call.
852 * Event listeners are notified asynchronously
854 public interface EntityHandler {
855 public EntityHandlerResult handleEntity(OcResourceRequest ocResourceRequest);
858 private static void initCheck() {
859 if (!sIsPlatformInitialized) {
860 throw new IllegalStateException("OcPlatform must be configured by making a call to " +
861 "OcPlatform.Configure before any other API calls are permitted");