以编程方式添加声明式服务 [英] Programmatically adding declarative services

查看:90
本文介绍了以编程方式添加声明式服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用某种api添加声明式服务?

Is it possible to add declarative services using some kind of api?

一些背景:

我有一个基于动态脚本的服务器应用程序(可以随时添加,编辑或删除它们). 这些脚本具有对OSGi服务的依赖关系,并且可能相互依赖.每当脚本获得 编辑后,该脚本将编译为javascript,并检测到其依赖性.

I have a server application based on dynamic scripts (they can be added, edited or removed at any time). Those scripts have dependencies to OSGi services and possibly each other. Whenever a script gets edited, the script gets compiled to javascript, and its dependencies are detected.

那时候,我想(重新)将其注册为声明性服务,因此它将在其启用时被激活/停用. 依赖来来去去.

At that point, I'd like to (re)register it as a declarative service, so it will be activated / deactivated when its dependencies come and go.

  • 这有可能吗?还是我缺少主要的东西?
  • 如果无法使用OSGi标准,是否有针对Felix或Equinox的特定解决方案?
  • 您可以在其他框架(例如iPojo或蓝图)中做到这一点吗?

推荐答案

没有用于强制添加声明性服务的API.您可以使用普通的OSGi api来注册和使用服务.也许那就是你想要的?

There is no API to imperatively add declarative services. You can use the normal OSGi api to register and use services. Perhaps that is what you want?

您可能想签出依赖管理器,提供一个API模型,为您提供所需的依赖关系支持.

You may want to checkout the Dependency Manager which may provide an API model giving you the dependency support you want.

这篇关于以编程方式添加声明式服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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