IBM Worklight:扩展服务器端Java代码 [英] IBM Worklight: Extend Server-side Java Code

查看:137
本文介绍了IBM Worklight:扩展服务器端Java代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Worklight中扩展服务器端Java代码吗?
例如, com.worklight.integration.js 下有一个名为 JavaScriptIntegrationLibraryImplementation 的类。在这个类中,有一个方法 broadcastNotification ,我想覆盖这个方法。是否可以这样做?

Can I extend the server-side Java Code in Worklight? For example, there is a class called JavaScriptIntegrationLibraryImplementation under com.worklight.integration.js. Inside this class, there is a method broadcastNotification and I would like to override this method. Is it possible to do so?

编辑

原因是:
当我制作在客户端使用选项字段进行订阅(例如添加customType:A),我想检索已订阅此事件源的设备列表。基于deviceSubscrpition中的选项字段,我希望有一些业务逻辑来确定发送通知消息的人员。例如,我只会将消息提交给'customType = A'的用户。


$
但是,Worklight中没有API可以检索使我首先检索列表的设备列表。然后在JavaScript中执行逻辑并调用WL.Server.notifyDevice ..


因此,我想检查是否有任何方法来检索设备列表(通过API / Adapter)它已连接到已订阅事件源的DB。

EDIT
The reason is that: When I make the subscription in client side with option field (e.g. add customType: A), I would like to retrieve a list of devices which have been subscribed to this event source. Base on the option field in deviceSubscrpition, I would like to have some business logic to determine who to send the notification message. For example, I will only submit the message to the user which 'customType=A'.

However, there is no API in Worklight which can retrieve a list of devices which make me to retrieve the list first. Then do the logic in JavaScript and called WL.Server.notifyDevice..

Therefore, I would like to check whether there is any method to retrieve a list of devices (through API / Adapter which connects to DB) which have subscribed to an event source.

谢谢。

推荐答案

Worklight的这部分不可扩展。您可以尝试覆盖此方法,但请注意这不受支持,在这种情况下我们无法提供帮助。

This part of Worklight is not extendable. You can try and override this method as you say, but do note this is not supported and we cannot help in this case.

修改

现在很清楚你想要实现的目标......你目前所寻找的目标是什么。我将打开一个功能请求,它将在某个时候得到评估(如果您是IBM的客户,我建议您与您的联系人联系......)。

Now that it is clear what you're trying to achieve... what you are looking for currently not available. I will open a feature request for it and it will get evaluated at some point (if you are a customer of IBM, I suggest to get in touch with your contact...).

我的建议(在形式上有些晦涩):你可以使用多个事件源,其中每个事件源代表一个iOS版本。在客户端,在应用程序初始化时,您可以检索iOS版本并使用它来注册到正确的事件源(这将是非常通用的代码以允许重复使用)。如果发布了新的iOS版本(您可能会提前知道),只需将此事件源添加到适配器代码并重新部署适配器即可。新iOS版本的用户仍然可以注册通知,因为您在初始化时获得iOS版本,并使用此信息注册到正确的事件源...

My suggestion (somewhat hackish in form): you could perhaps use multiple Event Sources, where each event source represents an iOS version. On the client-side, upon app initialization, you can retrieve the iOS version and use it to register to the correct event source (this would be very generic code to allow re-use). In case a new iOS version is released (you will likely know of this in advance), you simply add this event source to the adapter code and re-deploy the adapter. Users of the new iOS version could still register for notification, because you get the iOS version upon init, and use this information to register to the correct event source...

重申:

适配器包含:ES_iOS5 ES_iOS6

The adapter contains: ES_iOS5 ES_iOS6

客户:


  • 获取iOS版本,将其存储在某个变量中。

  • 注册到事件源,其中事件源名称为ES _ $ {iOSVersion}

  • 如果发布新的iOS版本,只需创建一个新事件来源并重新部署
    适配器;客户已经准备好处理这个问题了。

这篇关于IBM Worklight:扩展服务器端Java代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆