【问题标题】:Which information can I get from osgi console about bundle service?我可以从 osgi 控制台获得哪些关于捆绑服务的信息?
【发布时间】:2014-07-22 09:13:50
【问题描述】:

我有 osgi 包(第三方):

此捆绑包有服务:

如果我点击该服务(http://localhost:4502/system/console/bundles->选择捆绑包->点击该服务),我会看到以下信息:

[org.osgi.service.event.EventHandler, com.adobe.granite.xss.XSSFilter]
    component.id    98
    component.name  com.adobe.granite.xss.impl.XSSFilterImpl
    event.topics    org/apache/sling/api/resource/Resource/*
    org/apache/sling/api/resource/ResourceProvider/*
    Service PID com.adobe.granite.xss.impl.XSSFilterImpl
    Service Vendor  Adobe Systems Incorporated
    Using Bundles   com.adobe.granite.security.user (73)
    com.day.cq.cq-xssprotection (75)
    org.apache.felix.eventadmin (38)

我在这里看到了 eventHandler,我想知道这个服务调用时的事件。

我想知道这段代码此时执行(事件发生后)?

【问题讨论】:

    标签: java events service osgi aem


    【解决方案1】:

    event.topics 服务属性是 OSGi EventHandler services 的标准服务属性,在这里它告诉您这个服务正在侦听以下 OSGi 事件主题:

    • org/apache/sling/api/resource/Resource/*
    • org/apache/sling/api/resource/ResourceProvider/*

    如果您想知道此类事件何时发生,您可以使用相同的主题注册您自己的 EventHandler,并在这些事件发生时记录消息 - 除非您的系统已经在 DEBUG 或其他日志中提供了该信息。

    要找出 XSSFilterImpl 执行的代码,您需要调试它,正如 Balazs Zsoldos 所指出的那样。

    【讨论】:

    • 如何激活这些活动主题?
    • 不确定您所说的“激活”是什么意思。当某些事情发生时,Sling 会发送带有这些主题的 OSGi 消息,您也可以直接发送此类消息,但这不是一个好主意。
    • 你能解释一下某些事情吗?
    • 抱歉,我之前错过了您的问题 - 正如sling.apache.org/documentation/tutorials-how-tos/… 中提到的,sling.apache.org/apidocs/sling7/org/apache/sling/api/… 的 SlingConstants 类的 javadocs 包含许多 TOPIC_ 常量,Sling 使用这些常量在“某些事情”发生时发送事件。常量描述解释了事件的含义。
    猜你喜欢
    • 1970-01-01
    • 2010-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多