문제 설명
OSGi 가져오기 버전 제한을 동적으로 설정하시겠습니까? (Setting OSGi import version restrictions dynamically?)
지금은 단 두 개의 번들로 구성된 OSGi 기반 웹 애플리케이션을 구축 중입니다. 그 중 하나에서 프로세스 엔진에서 프로세스 인스턴스를 로드하고 있습니다. 각 프로세스 인스턴스는 초기에 할당된 다른 번들의 특정 버전과 일치해야 합니다.
예를 들어, 번들 A에 하나의 프로세스 인스턴스를 로드하고 패키지를 사용하여 작업하고 싶습니다. 버전 1.0의 번들 B에서. 그 후에 다른 프로세스 인스턴스를 잡고 버전 2.0의 번들 B 패키지를 사용하여 작업합니다.
이 기능을 달성할 수 있는 방법이 있습니까?
정말 감사합니다. 미리 많이! 요하네스
참조 솔루션
방법 1:
Bundle A can only be exposed to a single version of a package at any given point. So other than possibly just using reflection, Bundle A cannot use 2 versions of the same package exported by different versions of Bundle B.
Or, do you mean that the 2 versions of Bundle B implement that same package differently. Then Bundle A could see different implementation objects from the 2 versions of Bundle B because they appear to be the same interface type to Bundle A. If this is the case, then OSGi services are the best way for Bundle B to publish these objects for Bundle A to use.
(by Johannes、BJ Hargrave)