1

我在配置注册表中保存了一个 xml 文件/_system/config/test.xml。我的xml文件是:

<?xml version="1.0" encoding="UTF-8"?>
<ServiceDefinition>
<Source1001>Endpoint1</Source1001>
<Source1002>Endpoint2</Source1002>
</ServiceDefinition>

现在我可以创建一个代理来通过使用序列或类中介来更新上述 xml 文件的内容吗?如果我在代理的请求中通过新端点 = Endpoint3 和 Node = Source1001。然后对于节点 Source1001,我应该能够看到更改后的端点为 Endpoint3

期待您的回答。提前致谢。

4

3 回答 3

0

No built-in mediator can do this. You can write a class mediator to read the xml placed in registry, then save it after editing. You have to get the reference to registry service via osgi at the class mediator for that. FYI. you can get the input from message context and find the values to replace.

于 2013-06-26T07:30:06.397 回答
0

这篇 [1] 文章解释了如何创建类中介以从注册表资源中读取。希望这对您的任务有所帮助。

[1] http://vvratha.blogspot.com/2013/02/accessing-registry-resources-from-class.html

于 2013-07-01T11:51:50.237 回答
0

您可以在类中介器中使用以下代码段,也可以对脚本中介器执行相同的操作。

mc.getConfiguration().getRegistry().updateResource(
            resourcePath, mc.getProperty("myProperty").toString().getBytes());

您可以在此处找到有关如何使用其中任一调解器的更多详细信息

于 2015-09-04T01:13:51.963 回答