osgi

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

旧城冷巷雨未停 提交于 2019-12-06 13:39:10
问题 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. 回答1: 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 回答2: The easiest option for reading embedded

Component-based application with scalability in mind: OSGi or Akka?

一世执手 提交于 2019-12-06 13:31:05
For my master thesis I'm developing an application framework for selling tickets for large events. My main requirements are modifiability, scalability and performance. My clients (event organisers) should be able to easily replace a component at runtime and add functionality. An example of such a component could be the seat assignment component. My mentors said to look at OSGi. The idea of loosely coupled bundles is certainly appealing. When looking for alternatives I discovered Akka. This framework promises a lot of things, like scalability and high performance. I wondered if Akka's concept

OSGi how to run mutliple instances of one service

筅森魡賤 提交于 2019-12-06 13:28:09
问题 Is it possible to run multiple instance of the same service in the osgi framework? More specific, I need to start multiple instances of a service, but each instance should recieve different parameters. This is because the services have similar functionality. But instead of writing a service for every variation, I want to reuse one implementing class. I've already found the registerService method in the framework api. ServiceRegistration<?> registration = bundlecontext.registerService(

How to run Vaadin 7 applications in Karaf?

寵の児 提交于 2019-12-06 13:09:18
I have been looking for days now, with lots of experiments, for an answer to this question. What do I need to do to be able to run applications, using version 7 of Vaadin Web framework, inside Karaf? There are some information about it but none of the solutions I read worked. The only related question I found on SO ( How to integrate Vaadin 7 with OSGi? ) does not really have an valid answer, at least for my question. Every time I follow a solution found by googling I always get lots of missing dependencies and I found myself indefinitely searching and installing bundles in order to satisfy

Injecting blueprint OSGi service into JSF/PrimeFaces bean

最后都变了- 提交于 2019-12-06 12:27:57
问题 I have a project built on top OSGi and Karaf server. For dependency injection we are using Aries Blueprint. The main part of the project is a Apache Camel routes and integration things, but now I need to create some maintenance web interface. So I give a try to JSF - PrimeFaces implementation. I was able to create some demo, which works in OSGi under Karaf, that's ok. Now I'd like to know if it's possible to use Blueprint here, to reference some already existing OSGi services we have and

How I can get list of all classes from given bundle

老子叫甜甜 提交于 2019-12-06 11:54:16
问题 I have an Eclipse bundle and want to get a list of all classes from this bundle. How can I do it? 回答1: 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>();

Can you have JSF custom components in different OSGi bundles?

蓝咒 提交于 2019-12-06 11:49:55
问题 Has anyone used OSGi and JSF together? I ask because JSF uses class-loader magic to find custom components. From a tutorial (emphasis mine): This configuration file will end up being META-INF/faces-config.xml in the .jar file that represents this component. JSF will look for such a file name in each of the .jar files that are loaded at runtime (in the WEB-INF/lib directory for .war files) and use each of them in its configuration. In this way, multiple component .jar files can be combined

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

ぃ、小莉子 提交于 2019-12-06 11:40:32
问题 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

Is there a Tomcat-like classloader that can be used standalone?

萝らか妹 提交于 2019-12-06 11:28:40
I'm working with a Java sort-of-application-server (Smartfox) which can run multiple applications ("extensions") but has a very inconvenient classpath setup to go along with it, along with issues when trying to use SLF4J. To work around that I'd like to wrap my applications in their own classloaders. Such a containing classloader should be much like Tomcat's, in that it Can load classes from a directory containing JARs. Prefers classes from its own classpath over those from the parent Is there a library somewhere that has such a classloader I can just "drag and drop" in my project? If not,

How do I register a service in OSGi (Apache Felix)?

﹥>﹥吖頭↗ 提交于 2019-12-06 10:31:34
I have successfully managed to start Apache Felix from code and register an own Bundle. Following relation between OSGI-projects is needed: [OsgiInterface] -- provides interfaces. [OsgiModuleA] -- (bundle) provides an implementation of those interfaces. knows [OsgiInterface] [OsgiUsage] -- makes use of one or more bundle. knows [OsgiInterface] and [OsgiModuleA] Now I have problems registering a service which implements an interface. I would guess that my entries in manifest.mf files are wrong. Additional information It would be very kind, if someone could look at the code in my previous