osgi

Dynamic target for declarative service in OSGI

橙三吉。 提交于 2019-12-20 04:13:43
问题 Given a consumer which uses a service, how can this consumer select a specific provider dynamically using declarative service ? Example Service.java public interface Service { public void do(); } Provider1.java public class Provider1 implements Service { @Override public void do(){ //a way } } Provider2.java public class Provider2 implements Service { @Override public void do(){ //another way } } Consumer.java public class Consumer { private Service myService; protected void bindService

Should I close the session before closing the resource resolver

拥有回忆 提交于 2019-12-20 02:59:20
问题 I have simple service, lets use resourceResolver and session for some logic: @Component(immediate = true) @Service(value = ServiceInterface.class) public class ServiceInterfaceImpl implements ServiceInterface { //Some fields @Reference private ResourceResolverFactory resolverFactory; private void someMethod() { ResourceResolver resourceResolver = null; try { resourceResolver = resolverFactory.getServiceResourceResolver(null); Session session = resourceResolver.adaptTo(Session.class)

OSGi bundles won't start - Unable to resolve sun.reflect.generics.reflectiveObjects

ぃ、小莉子 提交于 2019-12-20 02:32:38
问题 After seemingly irrelevant changes in the code of my AEM project, my bundle fails to resolve. Upon inspecting the logs, I can see the following errors appearing. 22.04.2015 11:00:18.650 *ERROR* [qtp1266495948-35] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unresolved constraint in bundle my-bundle ... [caused by: Unable to resolve 401.121: missing requirement [401.121] osgi.wiring.package; (osgi.wiring.package=sun.reflect.generics

Jpa-hibernate error while starting the service

依然范特西╮ 提交于 2019-12-19 11:17:57
问题 Below is the error from the log that i see after starting the service... can you help resolving this issue. 2013-08-22 10:35:37,111 | DEBUG | l Console Thread | AbstractServiceReferenceRecipe | r.AbstractServiceReferenceRecipe 143 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Found initial references null for OSGi service (&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=tenant))(objectClass=javax.persistence.EntityManagerFactory)) 2013-08-22 10:35:37,111 | DEBUG | l Console

Find the dependent bundles in Eclipse at runtime

[亡魂溺海] 提交于 2019-12-19 07:36:20
问题 How can an Eclipse bundle (eg. within activator code) find the dependent Bundle instances at runtime? I would like to find the bundles that Eclipse has choosen to satisfy the dependency requirements, I do not want to interprete the manifest myself. An example: I would like to find all resources named "marker.txt" in all bundles on which my current bundle depends upon. Also the transitive dependencies. In order to accomplish this I need to be able to find all these bundles to begin with. 回答1:

Lazy activation of Eclipse plugins

蹲街弑〆低调 提交于 2019-12-19 07:05:34
问题 I would like to know what is "Activate this plug-in when one of its classes is loaded" check-box in Eclipse manifest editor useful for. I thought Eclipse always use "lazy initialization" approach. Does have this option a relation to the BundleActivator class of the plugin? is initialization something different to activation? Here is a similar question, but I don't understand it entirely. 回答1: Ticking the box causes the following header to be set in the manifest: Bundle-ActivationPolicy: lazy

OSGi and application servers

烈酒焚心 提交于 2019-12-19 05:22:23
问题 I'm having trouble undrstanding the difference about both platforms? Both seem to offer an environment for deploying and managing applications. First I thought app servers use OSGi under the hood, I don't think so now but I see large AS (jboss, glassfish, websphere, etc) use OSGi. What's the big picture? Thank you 回答1: There is (to some extend) an overload of the term "application". OSGi is a runtime environment (and development model) for modular Java applications. The term "application" in

OSGI expose An “ClassNotFoundException: org.w3c.dom.***” Error when release

流过昼夜 提交于 2019-12-19 03:42:17
问题 I only wrote the following codes in Activator.start() function public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; Node node = new Node() { @Override public Object setUserData(String arg0, Object arg1, UserDataHandler arg2) { // TODO Auto-generated method stub return null; } @Override public void setTextContent(String arg0) throws DOMException { // TODO Auto-generated method stub } @Override public void setPrefix(String arg0) throws

When should I use a platform like OSGI and when it must be avoided?

不羁岁月 提交于 2019-12-18 18:55:32
问题 My question is pretty straightforward: What are the features of an application that force the developer to exploit OSGI-like system? What are the cases, when such a utility is unneeded? 回答1: I just posted the following link to another question (What does OSGi solve), but I think here it is an even better fit. Hal Hildebrand wrote a blog about why and when he thinks OSGi is helping your development/product. The core essence of the (pretty long) post is that it helps especially when dealing

Android Activity in OSGI Bundle

痴心易碎 提交于 2019-12-18 17:38:25
问题 I am working on developing OSGI bundles that have a full support for android. So far, by my previous questions, I was able to use android API inside OSGI bundle. It works fine and I tried it. I am using Felix framework. However, I am stuck now at the mission of making an OSGI bundle to have an android activity and to start that activity. I also need these activities to be able to request permissions so I guess I will need an AndroidManifest.xml in the OSGI bundle. While doing a research, I