osgi

How to access a resource / configuration / text file in an external Jar from Java?

人盡茶涼 提交于 2019-12-04 19:05:43
I am running a program in com.me.X.jar . In an external com.me.Y.jar , I have a configuration file located at ' config/conf.txt ' in the root of the Jar. How can I access this configuration file programmatically from within Java? com.me.Y.jar is not currently loaded in memory and is composed of just non-code resources. jar files are just zip files. So google for an example how to read a zip file. Or have a look at the API ZipInputStream The easiest option for reading embedded resources is to use Class.getResource or Class.getResourceAsStream I can think of several ways to achieve this,

What is the best way of grouping OSGi bundles to make a coherent 'application'

▼魔方 西西 提交于 2019-12-04 18:45:06
问题 The "OSGi way" is to develop separate bundles containing discrete, coherent pieces of functionality. Sometimes these bundles contain utility classes, sometimes they depend on utility classes and set up their own OSGi Services. Users, on the other hand, are unlikely to be exposed to bundles. They care more about the application , a piece of software that performs a task or solves their problem. Normally an application will use multiple bundles (say, imported via Import-Package) to perform its

OSGi Threading Model

て烟熏妆下的殇ゞ 提交于 2019-12-04 18:18:51
问题 I have searched the Internet but failed to find a satisfactory answer. What is the threading model present in an OSGi container? Does it simply spawn a new thread to each registered bundle e.g.? Any reference regarding the threading model would be great. 回答1: You have not found anything because there is no such thing as an "OSGi threading model". Bundles simply exist and don't "have threads" unless they start them. 回答2: The OSGi framework follows a synchronous model, ie. everything happens in

OSGI runtime inside traditional Java EE server

 ̄綄美尐妖づ 提交于 2019-12-04 18:14:26
问题 I understand it should probably be other way round (OSGI runtime hosting Java EE servers), as it is apparently already possible with glassfish. However, our clients have extensive experience in administering traditional Java EE servers and significant investment (licenses, training etc.) Our architecture would benefit from OSGI modular architecture, but I can not ask our clients to switch from Java EE servers to OSGI runtimes. Is there a way to install OSGI runtime as war or ear inside

Add plugins with auto start to eclipse RCP application

旧街凉风 提交于 2019-12-04 17:22:20
I have an Eclipse RCP application, and I am trying with no luck to install a plugin I have created that should be deployed separately to the aforementioned application. To do so, I start the application as ./App -console , and when it has stopped loading, I type: install file://URLTOjAR/plugin.jar It returns me a plugin ID (lets say 288 ), so I type afterwards: start 288 After this, the plugin is working fine, but when I restart the application, by using ss I only can see that the plugin is only "Resolved", but I'd like it to be started. Is there a way to automate this? The installed and

How do you properly implement a ManagedServiceFactory as Decalarative Service in OSGi?

◇◆丶佛笑我妖孽 提交于 2019-12-04 17:11:35
I have services that need to be created on a per-configuration base, each of which relies on an external resource and thus should manage it's own lifcycle (i.e. (de)register the service). Thus implementing these as DS and let SCR spawn multiple instances does not work. One can implement a bundle that registers a ManagedServiceFactory to accomplish this task perfectly (see my previous post ). But as a consequence, if the factory depends on several other services, you need to start tracking those services and write a lot of glue code to get everything running. Instead I'd like to implement the

What is the difference between “Import-Bundle” and “Require-Bundle”?

纵饮孤独 提交于 2019-12-04 17:03:51
问题 What is the difference between spring source dm server specific Import-Bundle and OSGi's Require-Bundle ? I am confused whether to use Import-Bundle or Require-Bundle in my project. 回答1: Import-Bundle is similar to Require-Bundle, it creates a complete dependency on the other bundle, including that bundle's dependencies. This transitivity is bad because you have no idea what you depend, creating the infamous "big ball of mud" problem we're so familiar with in Object oriented programming. In

How I can get list of all classes from given bundle

匆匆过客 提交于 2019-12-04 16:48:36
I have an Eclipse bundle and want to get a list of all classes from this bundle. How can I do it? The name of the classes from the bundle will be in classNameOfCurrentBundle list in the end: BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); // Getting all the class files (also from imported packages) Collection<String> resources = bundleWiring.listResources("/", "*.class", BundleWiring.LISTRESOURCES_RECURSE); List<String> classNamesOfCurrentBundle = new ArrayList<String>(); for (String resource : resources) { URL localResource = bundle.getEntry(resource); // Bundle.getEntry()

Prioritizing OSGi service selection within a container when more than one implementation exist

江枫思渺然 提交于 2019-12-04 16:20:28
问题 I am playing with OSGi and have a few bundles. Bundle A and B both contain a registered service which implements a single interface. The third bundle C includes code to lookup a service implementing the previously mentioned interface. The A and B bundles have different version numbers, however it appears that C picks up the service from the first started bundle. I have changed the start level to do the right thing, but version is only used to accept rather than order which service is returned

How should I build a modularized enterprise application which must use Spring and JPA?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 15:58:49
I'm planning to build a Java-based system to handle different business processes where each of these is a particular module in the system. Most modules would depend on some of the other modules to handle their particular business process. In other words, top modules would consume some sort of basic services provided by underlying modules. Some modules will be developed from the very beginning, but some will be added to the system later. Next, some modules will expose RESTful interfaces to handle external input / output. To handle all this, OSGi seems appropriate, but it's a bit difficult to